Skip to content

dendrite-systems/langchain-dendrite-competition-analysis-agent

Repository files navigation

Dendrite Demo (1)

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.



Overview/Features

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



Prerequisites

To run this yourself locally, you'll need the following:

Pro tip:



Dendrite Example Snippet

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")



Getting Started

  1. Download this repo:

    git clone https://github.com/dendrite-systems/langchain-dendrite-example.git
    cd langchain-dendrite-example
  2. 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
  3. Create a .env file – Get a free Dendrite API key here.

    OPENAI_API_KEY=sk-Cs...
    DENDRITE_API_KEY=sk_4b0...
    
  4. Run the project:

    # with poetry
    poetry run streamlit run agent.py
    # with pip
    streamlit run agent.py
  5. 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:

    1. Install the Dendrite Vault Chrome Extension
    2. Log into Outlook in your browser
    3. Open the Dendrite vault extension
    4. 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].



Why is Dendrite so slow the first time I run a tool, and then so fast?

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.



Contributing

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!)



Support

If you have any questions or need help, please join the Dendrite Discord

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages