Metadata-Version: 2.4
Name: any-agent
Version: 0.9.0
License: Apache-2.0
Project-URL: Documentation, https://mozilla-ai.github.io/any-agent/
Project-URL: Issues, https://github.com/mozilla-ai/any-agent/issues
Project-URL: Source, https://github.com/mozilla-ai/any-agent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: duckduckgo_search
Requires-Dist: fire
Requires-Dist: markdownify
Requires-Dist: opentelemetry-exporter-otlp
Requires-Dist: opentelemetry-sdk
Requires-Dist: pydantic
Requires-Dist: requests
Requires-Dist: rich
Requires-Dist: evaluate
Provides-Extra: google
Requires-Dist: google-adk; extra == "google"
Provides-Extra: langchain
Requires-Dist: langchain; extra == "langchain"
Requires-Dist: langchain-litellm; extra == "langchain"
Requires-Dist: langchain-mcp-adapters>=0.0.3; extra == "langchain"
Requires-Dist: langgraph; extra == "langchain"
Requires-Dist: langgraph-swarm; extra == "langchain"
Requires-Dist: openinference-instrumentation-langchain; extra == "langchain"
Provides-Extra: llama-index
Requires-Dist: llama-index; extra == "llama-index"
Requires-Dist: llama-index-llms-litellm; extra == "llama-index"
Requires-Dist: llama-index-tools-mcp; extra == "llama-index"
Requires-Dist: platformdirs>=4.3.7; extra == "llama-index"
Requires-Dist: openinference-instrumentation-llama-index; extra == "llama-index"
Provides-Extra: smolagents
Requires-Dist: smolagents[litellm,mcp]>=1.14.0; extra == "smolagents"
Requires-Dist: openinference-instrumentation-smolagents; extra == "smolagents"
Provides-Extra: openai
Requires-Dist: openai-agents[litellm]>=0.0.12; extra == "openai"
Requires-Dist: openinference-instrumentation-openai-agents>=0.1.5; extra == "openai"
Provides-Extra: agno
Requires-Dist: agno>=1.3.4; extra == "agno"
Requires-Dist: litellm; extra == "agno"
Provides-Extra: mcp
Requires-Dist: mcp>=1.5.0; extra == "mcp"
Provides-Extra: all
Requires-Dist: any-agent[agno,google,langchain,llama_index,mcp,openai,smolagents]; extra == "all"
Provides-Extra: docs
Requires-Dist: mkdocs; extra == "docs"
Requires-Dist: mkdocs-material; extra == "docs"
Requires-Dist: mkdocstrings-python; extra == "docs"
Requires-Dist: mkdocs-include-markdown-plugin>=7.1.5; extra == "docs"
Provides-Extra: tests
Requires-Dist: pytest<9,>=8; extra == "tests"
Requires-Dist: pytest-sugar>=0.9.6; extra == "tests"
Requires-Dist: pytest-asyncio>=0.26.0; extra == "tests"
Requires-Dist: debugpy>=1.8.13; extra == "tests"
Requires-Dist: mktestdocs>=0.2.4; extra == "tests"
Provides-Extra: dev
Requires-Dist: any-agent[docs,tests]; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Dynamic: license-file

# any-agent

<div align="center">

[![Docs](https://github.com/mozilla-ai/any-agent/actions/workflows/docs.yaml/badge.svg)](https://github.com/mozilla-ai/any-agent/actions/workflows/docs.yaml/)
[![Tests](https://github.com/mozilla-ai/any-agent/actions/workflows/tests.yaml/badge.svg)](https://github.com/mozilla-ai/any-agent/actions/workflows/tests.yaml/)
![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)

[Documentation](https://mozilla-ai.github.io/any-agent/)


[Blog Post Introduction and Motivation](https://blog.mozilla.ai/introducing-any-agent-an-abstraction-layer-between-your-code-and-the-many-agentic-frameworks/)

</div>

`any-agent` is a Python library designed to provide a single interface to access many different agent frameworks.

Using `any-agent`, you can more easily switch to a new or different agent framework without needing to worry about the underlying API changes.

any-agent also provides a 'trace-first' [llm-as-a-judge powered evaluation tool](https://mozilla-ai.github.io/any-agent/evaluation/) for flexible evaluation of agent execution traces.

## [Supported Frameworks](https://mozilla-ai.github.io/any-agent/frameworks/)

[![Google ADK](https://img.shields.io/badge/Google%20ADK-4285F4?logo=google&logoColor=white)](https://github.com/google/adk-python) [![LangChain](https://img.shields.io/badge/LangChain-1e4545?logo=langchain&logoColor=white)](https://github.com/langchain-ai/langgraph) [![LlamaIndex](https://img.shields.io/badge/🦙%20LlamaIndex-fbcfe2)](https://github.com/run-llama/llama_index) [![OpenAI Agents](https://img.shields.io/badge/OpenAI%20Agents-black?logo=openai)](https://github.com/openai/openai-agents-python) [![Smolagents](https://img.shields.io/badge/Smolagents-ffcb3a?logo=huggingface&logoColor=white)](https://smolagents.org/) [Agno AI](https://docs.agno.com/introduction)

### Planned for Support (Contributions Welcome!)

[Open Github tickets for new frameworks](https://github.com/mozilla-ai/any-agent/issues?q=is%3Aissue%20state%3Aopen%20label%3Aframeworks)

## Requirements

- Python 3.11 or newer

## Quickstart


Refer to [pyproject.toml](./pyproject.toml) for a list of the options available.
Update your pip install command to include the frameworks that you plan on using (or use `all` to install all the currently supported):

```bash
pip install 'any-agent[all]'
```

To define any agent system you will always use the same imports:

```py
from any_agent import AgentConfig, AnyAgent, TracingConfig
```
For this example we use a model hosted by openai, but you may need to set the relevant API key for whichever provider being used.
See [our Model docs](https://mozilla-ai.github.io/any-agent/frameworks/#models) for more information about using different models.

```bash
export OPENAI_API_KEY="YOUR_KEY_HERE"  # or MISTRAL_API_KEY, etc
```

### Single agent

```py
from any_agent.tools import search_web, visit_webpage

agent = AnyAgent.create(
    "openai",  # Framework type. See all options in https://mozilla-ai.github.io/any-agent/frameworks/
    AgentConfig(
        model_id="gpt-4.1-nano",
        instructions="Use the tools to find an answer",
        tools=[search_web, visit_webpage]
    ),
    tracing=TracingConfig(output_dir="traces") # Optional, but recommended for saving and viewing traces
)

agent.run("Which Agent Framework is the best??")
```

### Multi-agent

```py
from any_agent.tools import search_web, visit_webpage

agent = AnyAgent.create(
    "openai",  # Framework type. See all options in https://mozilla-ai.github.io/any-agent/frameworks/
    AgentConfig(
        model_id="gpt-4.1-mini",
        instructions="You are the main agent. Use the other available agents to find an answer",
    ),
    managed_agents=[
        AgentConfig(
            name="search_web_agent",
            description="An agent that can search the web",
            model_id="gpt-4.1-nano",
            tools=[search_web]
        ),
        AgentConfig(
            name="visit_webpage_agent",
            description="An agent that can visit webpages",
            model_id="gpt-4.1-nano",
            tools=[visit_webpage]
        )
    ]
)

agent.run("Which Agent Framework is the best??")
```

## Features

`any-agent` supports the use of Model Context Protocol (MCP) servers, and if the agent framework allows,
any LLM and provider using [LiteLLM](https://docs.litellm.ai/docs/) syntax.

Learn more in the docs:

- [Models](https://mozilla-ai.github.io/any-agent/frameworks/#models)
- [Tools](https://mozilla-ai.github.io/any-agent/tools/)
- [Instructions](https://mozilla-ai.github.io/any-agent/instructions/)
- [Tracing](https://mozilla-ai.github.io/any-agent/tracing/)
- [Evaluation](https://mozilla-ai.github.io/any-agent/evaluation/)


## Contributions

The AI agent space is moving fast! If you see a new agentic framework that AnyAgent doesn't yet support, we would love for you to create a Github issue. We also welcome your support in development of additional features or functionality.


## Running in Jupyter Notebook

If running in Jupyter Notebook you will need to add the following two lines before running AnyAgent, otherwise you may see the error `RuntimeError: This event loop is already running`. This is a known limitation of Jupyter Notebooks, see [Github Issue](https://github.com/jupyter/notebook/issues/3397#issuecomment-376803076)

```py
import nest_asyncio
nest_asyncio.apply()
```
