Skip to main content

micro-agent-router

PyPI version License: MIT

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.

Metadata

Release files for micro-agent-router 0.1.0

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

Source distribution (sdist)

Source distribution for micro-agent-router 0.1.0
File Size Uploaded Provenance Actions
micro_agent_router-0.1.0.tar.gz 4.8 kB With provenance Details for micro_agent_router-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for micro-agent-router 0.1.0
File Interpreter ABI Platform Actions
micro_agent_router-0.1.0-py3-none-any.whl Python 3 none any Details for micro_agent_router-0.1.0-py3-none-any.whl

Total release size: 9.4 kB

Release files / micro_agent_router-0.1.0.tar.gz

Download URL micro_agent_router-0.1.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3513b7df101b1d9686334f770ad892e1d50478a5930f52ac2540fdababda2f34
BLAKE2b-256 checksum
How to use checksums
86b71ae444b2c5f9a552d78d093560db057df7a485ad91b08f912d97bce3e643
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Release files / micro_agent_router-0.1.0-py3-none-any.whl

Download URL micro_agent_router-0.1.0-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86664a3ecb49a270b23c1b290c44aecfc10a2076129388c85564895143e6cf02
BLAKE2b-256 checksum
How to use checksums
5178d45531bddbd7dc55ecca619102fe19a8aa56a7cc2c68d5ae9a8058474352
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Security for micro-agent-router 0.1.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for micro_agent_router-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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