freshcrate
Skin:/
Home > Frameworks > agency

agency

A fast and minimal framework for building agentic systems

Why this rank:Strong adoptionHealthy release cadence

Description

A fast and minimal framework for building agentic systems

README

Summary

Agency is a python library that provides an Actor model framework for creating agent-integrated systems.

The library provides an easy to use API that enables you to connect agents with traditional software systems in a flexible and scalable way, allowing you to develop any architecture you need.

Agency's goal is to enable developers to create custom agent-based applications by providing a minimal foundation to both experiment and build upon. So if you're looking to build a custom agent system of your own, Agency might be for you.

Features

Easy to use API

Performance and Scalability

  • Supports multiprocessing and multithreading for concurrency
  • AMQP support for networked agent systems

Observability and Control

  • Action and lifecycle callbacks
  • Access policies and permission callbacks
  • Detailed logging

Demo application available at examples/demo

  • Multiple agent examples for experimentation
    • Two OpenAI agent examples
    • HuggingFace transformers agent example
    • Operating system access
  • Includes Gradio UI
  • Docker configuration for reference and development

API Overview

In Agency, all entities are represented as instances of the Agent class. This includes all AI-driven agents, software interfaces, or human users that may communicate as part of your application.

All agents may expose "actions" that other agents can discover and invoke at run time. An example of a simple agent could be:

class CalculatorAgent(Agent):
    @action
    def add(a, b):
        return a + b

This defines an agent with a single action: add. Other agents will be able to call this method by sending a message to an instance of CalculatorAgent and specifying the add action. For example:

other_agent.send({
    'to': 'CalcAgent',
    'action': {
        'name': 'add',
        'args': {
            'a': 1,
            'b': 2,
        }
    },
})

Actions may specify an access policy, allowing you to control access for safety.

@action(access_policy=ACCESS_PERMITTED) # This allows the action at any time
def add(a, b):
    ...

@action(access_policy=ACCESS_REQUESTED) # This requires review before the action
def add(a, b):
    ...

Agents may also define callbacks for various purposes:

class CalculatorAgent(Agent):
    ...
    def before_action(self, message: dict):
        """Called before an action is attempted"""

    def after_action(self, message: dict, return_value: str, error: str):
        """Called after an action is attempted"""

    def after_add(self):
        """Called after the agent is added to a space and may begin communicating"""

    def before_remove(self):
        """Called before the agent is removed from the space"""

A Space is how you connect your agents together. An agent cannot communicate with others until it is added to a common Space.

There are two included Space implementations to choose from:

  • LocalSpace - which connects agents within the same application.
  • AMQPSpace - which connects agents across a network using an AMQP server like RabbitMQ.

Finally, here is a simple example of creating a LocalSpace and adding two agents to it.

space = LocalSpace()
space.add(CalculatorAgent, "CalcAgent")
space.add(MyAgent, "MyAgent")
# The agents above can now communicate

These are just the basic features that Agency provides. For more information please see the help site.

Install

pip install agency

or

poetry add agency

The Demo Application

The demo application is maintained as an experimental development environment and a showcase for library features. It includes multiple agent examples which may communicate with eachother and supports a "slash" syntax for invoking actions as an agent yourself.

To run the demo, please follow the directions at examples/demo.

The following is a screenshot of the Gradio UI that demonstrates the example OpenAIFunctionAgent following orders and interacting with the Host agent.

Screenshot-2023-07-26-at-4-53-05-PM

Contributing

Please do!

If you're considering a contribution, please check out the contributing guide.

Planned Work

See the issues page.

If you have any suggestions or otherwise, feel free to add an issue or open a discussion.

Release History

VersionChangesUrgencyDate
v1.6.3Includes [Parameterization of Max Workers in ResourceManager #185](https://github.com/operand/agency/pull/185) from @migueldl96 🎉Low4/24/2024
v1.6.1Updates `AMQPSpace` to use a topic exchange for better observability. Thanks @wwj718! 🙏 Low9/26/2023
v1.6.0I'm proud to announce Agency v1.6.0. Technically, it represents a big step forward and I believe is a milestone in terms of clarity for the project. It took some iterating and lots of thoughtful feedback, but I think the learnings from the last few versions have come together to create a clearer picture for the API and architecture. I believe there is a good foundation now to focus on the next steps: [js client](https://github.com/operand/agency/issues/136), [code execution](https://github.coLow9/26/2023
v1.5.0 This release addresses the request related issues brought up [here](https://github.com/operand/agency/issues/142) regarding the use of multiple "meta" id's and the semantics of automatic responses to messages. Shoutout to @wwj718 for the great feedback for these updates! Since this includes breaking changes, the version has been bumped to 1.5.0. # Summary: - All messages now populate the `meta.id` field with a UUID by default. Agents may set their own custom `meta.id` upon sending to Low9/18/2023
v1.4.1Fixes a regression in the 1.4.0 release related to the AMQP exchange parameterLow9/11/2023
v1.4.0 # Summary of Changes This release brings multiprocessing support and a few nice API improvements. Notably, I've added an implementation of synchronous messaging with the new `request()` method, and I've introduced logging support for development and debugging. There are a number of breaking API changes in this release. Please read through the following summary to update your codebase. Since this update required a rather large internal change, please beware of bugs and report any issueLow9/7/2023
v1.3.1Fixes an issue that caused high CPU usage when using the AMQPSpace class. Thanks @wwj718!Low8/11/2023
v1.3.0 # Summary of Changes This release brings many API and internal improvements. I've incorporated a lot of the great feedback I've been getting and improved multiple areas in terms of clarity, organization, and implementation. What I'm most excited about is that the API feels like it's beginning to reach a relatively clean and extensible form, enabling more possibilities to follow. A number of syntactic and semantic changes have been made. I've summarized the changes here, but for full dLow8/9/2023
v1.2.4# Summary of changes: ## Demo changes: * Replaced the React based UI with a Gradio UI in demos. * Renamed `WebApp` class to `ReactApp`. * Moved both app implementations (Gradio, React) to the [`./examples/demo/apps`](./examples/demo/apps/) directory. * Simplified demos to only include the `Host` and `OpenAIFunctionAgent` by default for a better initial experience. * Moved agent mixins (`HelpMethods`, `PromptMethods`) to a `./mixins` subdirectory * Simplified AMQP demo environment to oLow7/27/2023
v1.2.3Fixes a bug in the `Agent._help` method. https://github.com/operand/agency/pull/86Low7/21/2023
v1.2.2Fixed a bug with broadcasting in an AMQPSpace - https://github.com/operand/agency/pull/79Low7/16/2023
v1.2.1Fixes an issue which would cause malformed messages to be repeatedly resent. https://github.com/operand/agency/pull/74. Thanks @wwj718!Low7/14/2023
v1.2.0 # Summary of Changes * pika AMQP library replaced with [kombu](https://github.com/celery/kombu). Kombu brings us a significant step closer to supporting multimedia and other great features such as compression or alternate messaging backends like Redis or Amazon SQS! * Fixed an issue preventing heartbeats from being sent causing connection drops. * Added generic AMQP connection options class `AMQPOptions`. Previously custom AMQP options were supplied as a `pika.ConnectionParameters` Low7/14/2023
v1.1.1Removed `eventlet` library dependency from core library to prevent issues related to eventletLow7/11/2023
v1.1.0# Summary of 1.1.0 changes * `Agent` class changes: * The concept of "fully qualified ids" and nested namespacing has been removed. All agents may declare any string `id` and will receive messages at that `id` and messages that are broadcast in their space. * For better compatibility with the AMQP standard, agent id's must now: - Be 1 to 255 characters in length - Cannot start with the reserved sequence `"amq."` * `_after_add` and `_before_remove` callbacks added Low7/7/2023
v1.0.4* Moved example classes out of core libraryLow6/20/2023

Dependencies & License Audit

Loading dependencies...

Similar Packages

AGENTS.md_generator🤖 Generate secure, automated repo documentation and pull request checks with a safe-by-default toolchain for coding agents.main@2026-06-01
SimpleLLMFuncA simple and well-tailored LLM application framework that enables you to seamlessly integrate LLM capabilities in the most "Code-Centric" manner. LLM As Function, Prompt As Code. 一ä¸ĒįŽ€å•įš„æ°åˆ°v0.8.4
planning-with-files📄 Transform your workflow with persistent markdown files for planning, tracking progress, and storing knowledge like a pro.master@2026-06-07
deer-flowAn open-source long-horizon SuperAgent harness that researches, codes, and creates. With the help of sandboxes, memories, tools, skill, subagents and message gateway, it handles different levels of tamain@2026-06-06
langchainThe agent engineering platformlangchain-core==1.4.1

More in Frameworks

schemathesisProperty-based testing framework for Open API and GraphQL based apps
spec_driven_developSpec-Driven Develop is a platform-agnostic AI agent skill that automates the pre-development workflow for large-scale complex tasks. It is not a framework, not a runtime, not a package manager — it is
DrasilGenerate all the things (focusing on research software)
langchainThe agent engineering platform