Skip to main content

A lightweight Python framework for building multi-agent AI systems

Project description

ANT AI

Python License Coverage Docs

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 natively via the A2A protocol — build systems that grow without rewrites.

No lock-in. Swap LLMs, tools, or observability backends in one line. Your logic stays untouched.

Structured, not scripted. Model complex behavior as graphs. Know exactly what runs, when, and why.

Production-ready out of the box. Hooks, guardrails, and full observability via Langfuse and OpenTelemetry — without extra setup.

Installation

Requires Python 3.14+. Install with uv:

uv add ant-ai

Or clone and sync for local development:

git clone https://github.com/idea-idsia/ant-ai
cd ant-ai
uv sync --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.

Project details


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.0.4.tar.gz (46.6 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.0.4-py3-none-any.whl (70.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ant_ai-1.0.4.tar.gz
  • Upload date:
  • Size: 46.6 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.0.4.tar.gz
Algorithm Hash digest
SHA256 1fb32b965ab496d566c071dd670254bb75774561ab971f97bc99df170a0e1339
MD5 0d26dec26a0ae622a1a6cb14f8c82793
BLAKE2b-256 d13633c441fb6a62c4b33e571903fae899b6255d101b77ce98eabdaba82cd584

See more details on using hashes here.

Provenance

The following attestation bundles were made for ant_ai-1.0.4.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.0.4-py3-none-any.whl.

File metadata

  • Download URL: ant_ai-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 70.8 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.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4b566c93afd4b5c275024bc615acf7fdd5cd6317a568c71e2f01ab3d6d74f9e6
MD5 d6833a2697d942876b32e2e7a249812f
BLAKE2b-256 956213784297477b3c66fc8c9546e9135bca69ca3bdc71501c76fa00bff3ec5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ant_ai-1.0.4-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.

Supported by

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