Sentry README

The project's README from github.com/nuglifeleoji/Sentry. As one markdown file: README.md.

Sentry Logo

Sentry: An external self-improving failure management layer for LLM agents.

Sentry runs alongside your agent loop to detect failures, guide recovery, and learn reusable lessons from verified recoveries.

Quick Start  |  Paper (arXiv)  |  License

Python 3.10+ MIT License arXiv

What is Sentry?

Sentry is an external runtime failure management layer for LLM agents. It helps agents fix invalid actions and recover when they get stuck in loops, drift from the task, or make unsupported assumptions. Unlike typical runtime monitors with fixed advice, Sentry learns and evolves from recoveries that work. By detecting failures, guiding recovery, and checking that the repair worked, Sentry helps agents become more reliable across tasks without cluttering their context.

Demo

Sentry demo

Key Results

Results reported in the paper:

Quick Start

Installation

Sentry requires Python 3.10 or later.

git clone https://github.com/nuglifeleoji/Sentry.git
cd Sentry
python -m venv .venv
source .venv/bin/activate
python -m pip install -e .

Configure a Model

Copy the OpenAI configuration template, then set your model ID:

mkdir -p outputs
cp configs/providers/openai.yaml outputs/sentry.yaml
export OPENAI_API_KEY="your-api-key"

In outputs/sentry.yaml, replace YOUR_DEPLOYMENT_MODEL_ID with the exact model ID available to your account. Then validate the configuration:

sentry-validate outputs/sentry.yaml

Validation prints the resolved configuration as JSON without making a model request. For other providers or a local endpoint, see Model providers.

Try a Recovery

Run this Python example from the repository root. It submits an intentionally malformed action and asks the configured model to rewrite it:

from Sentry import SentryRunner, agent_step_from_parts

runner = SentryRunner.from_yaml("outputs/sentry.yaml")
runner.start_task(
    objective="Inspect item 42 to check its price.",
    action_schema='Return JSON: {"tool": "inspect", "args": {"item_id": <integer>}}',
)

try:
    step = agent_step_from_parts(
        step_id=0,
        reasoning="Open the item details before deciding whether to buy.",
        raw_action="inspect item 42",
        observation="Item 42 is visible; its price has not been inspected.",
        parsed_ok=False,
        schema_valid=False,
        parser_error="Expected a JSON object; received plain text.",
    )
    repair = runner.step(step)
    if repair is not None:
        print("Repair route:", repair.route)
        print("Next action:", runner.generate_repair(repair))
finally:
    runner.finalize()

The route is hard_repair; the next action is model-generated and should follow the JSON schema. This example makes one model request and does not execute the returned action.

For a real agent, submit each action-observation cycle to Sentry and include any returned guidance when generating the next action. Your application handles action generation, validation, execution, and task completion. Follow Agent integration for the full lifecycle and validity rules.

How It Works

Sentry framework: failure detection, repair, verification, and playbook learning

  1. Failure Detection: Sentry monitors recent agent steps for invalid actions and behavioral failures.
  2. Hard Repair: Sentry asks the agent to retry invalid actions in the required format.
  3. Soft Repair: Progress and reasoning failures receive targeted guidance from relevant playbook lessons.
  4. Recovery Verification: Sentry checks whether the agent recovers over the following steps.
  5. Online Playbook Learning: Verified soft recoveries become reusable lessons for similar failures across tasks.

Documentation

The guides follow the recommended reading order: model-provider setup, configuration, agent integration, playbook and logging, and the AppWorld benchmark.

Guide Contents
Model providers Credentials, provider templates, and endpoint configuration
Configuration Model and storage options, fixed algorithm settings, and configuration validation
Agent integration Task lifecycle, step inputs, repair guidance, and recovery verification
Playbook and logging Cross-task memory, persistence, explicit loading, and runtime logs
AppWorld benchmark Environment setup, task selection, run limits, and result files

The paper also examines conditional lesson exposure, fine-grained retrieval, transfer to unseen tasks, and combining Sentry with context evolution.

Release Status

This checkout includes the Sentry runtime, model-provider adapters, configuration templates, tests, and an AppWorld reference benchmark. The benchmark runner currently supports AppWorld dev tasks. The other benchmarks reported in the paper do not yet have runners in this checkout.

Contributing

Contributions to Sentry are welcome, including bug fixes, integration examples, and documentation improvements.

Bug reports and feature requests can be submitted through GitHub Issues. Code and documentation changes can be submitted as pull requests.

Citation

If you use Sentry in your research, please cite:

@article{ji2026sentry,
  title={Sentry: Learning to Recover from LLM Agent Failures at Test Time},
  author={Ji, Changxiu and Lu, Amy and Zhang, Qizheng and Olukotun, Kunle},
  journal={arXiv preprint arXiv:2610.02994},
  year={2026}
}

License

Sentry is released under the MIT License.

Sentry (nuglifeleoji/Sentry)

arxiv
Searching Database…

What is this?Sentry is an external runtime failure management layer for LLM agents. It detects execution failures, guides recovery, and learns reusable lessons from verified recoveries while running alongside the agent loop.
Is this a standalone agent or a layer I plug into my own agent?It is a layer you integrate into an existing agent loop. Sentry does not replace the agent, environment, or evaluator, it just monitors and intervenes on failures.
How do I integrate Sentry into my agent?Configure a model provider, then submit each completed agent-environment cycle to Sentry so it can monitor for failures. Your application still generates, validates, and executes the actions.
What Python version do I need?Sentry requires Python 3.10 or later.
Is the full code already available?Not yet. The repository currently only has the project overview and paper; the authors say the full code and documentation are still being finalized.
Who would use Sentry?Developers building or evaluating LLM agents on tasks like web navigation, app automation, or software engineering benchmarks, who want a drop-in failure-recovery layer rather than writing one from scratch.
What benchmarks has Sentry been tested on?It was evaluated on WebShop, AppWorld, SWE-bench Lite, and Mind2Web Replay, showing a 37% average improvement over the strongest runtime-intervention baseline.
How much overhead does Sentry add to agent runs?Sentry uses about 1.54x the base agent's token usage, compared to up to 2.44x for other runtime methods, while also saving 31.7s per task on SWE-bench Lite and 45.6s on AppWorld.
How good is Sentry at actually fixing failures?It achieves an 81.7% recovery rate across 939 detected failures in the reported experiments.
How does Sentry decide how to help a stuck agent?It runs five steps: detecting failures, asking for a hard retry on invalid actions, giving soft guidance from playbook lessons for reasoning failures, verifying the recovery worked, and saving verified fixes as reusable lessons for future tasks.
Size
16.2 MB
Stars
1.6K
Updated
CommitOct 11
Age
2mo
Commits · 90 Days