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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

micro_agent_router-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

micro_agent_router-0.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

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

Hashes for micro_agent_router-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3513b7df101b1d9686334f770ad892e1d50478a5930f52ac2540fdababda2f34
MD5 f72de4720f7355a694491363a3179873
BLAKE2b-256 86b71ae444b2c5f9a552d78d093560db057df7a485ad91b08f912d97bce3e643

See more details on using hashes here.

Provenance

The following attestation bundles were made for micro_agent_router-0.1.0.tar.gz:

Publisher: publish.yml on Encephos/micro-agent-router

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micro_agent_router-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for micro_agent_router-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 86664a3ecb49a270b23c1b290c44aecfc10a2076129388c85564895143e6cf02
MD5 e9ef5821f8b3cd80bdae324f032c8d21
BLAKE2b-256 5178d45531bddbd7dc55ecca619102fe19a8aa56a7cc2c68d5ae9a8058474352

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

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