micro-agent-router
A zero-dependency, ultra-lightweight state machine for building agentic AI workflows. It gives you the routing power of LangGraph, without the steep learning curve and massive framework bloat.
The Problem
Building Agentic workflows (like a Researcher LLM passing data to a Writer LLM) requires a state machine. Frameworks like LangGraph or AutoGen are powerful but incredibly heavy. They require you to learn custom decorators, specific graph compiling steps, and complex state management classes.
Sometimes, you just want to run standard Python functions in a loop based on their outputs.
The Solution
micro-agent-router is a pure Python library that acts as a simple traffic controller. You register standard Python functions as "nodes". Each function just returns a dictionary telling the router where to go next.
Installation
pip install micro-agent-router
Usage
Here is a full agentic workflow (Writer -> Reviewer) in just a few lines of vanilla Python:
from micro_agent_router import MicroAgentRouter
# 1. Define your standard Python functions (Nodes)
def writer_agent(state: dict):
print("Writing article...")
state["content"] = "This is a great article."
# Just return where to route next!
return {"next": "reviewer_agent", "data": state}
def reviewer_agent(state: dict):
print("Reviewing article...")
# Add your LLM logic here to decide if it's good or bad
is_good = True
if is_good:
state["status"] = "published"
return {"next": "__end__", "data": state} # Exits the loop
else:
state["status"] = "needs_revision"
return {"next": "writer_agent", "data": state} # Send it back!
# 2. Wire them up
router = MicroAgentRouter()
router.add_node("writer_agent", writer_agent)
router.add_node("reviewer_agent", reviewer_agent)
# 3. Set the entry point and run
router.set_start("writer_agent")
final_state = router.run(initial_data={"topic": "AI Agents"})
print(final_state)
# Output: {'topic': 'AI Agents', 'content': 'This is a great article.', 'status': 'published'}
Features
- Zero Dependencies: Pure standard library.
- Infinite Loop Protection: Built-in max_steps to prevent agents from getting stuck in eternal loops and draining your API budget.
- Transparent State: The state is just a standard Python dictionary passed between your functions. No magic classes.
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 micro_agent_router-0.1.0.tar.gz.
File metadata
- Download URL: micro_agent_router-0.1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3513b7df101b1d9686334f770ad892e1d50478a5930f52ac2540fdababda2f34
|
|
| MD5 |
f72de4720f7355a694491363a3179873
|
|
| BLAKE2b-256 |
86b71ae444b2c5f9a552d78d093560db057df7a485ad91b08f912d97bce3e643
|
Provenance
The following attestation bundles were made for micro_agent_router-0.1.0.tar.gz:
Publisher:
publish.yml on Encephos/micro-agent-router
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
micro_agent_router-0.1.0.tar.gz -
Subject digest:
3513b7df101b1d9686334f770ad892e1d50478a5930f52ac2540fdababda2f34 - Sigstore transparency entry: 2684497452
- Sigstore integration time:
-
Permalink:
Encephos/micro-agent-router@8f89b4342f52608dd8f3f9bd08a60dec8d8c75c3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Encephos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8f89b4342f52608dd8f3f9bd08a60dec8d8c75c3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file micro_agent_router-0.1.0-py3-none-any.whl.
File metadata
- Download URL: micro_agent_router-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86664a3ecb49a270b23c1b290c44aecfc10a2076129388c85564895143e6cf02
|
|
| MD5 |
e9ef5821f8b3cd80bdae324f032c8d21
|
|
| BLAKE2b-256 |
5178d45531bddbd7dc55ecca619102fe19a8aa56a7cc2c68d5ae9a8058474352
|
Provenance
The following attestation bundles were made for micro_agent_router-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Encephos/micro-agent-router
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
micro_agent_router-0.1.0-py3-none-any.whl -
Subject digest:
86664a3ecb49a270b23c1b290c44aecfc10a2076129388c85564895143e6cf02 - Sigstore transparency entry: 2684497499
- Sigstore integration time:
-
Permalink:
Encephos/micro-agent-router@8f89b4342f52608dd8f3f9bd08a60dec8d8c75c3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Encephos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8f89b4342f52608dd8f3f9bd08a60dec8d8c75c3 -
Trigger Event:
release
-
Statement type: