Go to file
Aymeric 3a28bda490 Refine doc 2024-12-22 22:09:53 +01:00
docs Refine doc 2024-12-22 22:09:53 +01:00
examples Multiple documentation improvements 2024-12-21 23:11:15 +01:00
src/agents Multiple documentation improvements 2024-12-21 23:11:15 +01:00
tests Multiple documentation improvements 2024-12-21 23:11:15 +01:00
.gitignore Add E2B doc 2024-12-20 16:50:27 +01:00
Dockerfile Add E2B code interpreter 🥳 2024-12-20 16:20:41 +01:00
LICENSE Initial commit 2024-12-05 12:28:04 +01:00
Makefile Uv config 2024-12-11 16:15:49 +01:00
README.md Refine doc 2024-12-22 22:09:53 +01:00
e2b.Dockerfile Add E2B code interpreter 🥳 2024-12-20 16:20:41 +01:00
e2b.toml Add E2B code interpreter 🥳 2024-12-20 16:20:41 +01:00
pyproject.toml Downgrade minimum python version 2024-12-20 12:16:19 +01:00
requirements.in Uv config 2024-12-11 16:15:49 +01:00
requirements.txt Ruff formatting 2024-12-11 16:16:18 +01:00
server.py another example 2024-12-17 17:01:34 +01:00

README.md

License Documentation GitHub release Contributor Covenant

Agents - build great agents!

Agents is a library that enables you to run powerful agents in a few lines of code! It is:

  • lightweight
  • understandable (we kept abstractions to the minimum)
  • the only library with first-class support for Code Agents, i.e. agents that write their actions in code!

Quick demo: First install the package.

pip install agents

Then define your agent, give it the tools it needs and run it!

from agents import CodeAgent, WebSearchTool

agent = CodeAgent(tools=[WebSearchTool()])

agent.run("What time would the world's fastest car take to travel from New York to San Francisco?")

TODO: Add video

Code agents?

We built agents where the LLM engine writes its actions in code. This approach is demonstrated to work better than the current industry practice of letting the LLM output a dictionary of the tools it wants to calls: uses 30% fewer steps (thus 30% fewer LLM calls) and reaches higher performance on difficult benchmarks. Head to [./conceptual_guides/intro_agents.md] to learn more on that.

Especially, since code execution can be a security concern (arbitrary code execution!), we provide options at runtime:

  • a secure python interpreter to run code more safely in your environment
  • a sandboxed environment.

How lightweight is it?

We strived to keep abstractions to a strict minimum, with the main code in agents.py being roughly 1,000 lines of code, and still being quite complete, with several types of agents implemented: CodeAgent writing its actions in code snippets, JsonAgent, ToolCallingAgent...

Many people ask: why use a framework at all? Well, because a big part of this stuff is non-trivial. For instance, the code agent has to keep a consistent format for code throughout its system prompt, its parser, the execution. Its variables have to be properly handled throughout. So our framework handles this complexity for you.