A framework for building agents that interact with the world
Project description
AgentsPype
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
Agencyfor 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 classesAgentConfiguration: Pydantic model for agent settingsAgentStatus: Runtime status model
-
State Machine: Custom lightweight finite state machine engine
AgentStateMachine: Base class with auto-createdstarting,idle,endstatesBasicAgentStateMachine: Ready-to-use default implementation
-
Events: Typed pub/sub communication via EventsPype
AgentListening: Declarative event subscriptions (extendsMultiSubscriber)AgentPublishing: Event publication (extendsMultiPublisher)StateAgentPublishing: Automatically publishes state transition events
-
Runner: Agent orchestration and CLI
AgentRunner: Programmatic lifecycle management (setup, run, teardown)agentspypeCLI:run,create, andplotcommandsBaseRuntime: 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentspype-0.9.3.tar.gz.
File metadata
- Download URL: agentspype-0.9.3.tar.gz
- Upload date:
- Size: 163.0 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af4ccb05b69e15cbcbd2941224cd1bb91506b4e6119197fcc734eca1cb05e869
|
|
| MD5 |
79f0006163da5631af7de284c05f1ba0
|
|
| BLAKE2b-256 |
99e94351e32f93876b790a7ace42cafa3740910f3ecf6df4ea5a9617006e6cdf
|
File details
Details for the file agentspype-0.9.3-py3-none-any.whl.
File metadata
- Download URL: agentspype-0.9.3-py3-none-any.whl
- Upload date:
- Size: 76.6 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
faf5eaa229e11c283b9c4e58c34b4896ac11ba25578784badb3b681e0e42ea98
|
|
| MD5 |
de10e63b0b42389d2dddd5087e282edd
|
|
| BLAKE2b-256 |
e369e3d3768bb30038d4866b50ec45ddd5705502be58bea81582f1e43091d98f
|