# Exercise: Build Your Own Agent

<https://colab.research.google.com/>

{% embed url="<https://github.com/dionny/ai-tutorial-notebooks/blob/main/BYOA.ipynb>" %}

```
OPENAI_API_KEY
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
```

```
from langchain_openai import ChatOpenAI
from langchain_anthropic import ChatAnthropic

from browser_use import Agent, Browser, BrowserConfig
import asyncio
from dotenv import load_dotenv
load_dotenv()

import logging

logging.basicConfig(level=logging.INFO, force=True)

import os
os.environ['OPENAI_API_KEY'] = "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"
os.environ['ANTHROPIC_API_KEY'] = "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"

config = BrowserConfig(
    headless=True,
    disable_security=False
)

browser = Browser(config=config)

async def main():
    agent = Agent(
        browser=browser,
        task="Search Bing for agentic software design and give me a relevance score for the search results.",
        llm=ChatAnthropic(model="claude-3-5-sonnet-20240620"),
    )
    await agent.run()

await main()

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ai-tutorial.dionny.dev/exercise-build-your-own-agent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
