devstein / langchain

⚡ Building applications with LLMs through composability ⚡
MIT License
1 stars 0 forks source link

Async Support | Plan & Execute #20

Open devstein opened 1 year ago

devstein commented 1 year ago

Feature request

I have been playing around with the Plan & Execute Agent.

Would love to see async support implemented.

Motivation

Would like to use it as a drop in agent replacement for my existing async setup.

Your contribution

Happy to help out where needed.

dosubot[bot] commented 1 year ago

Relevant Files

Explanation

docs/modules/agents/agent_executors/examples/async_agent.ipynb

To add async support to the Plan & Execute Agent, follow these steps:

  1. Update the AgentExecutor class to support async methods. This can be done by adding an async version of the run method called arun. This method should have the same logic as the run method, but with async/await syntax.

  2. Update the Tools that need async support by implementing coroutine methods. For example, if a Tool uses an HTTP request, you can use the aiohttp library to make the request asynchronously.

  3. Update the example notebook to demonstrate the usage of the async API. This can be done by creating a new section in the notebook that shows how to use the arun method and run multiple agents concurrently using asyncio.gather.

The provided async_agent.ipynb file already demonstrates the usage of the async API for Agents, so no changes are needed for this file.