ant-ai is a lightweight Python framework for building multi-agent systems: graph-based workflow orchestration, first-class agent-to-agent (A2A) communication via the A2A protocol, MCP tool integration, lifecycle hooks for guardrails, and built-in observability — all on top of an LLM-agnostic core.
Multi-agent by design. Agents communicate and delegate via the A2A protocol — no custom glue code required.
No lock-in. Swap LLMs, tools, or observability backends without touching your agent logic.
Structured, not scripted. Model complex behavior as graphs — know exactly what runs, when, and why.
Observable from day one. Built-in tracing via Langfuse and lifecycle hooks for guardrails.
Requires Python 3.14+. Install with uv:
uv add ant-aiOr install with optional extras:
uv add "ant-ai[all]"
uv add "ant-ai[openai]"
uv add "ant-ai[langfuse]"
uv add "ant-ai[mem0]"
uv add "ant-ai[viz]"Or clone and sync for local development:
git clone git@github.com:idea-idsia/ant-ai.git
cd ant-ai
uv sync --all-packages --all-groups --all-extrasfrom ant_ai import Agent, Message, State, tool
from ant_ai.llm.integrations import LiteLLMChat
@tool
def get_weather(city: str) -> str:
"""Return the current weather for a city."""
return f"Sunny, 22°C in {city}"
llm = LiteLLMChat(model="gpt-4o-mini")
agent = Agent(
name="WeatherAgent",
system_prompt="You are a helpful weather assistant.",
llm=llm,
tools=[get_weather],
)
state = State(messages=[Message(role="user", content="What's the weather in Lugano?")])
answer = agent.invoke(state)
print(answer)from ant_ai.core import FinalAnswerEvent
async for event in agent.stream(state):
if isinstance(event, FinalAnswerEvent):
print(event.content)from pydantic import BaseModel
class WeatherReport(BaseModel):
city: str
temperature: int
condition: str
answer = agent.invoke(state, response_schema=WeatherReport)
# answer is a JSON string matching WeatherReport# Install dev dependencies and pre-commit hooks
uv sync --all-extras
uv run pre-commit install
# Run tests
uv run pytest
# Serve docs locally
uv run mkdocs serveSee CONTRIBUTING.md for the full contributing guide, branching model, and review process.
This software is licensed under the MIT license. See the LICENSE file for details.
This project is supported by the following grants.