Metadata-Version: 2.4
Name: microloop
Version: 0.3.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: License :: OSI Approved :: MIT License
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Development Status :: 4 - Beta
License-File: LICENSE-MIT
License-File: LICENSE-APACHE
Summary: Local reliability runtime for autonomous agents
Keywords: agent,llm,trajectory,progress,loop-detection
Author: Microloop Team
License-Expression: MIT OR Apache-2.0
Requires-Python: >=3.10, <3.14
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/Devaretanmay/microloop
Project-URL: Repository, https://github.com/Devaretanmay/microloop

# Microloop Python SDK

Python bindings for the Microloop local reliability runtime.

```python
from microloop import InterventionAction, Monitor, Policy

policy = Policy(
    stalled=InterventionAction.Replan,
    regressing=InterventionAction.Stop,
    cooldown_steps=5,
)
monitor = Monitor(policy=policy)

for step in agent.steps():
    decision = monitor.observe(
        action=step.action,
        observation=step.result,
        state=step.state,
        metrics={"exit_code": step.exit_code},
    )
    if decision.should_intervene:
        agent.inject(decision.recovery_context)
```

`Monitor.observe(...)` returns a `Decision` with `status`, `reasons`,
`intervention`, `severity`, `verified_progress` and `feedback`. The default
policy only observes; automatic recovery requires explicit opt-in.

You own the agent loop. `Monitor` classifies and advises; it never runs tools,
calls a model, or stops a process.

## CLI

```bash
microloop inspect trajectory.jsonl   # detection only, default observe-only policy
microloop replay trajectory.jsonl --json  # re-run recorded events through the engine
microloop monitor trajectory.jsonl --follow
microloop doctor
```

`replay` re-runs *recorded events* through the current engine. It does not
reproduce the original agent execution. A trajectory with an incompatible
`schema_version` major version is rejected rather than analyzed.

## Building

```bash
pip install maturin
maturin develop --manifest-path python/microloop/Cargo.toml
```

No external credentials or network connections are required. All trajectory
evaluation runs locally in Rust via PyO3.

