Skip to main content

Build and deploy stateful agents across federated resources.

Project description

Academy: Build and Deploy Federated Multi-Agent Systems

tests pre-commit.ci status

Academy is a modular and extensible middleware for building and deploying autonomous agents across federated research infrastructure. In Academy, you can:

  • ⚙️ Express agent behavior and state in code
  • 📫 Manage inter-agent coordination and asynchronous communication
  • 🌐 Deploy agents across distributed, federated, and heterogeneous resources

[!IMPORTANT] This project is currently being developed. Expect breaking changes in minor releases.

Installation

Academy is available on [PyPI][https://pypi.org/project/academy-py/].

pip install academy-py
Install from Source
**Clone the source:** ```bash git clone git@github.com:proxystore/academy ```

Create a virtual environment of your choosing:

python -m venv venv
. venv/bin/activate

Install the package & dependencies:

pip install -e .  # -e for editable mode

Getting Started

An agent is defined by its behavior, implemented as a Python class basing Behavior. Behavior methods decorated as @action can be invoked by peer agents while @loop methods define autonomous control loops. Any number of actions or control loops can be defined on a Behavior.

import time, threading
from academy.behavior import Behavior, action, loop

class Example(Behavior):
    def __init__(self) -> None:
        self.count = 0  # State stored as attributes

    @action
    def square(self, value: float) -> float:
        return value**2

    @loop
    def count(self, shutdown: threading.Event) -> None:
        while not shutdown.is_set():
            self.count += 1
            time.sleep(1)

Agents communicate asynchronously through handles, sending messages to and receiving messages from a mailbox stored in an Exchange. The Launcher abstracts the remote execution of an agent, and the Manager provides easy management of handles, launchers, and the exchange.

from academy.exchange.thread import ThreadExchange
from academy.launcher.thread import ThreadLauncher
from academy.manager import Manager

with Manager(
    exchange=ThreadExchange(),  # Can be swapped with
    launcher=ThreadLauncher(),  # other implementations
) as manager:
    behavior = Example()  # From the above block
    handle = manager.launch(behavior)

    future = handle.square(2)
    assert future.result() == 4

    handle.shutdown()  # Or via the manager
    manager.shutdown(handle, blocking=True)

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

academy_py-0.1.0.tar.gz (71.4 kB view details)

Uploaded Source

Built Distribution

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

academy_py-0.1.0-py3-none-any.whl (61.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: academy_py-0.1.0.tar.gz
  • Upload date:
  • Size: 71.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for academy_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 42284b4f2339703f70b49d12032c4aa2e8bc3581736f209f7b6c988ae5222bdb
MD5 3d4ce4a9eb88ce33c06b4c26cba9621e
BLAKE2b-256 e3bc301c981223d66a6da2c263233af2c5640f3249e63bea352ff1c428f33981

See more details on using hashes here.

File details

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

File metadata

  • Download URL: academy_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 61.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for academy_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b48aac6fadda1ef8aa00c61273dbb0dd4b5701ba7463db96fe58fcab8993c4a3
MD5 2bec58716e07eb7f4a20fe61ee54b81e
BLAKE2b-256 94b66f4a84fc286180882dfabfe630ccc60183787905e3d0c0eb2adaa7a54a56

See more details on using hashes here.

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