Skip to main content

AgentsPype

CI codecov Python 3.13+ PyPI License: MIT Docs

A Python framework for building event-driven agents with finite state machines. AgentsPype combines declarative state machine definitions with typed pub/sub communication, built-in visualization, and a CLI runner for orchestrating agent lifecycles.

Features

  • State Machine Agents: Define agents with finite state machines, automatic state transitions, and lifecycle management
  • Event-Driven Communication: Type-safe pub/sub via EventsPype with declarative listening and publishing
  • Agent Runner: CLI and programmatic runner for orchestrating multi-agent setups from YAML configuration
  • Visualization: Generate diagrams for state machines, event publishing, event listening, and full agent architecture
  • Configuration Management: YAML-based configuration with Pydantic validation and optional interactive wizard
  • Agent Registry: Central Agency for tracking active agents and resolving agent classes by name
  • Clock Support: Optional time management via Chronopype for real-time and backtesting scenarios
  • Service Mode: Run agents as background services with REST API integration via ProcessPype
  • Type Safe: Fully typed with MyPy strict mode
  • Well Tested: Comprehensive test suite with coverage enforcement

Installation

# Using pip
pip install agentspype

# Using uv
uv add agentspype

Optional extras:

# Clock support
uv add agentspype[clock]

# Interactive configuration wizard
uv add agentspype[wizard]

# Service mode
uv add agentspype[service]

# All extras
uv add agentspype[all]

Quick Start

from agentspype.agent import Agent, AgentDefinition
from agentspype.agent.state_machine import BasicAgentStateMachine
from agentspype.agent.configuration import AgentConfiguration
from agentspype.agent.listening import AgentListening
from agentspype.agent.publishing import AgentPublishing
from agentspype.agent.status import AgentStatus


class MyAgent(Agent):
    definition = AgentDefinition(
        state_machine_class=BasicAgentStateMachine,
        configuration_class=AgentConfiguration,
        listening_class=AgentListening,
        publishing_class=AgentPublishing,
        status_class=AgentStatus,
    )

agent = MyAgent(AgentConfiguration(name="my-agent"))
agent.start()
print(agent.state_machine.current_state)
agent.stop()

Core Components

  • Agent: Base class with lifecycle management, configuration, state machine, and event wiring

    • AgentDefinition: Immutable binding of all agent component classes
    • AgentConfiguration: Pydantic model for agent settings
    • AgentStatus: Runtime status model
  • State Machine: Custom lightweight finite state machine engine

    • AgentStateMachine: Base class with auto-created starting, idle, end states
    • BasicAgentStateMachine: Ready-to-use default implementation
  • Events: Typed pub/sub communication via EventsPype

    • AgentListening: Declarative event subscriptions (extends MultiSubscriber)
    • AgentPublishing: Event publication (extends MultiPublisher)
    • StateAgentPublishing: Automatically publishes state transition events
  • Runner: Agent orchestration and CLI

    • AgentRunner: Programmatic lifecycle management (setup, run, teardown)
    • agentspype CLI: run, create, and plot commands
    • BaseRuntime: Typed resource registry for sharing objects across agents
  • Agency: Central registry for tracking and resolving agent instances

  • Visualization: Diagram generation via pydot

    • State machine, publishing, listening, and full agent architecture diagrams

Documentation

Full documentation is available at gianlucapagliara.github.io/agentspype.

Development

AgentsPype uses uv for dependency management and packaging:

# Install dependencies
uv sync

# Run tests
uv run pytest

# Run type checks
uv run mypy agentspype

# Run linting
uv run ruff check .

# Run pre-commit hooks
uv run pre-commit run --all-files

Metadata

Release files for agentspype 0.9.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentspype 0.9.3
File Size Uploaded Provenance Actions
agentspype-0.9.3.tar.gz 163.0 kB Without provenance Details for agentspype-0.9.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agentspype 0.9.3
File Interpreter ABI Platform Actions
agentspype-0.9.3-py3-none-any.whl Python 3 none any Details for agentspype-0.9.3-py3-none-any.whl

Total release size: 239.6 kB

Release files / agentspype-0.9.3.tar.gz

Download URL agentspype-0.9.3.tar.gz
Size 163.0 kB
Tags Source
SHA-256 checksum
How to use checksums
af4ccb05b69e15cbcbd2941224cd1bb91506b4e6119197fcc734eca1cb05e869
BLAKE2b-256 checksum
How to use checksums
99e94351e32f93876b790a7ace42cafa3740910f3ecf6df4ea5a9617006e6cdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / agentspype-0.9.3-py3-none-any.whl

Download URL agentspype-0.9.3-py3-none-any.whl
Size 76.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
faf5eaa229e11c283b9c4e58c34b4896ac11ba25578784badb3b681e0e42ea98
BLAKE2b-256 checksum
How to use checksums
e369e3d3768bb30038d4866b50ec45ddd5705502be58bea81582f1e43091d98f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for agentspype 0.9.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page