lowcompressionLangchainCompetition.mp4
This example repo contains a simple LangGraph agent AI agent that can help us detect competitors by using a variety of websites with the Dendrite Browser SDK.
Repo contains:
- Langgraph Agent
- Streamlit UI
- Tool to extract and read about the latest posts on
- Product Hunt
- Hacker News
- Tool to log into Outlook and send emails
To run this yourself locally, you'll need the following:
- Python v. 3.9+
- An OpenAI API key
- A free Dendrite API key
- The Dendrite Vault Chrome Extension if you want to authenticate your agent to use your email.
Pro tip:
This is how easy it is to authenticate and send an email with Dendrite:
@tool
async def send_email(email_address: str, subject: str, body: str):
"""This tool sends an email to the provided email address with the provided subject and body. Don't use markdown in the body."""
async with AsyncDendrite(auth="outlook.live.com") as client:
await client.goto("https://outlook.live.com/mail/0/")
await client.click("the new email button")
await client.fill_fields(
{"to_field": email_address, "subject_field": subject, "body_field": body}
)
await client.click("the send email button")
-
Download this repo:
git clone https://github.com/dendrite-systems/langchain-dendrite-example.git
cd langchain-dendrite-example
-
Install packages – Don't forget
dendrite install
since this installs the browser binaries# with poetry poetry install && poetry run dendrite install
# with pip pip install -r requirements.txt && dendrite install
-
Create a
.env
file – Get a free Dendrite API key here.OPENAI_API_KEY=sk-Cs... DENDRITE_API_KEY=sk_4b0...
-
Run the project:
# with poetry poetry run streamlit run agent.py
# with pip streamlit run agent.py
-
Try it out, try sending the message:
Hi, I'm building an AI tool called FooBar. Please find any new potential competitors and summarise them.
To send emails, your agent needs to be authorized to use your Outlook account first. Here's how:
- Install the Dendrite Vault Chrome Extension
- Log into Outlook in your browser
- Open the Dendrite vault extension
- Press "Authenticate on outlook.com"
You should now be able to prompt the following:
Hi, I'm building an AI tool called FooBar. Please find any new potential competitors and summarise them. Send the summaries to me via [enter email here].
It's because the first time you call client.extract("get all the product hunt posts")
our coding agents need to generate a script to fetch the products from the HTML.
The next time you call the same prompt (and the website structure hasn't changed), the same script will be re-used – instantly returning the data.
Have any cool ideas for features/improvements, create a pull request – contribution is warmly welcome! :)
(I'd personally love to see chainlit added, I don't have time to add it now though!)
If you have any questions or need help, please join the Dendrite Discord