Skip to main content

Asynchronous Event-Driven Multi-Agent AI Orchestration Framework

Project description

agencydotai

Asynchronous Event-Driven Multi-Agent Framework

GitHub forks GitHub issues License: MIT

Fast, Asynchronous, and Decoupled Multi-Agent AI Orchestration

This is an open-source, high-performance Python framework built specifically for running production-grade multi-agent architectures using asynchronous pub/sub message passing. By decoupling agents entirely through a centralized event broker and strict JSON schemas, this framework provides predictable, event-driven control, zero-overhead idle states, and native human-in-the-loop circuit breakers.

  • MemoryBroker Event Bus: Eliminates tight coupling. Agents communicate purely by publishing and subscribing to discrete topics.
  • Zero-Overhead Asynchrony: Built on Python asyncio, ensuring agents only consume CPU cycles when actively processing an event.
  • Declarative Topologies: Define your entire multi-agent network, human-in-the-loop triggers, and tool permissions in a single YAML file.

Table of contents

Why This Framework?

Traditional multi-agent frameworks rely heavily on synchronous linear loops or tight class inheritance that couples agents directly to one another. This framework introduces a radically different paradigm designed for robust engineering requirements:

  • Event-Driven Asynchrony: Agents sleep when no events are present on their subscribed topics, reducing idle hardware utilization to zero.
  • Total Structural Decoupling: Agents do not know other agents exist. They only know what topics they subscribe to and what topics they output to, making runtime hot-swapping and scaling trivial.
  • Deterministic Guardrails: Native iteration counters act as circuit breakers to prevent runaway LLM loops and control costs out of the box.

Getting Started

Ensure you have Python >=3.10 installed on your system. You can install the framework directly using pip or uv:

pip install agencydotai

2. Scaffolding a Project

The framework includes a built-in CLI tool to generate clean, production-ready directory layouts instantly. Run the initialization command to build your architecture workspace:

agencydotai init examples/my_agentic_project

This command automatically generates a structured, isolated directory tree with all necessary boilerplate:

examples/my_agentic_project/
│   └── agency.yaml
│   ├── __init__.py
│   ├── agency/
│   │   ├── __init__.py
│   │   └── prompts/
│   │       ├── manager.md
│   │       └── researcher.md
│   │   └── tools/
│   │       ├── __init__.py
│   │       └── custom_tool.py
│   └── main.py
└── .env

Configuration and Usage

You do not need to write complex Python loops to connect your agents. The entire topology of your system is defined declaratively.

Defining Your Network

Modify the generated agency.yaml to define your agents, their pub/sub routes, and their safety guardrails: YAML

agency.yaml

manager_agent:
  role: "manager"
  subscribes:
    - "client_requests"
  publishes:
    - "analyst_tasks"
  tools: []
  interrupts:
    on_confidence_below: 0.7

analyst_agent:
  role: "spoke"
  subscribes:
    - "analyst_tasks"
  publishes:
    - "client_requests"
  tools:
    - "fetch_database_records"
  interrupts:
    require_approval_for:
      - "fetch_database_records"     

Running Your Architecture

Once configured, boot your framework using the standard Uvicorn server. The MemoryBroker will automatically bind your agents to the topics defined in your YAML.

cd examples/my_agentic_project
python main.py

Key Features

  • Strict Message Contracts: A universal JSON schema validation layer guarantees that missing headers, context, or trace tags reject early at the interface, keeping agent code clean.
  • Deterministic Loop Prevention: Built-in maximum iteration caps catch cascading multi-agent feedback logic errors before they trigger expensive runtime billing surprises.
  • Dynamic Event Interception: Reroute execution flows instantly using custom confidence limits or tool usage intercept matrices natively via the YAML configuration.
  • Auto-Generated Tool Scaffolding: The CLI automatically drops extensible base classes into your tools/ directory, making it trivial to add custom database, API, or local system integrations.

When to Use This Framework

  • Use this framework when you need more than a simple chatbot or a rigid linear script. It is designed for engineering teams that require:
  • Real-time observability into exactly what agents are passing to one another.
  • The ability to pause agent execution for human review before a destructive tool is fired.
  • High-concurrency environments where running infinite while True loops for idle agents is unacceptable.
  • The architectural freedom to swap out a single agent without rewriting the workflow logic of the entire system.

Contribution

Contributions are welcome and encouraged. To contribute:

  • Fork the repository.
  • Create a new feature branch.
  • Ensure all type hints and configurations are validated.
  • Submit a clean Pull Request targeting the base branch.

License

This framework is released under the MIT License.

Frequently Asked Questions (FAQ)

  • Q: Are the agents running concurrently on their own infinite loops?
  • A: No. The agents use async event-driven callbacks. They consume zero CPU cycles when idle and wake up instantly when a new serialized message hits their subscribed message broker topic.
  • Q: How does the framework protect against runaway agent API execution costs?
  • A: The message schema carries a mandatory context block keeping track of iteration_count. If a workflow loops continuously across the message broker between agents, the circuit breaker halts execution once the safety count is exceeded.
  • Q: Can this structure connect to alternative LLM backends or local models?
  • A: Yes. Because the agent brain is abstract and decoupled from I/O mechanisms, you can pass any LangChain-compatible generator module, direct HTTP clients, or local Ollama setups without altering your core messaging layout.

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

agencydotai-0.1.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

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

agencydotai-0.1.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file agencydotai-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for agencydotai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3b31198dda6c113ade6e56db6a5b1bd6ad3c0deec4e7a328965e19bef0780823
MD5 a82ba1f8ba97f0fb0f40170d6b89f9af
BLAKE2b-256 f056a7ac865c43ef1244af712e02c61c7fe668219ffe34330f5becb252f72cab

See more details on using hashes here.

Provenance

The following attestation bundles were made for agencydotai-0.1.0.tar.gz:

Publisher: publish.yml on propenster/agencydotai

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

File details

Details for the file agencydotai-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for agencydotai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f38079b3790836d20559b24d1a4219d2a15a90079ad50aeef19f0a287e425c4
MD5 04b01cd8da4027b7e0aab6e885ba81d2
BLAKE2b-256 1af08ac8f5a807197215f8a8b3fb541179cdf527807bdd6afda8c265ef346581

See more details on using hashes here.

Provenance

The following attestation bundles were made for agencydotai-0.1.0-py3-none-any.whl:

Publisher: publish.yml on propenster/agencydotai

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