A high-reliability, lightweight agent state machine runtime.
Project description
SolidState
A high-reliability, lightweight agent state machine runtime.
This project maps to the article/PDF proposal:
receive input
update state
call model
parse tool call
evaluate policy
execute or interrupt
update state
checkpoint
trace
continue or finish
The goal is not to replace LangChain, LangGraph, Semantic Kernel, OpenAI Agents SDK, CrewAI, or AutoGen.
The goal is to expose the runtime mechanics clearly.
Core runtime components
- Async & Parallel Execution: Built for non-blocking I/O with parallel tool execution support.
- StateGraph Engine: A minimal graph-based orchestrator for multi-agent handoffs and complex workflows.
- Smart Caching: Built-in response caching to reduce latency and model costs.
- Context Management: Automatic message history trimming to stay within context limits.
- Streaming Ready: Architecture supports token-by-token streaming for responsive UIs.
- Conditional Routing: Dynamic runtime routing using custom logic functions.
- Symbolic Syntax: Clean, expressive chaining using the
>>operator. - Visualization: Built-in support for generating Mermaid diagrams of your workflows.
- Multi-Provider: Adapters for OpenAI, Google Gemini, Anthropic (via AWS Bedrock), and Ollama (local).
- AWS Ready: Built-in support for Amazon Bedrock (models) and Amazon DynamoDB (persistence).
- Cloud Native: Distributed state via Redis and structured observability via CloudWatch JSON Tracing.
- Message state: Standardized format for system, user, and assistant/model turns.
- Tool registry: Dynamic function registration with multi-tool support.
- Tool schema generator: Automatic JSON schema generation with Pydantic support.
- Policy evaluator: Extensible rules for tool approval and rejection.
- Execution engine: Robust loop with max-step controls and error handling.
- State store/checkpointer: JSON-based persistence for pause/resume.
- Tracing and audit log: Detailed JSONL logs for every internal decision.
Install
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
Run examples
| File | Feature Demonstrated |
|---|---|
01_basic_runtime.py |
Simple agent conversation loop. |
02_tool_execution.py |
Tool registration and successful execution. |
03_policy_interrupt.py |
Safety policies and automatic rejections. |
04_resume_after_approval.py |
Human-in-the-loop (Pause & Resume). |
05_credit_review_demo.py |
Real-world banking workflow simulation. |
06_ollama_local_run.py |
Running on 100% local hardware. |
07_multi_agent_graph.py |
Orchestrating multiple specialized agents. |
08_symbolic_chaining.py |
Using the >> operator for clean pipelines. |
09_conditional_router.py |
Dynamic routing and Mermaid visualization. |
10_performance_bench.py |
Smart Caching and Context Trimming. |
11_researcher_writer_graph.py |
Complex 3-agent reasoning pipeline. |
12_structured_data_extraction.py |
Pydantic model support for tool arguments. |
13_error_recovery_retry.py |
Self-healing agents (retrying on tool failure). |
14_manual_state_injection.py |
Programmatic state manipulation. |
15_aws_lambda_handler.py |
Deployment template for AWS Lambda + DynamoDB. |
16_distributed_redis_state.py |
Distributed state management using Redis. |
17_cloudwatch_tracing.py |
Structured JSON observability for CloudWatch. |
18_parallel_tool_execution.py |
Concurrent execution of multiple tool calls using asyncio.gather. |
19_multi_threaded_actor_graph.py |
Graph execution in multi-threaded Actor Mode. |
20_token_streaming.py |
Real-time token streaming from the model adapter. |
Project philosophy
The model reasons.
The runtime controls execution.
Every serious agent framework has to answer the same engineering question:
How do we let a probabilistic system participate in deterministic business execution without losing control?
Documentation
The framework is documented in 10 chapters, covering the journey from core state machine philosophy to a production-ready concurrent system:
- Introduction: Philosophy and core pillars.
- Chapter 1: Philosophy & The State Machine Pattern: Deterministic control over probabilistic models.
- Chapter 2: The Core Loop Execution: Step limits, context trimming, and execution loops.
- Chapter 3: Message & State Representation: Structuring states, roles, and timestamps.
- Chapter 4: The Tool Registry & Parameter Introspection: Auto-boxing schemas and execution safety boundaries.
- Chapter 5: Guardrails, Policies & Human-in-the-Loop: Governance, Evaluator decisions, and asymmetric approvals.
- Chapter 6: Multi-Agent Orchestration & The StateGraph: Nodes, edges, routers, and symbolic
>>operator chaining. - Chapter 7: Concurrency & The Multi-threaded Actor Model: Multi-threaded queue-based actors and worker threads.
- Chapter 8: Memory & State Persistence (Checkpointing): BaseCheckpointer contracts, Local files, Redis, and DynamoDB.
- Chapter 9: Observability, Observational Integrity & Tracing: Auditing decisions, JSONL records, and CloudWatch structures.
- Chapter 10: Production Performance, Caching & Cloud Serverless: Adapters, flyweight caching, and AWS Lambda serverless handlers.
Tests
The project includes a robust test suite covering 100% of the core logic:
pytest
| Suite | Focus |
|---|---|
test_runtime_loop.py |
Async turn execution and parallel tool calls. |
test_graph.py |
Node transitions and conditional routing. |
test_tool_registry.py |
Pydantic schema generation and autoboxing. |
test_policy_evaluator.py |
Approval/Rejection logic. |
test_checkpoint_resume.py |
Persistence and state recovery. |
test_tracing.py |
Audit log integrity. |
test_new_features.py |
State serialization and adapter mock streaming. |
Contributing & Feedback
We welcome contributions! Please feel free to:
- Report bugs or suggest new features by opening a GitHub Issue.
- Read our Contributing Guidelines to set up your local development environment and submit Pull Requests.
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 solidstate_fsm-0.1.0.tar.gz.
File metadata
- Download URL: solidstate_fsm-0.1.0.tar.gz
- Upload date:
- Size: 28.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1220418d812fc96420b58794f071f038f37ffcea9ff7edd2f653a90c77231dc0
|
|
| MD5 |
5674fe625f1ac8ec934e3e28750c2334
|
|
| BLAKE2b-256 |
d373cc0aa83a57cd6a222e4efeeb9256491e48158ea4a51d58c5ab07d40bfe1c
|
File details
Details for the file solidstate_fsm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: solidstate_fsm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa365a0768dd868820faf78acf0feb0befbc7ce3bc805538316ac48f29967ff5
|
|
| MD5 |
ed7fe3161090c2b40d8415baa410138b
|
|
| BLAKE2b-256 |
017bfcf0ea37685aa73d6e6152e79d053abdb0cc3f4c7c340e4dc3c6ac56e407
|