How mycelium-labs/mycelium works
Mycelium is an action-reliability layer for AI agents: Python applications use the SDK directly, while TypeScript, Go, and other HTTP clients can use its development sidecar. The principal workflow checks a proposed tool action, coordinates an idempotent claim, controls execution and recovery, then records an outcome. The graph also includes documented configuration, budget/context controls, integrations, and Doctor/Verify capabilities. Sidecar and several broader capabilities are mapped from README and tree evidence; their internal wiring is not asserted where source excerpts were unavailable.
Main entry points: protect.py Tool boundary · action_ledger.py Action ledger · tool_runner.py Tool runner · __init__.py Python runtime
Components 22
Application entry
- Python runtime
sdk/mycelium/runtime/__init__.py - HTTP sidecar
sdk/mycelium/sidecar.py - TS and Go clients
clients
Action safeguards
- Tool boundary
sdk/mycelium/protect.py - Config and policies
sdk/mycelium/config.py - Input and scope checks
sdk/mycelium/scope_guard.py - Authority checks
sdk/mycelium/authority_window.py - Run budgets
sdk/mycelium/budget_guard.py - Context and completion
sdk/mycelium/completion_contract.py
Execution lifecycle
- Tool runner
sdk/mycelium/tool_runner.py - Action decision
sdk/mycelium/decision.py - Action ledger
sdk/mycelium/action_ledger.py - Outcome reconciliation
sdk/mycelium/reconcile.py - Outcome and receipts
sdk/mycelium/outcome_emit.py
Durable state
- Ledger storage
sdk/mycelium/ledger_storage.py - Storage backends
sdk/mycelium/storage
Operations and integrations
- Configuration Doctor
sdk/mycelium/doctor/engine.py - Failure verification
sdk/mycelium/verify/engine.py - Framework adapters
sdk/mycelium/integrations
Other components
- AI agent
- Host application
- External tool provider
Connections 23
- AI agent → Host application: proposes action
- Host application → Python runtime: calls runtime
- Host application → TS and Go clients: uses client
- TS and Go clients → HTTP sidecar: sends HTTP
- Python runtime → Tool boundary: routes actions
- HTTP sidecar → Action ledger: handles effect lifecycle
- Tool boundary → Config and policies: loads policy
- Tool boundary → Input and scope checks: checks arguments
- Tool boundary → Authority checks: checks authority
- Tool boundary → Run budgets: checks budgets
- Tool boundary → Context and completion: checks run state
- Tool boundary → Action decision: produces decision
- Tool boundary → Tool runner: dispatches action
- Tool runner → External tool provider: calls tool
- Tool runner → Action ledger: claims and records
- Action ledger → Ledger storage: reads and writes
- Ledger storage → Storage backends: persists entries
- Action ledger → Outcome reconciliation: resolves uncertainty
- Outcome reconciliation → Outcome and receipts: records result
- Configuration Doctor → Config and policies: inspects configuration
- Failure verification → Configuration Doctor: runs first
- Failure verification → Action ledger: exercises lifecycle
- Framework adapters → Python runtime: adapts frameworks