Skip to main content
ANT AI

Python License PyPI - Version Coverage Docs DOI

A lightweight Python framework for building tool-driven AI agents and multi-agent systems.


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.

Why ANT AI

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.

Installation

Requires Python 3.14+. Install with uv:

uv add ant-ai

Or 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]"
uv add "ant-ai[guardrails-ai]"

The guardrails-ai extra installs the core library. Validators (e.g. ToxicLanguage, DetectPII) are distributed via the Guardrails Hub and must be installed separately after running guardrails configure:

# Run from outside the project directory so uv doesn't pick up exclude-newer
(cd /tmp && guardrails hub install hub://guardrails/toxic_language hub://guardrails/detect_pii)
# Copy the registry into the project root so imports resolve from here
cp /tmp/.guardrails/hub_registry.json .guardrails/

Note: hub validators are installed outside of uv's lockfile and must be reinstalled after uv sync. The cd /tmp wrapper is required because these packages ship without upload dates, which conflicts with the project's exclude-newer = "P2D" supply-chain setting. Running from /tmp (where no pyproject.toml exists) lets uv install them without that constraint while still targeting the active virtualenv. The hub_registry.json copy is needed because guardrails resolves hub imports from a .guardrails/hub_registry.json file relative to the current working directory.

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-extras

Quickstart

Single agent

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

Streaming events

from ant_ai.core import FinalAnswerEvent

async for event in agent.stream(state):
    if isinstance(event, FinalAnswerEvent):
        print(event.content)

Structured output

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

Development

# 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 serve

See CONTRIBUTING.md for the full contributing guide, branching model, and review process.

License

This software is licensed under the MIT license. See the LICENSE file for details.

Citation

If you use ant-ai in your research, please cite it. See CITATION.cff for the machine-readable citation metadata, or use the BibTeX entry below.

@software{Sas_ant-ai_A_lightweight_2026,
author = {Sas, Cezar and Giuffrida, Vincenzo and Mitrović, Sandra and Salani, Matteo},
doi = {10.5281/zenodo.21276625},
license = {MIT},
month = jun,
title = {{ant-ai: A lightweight Python framework for building multi-agent AI systems}},
url = {https://github.com/idea-idsia/ant-ai},
year = {2026}
}

Funding

This project is supported by the following grants.

Acknowledgement
Funded by the Swiss State Secretariat for Education, Research and Innovation (SERI), Project number 24.00596.
Funded by the European Union under Grant Agreement No. 101189745 (HIVEMIND).
Funded by the European Union

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ant_ai-1.6.2.tar.gz (62.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ant_ai-1.6.2-py3-none-any.whl (91.7 kB view details)

Uploaded Python 3

File details

Details for the file ant_ai-1.6.2.tar.gz.

File metadata

  • Download URL: ant_ai-1.6.2.tar.gz
  • Upload date:
  • Size: 62.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ant_ai-1.6.2.tar.gz
Algorithm Hash digest
SHA256 077a62a3ca883d4f34520328b768d3e90b84c72bfb777d6281da8210e5cbbd92
MD5 8e01dcfb3fa87dc52142699d2fd79fed
BLAKE2b-256 0e3e93e192aa1c2633560757b198e13004501819971d0c8cc61f9f12135236e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ant_ai-1.6.2.tar.gz:

Publisher: publish.yml on idea-idsia/ant-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ant_ai-1.6.2-py3-none-any.whl.

File metadata

  • Download URL: ant_ai-1.6.2-py3-none-any.whl
  • Upload date:
  • Size: 91.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ant_ai-1.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e7976a8e24fcb91d9484d75f5193eb7c8210118e0bbf344afcd4bf296ae04a17
MD5 953c87caa2fdc39bc03f6bb784c6b3b3
BLAKE2b-256 9e718b61bff1e8479c36e366797959480b26b7d304209163826a659e191e8dd3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ant_ai-1.6.2-py3-none-any.whl:

Publisher: publish.yml on idea-idsia/ant-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.7.0

2 files

This release

1.6.2 This release

2 files

1.6.1

2 files

1.6.0

2 files

1.5.14

2 files

1.5.13

2 files

1.5.12

2 files

1.5.11

2 files

1.5.10

2 files

1.5.9

2 files

1.5.8

2 files

1.5.7

2 files

1.5.6

2 files

1.5.5

2 files

1.5.4

2 files

1.5.3

2 files

1.5.2

2 files

1.5.1

2 files

1.5.0

2 files

1.4.0

2 files

1.3.1

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page