Skip to main content

Agent Supra

Notice when an unattended AI agent is stuck, pause it before more money goes into a loop, and show exactly why.

A spend cap can't tell a stuck agent from one working hard on a tough bug. Agent Supra watches progress: if an agent keeps changing code while its failing tests don't get any fewer, the run is flagged (or paused, once you opt in) with the evidence.

  • SDK (pip install agent-supra): no dependencies. Wraps Gemini, OpenAI and Anthropic clients.
  • Hosted service: dashboard, API keys, alerts to Slack and email, Postgres-backed. One Docker image.

Try it in two minutes (no accounts, no API keys)

pip install -e ".[dev]"
agent-supra demo            # or: python -m agent_supra.demo

Two scripted agents fix a real bug in a tiny repo, running real pytest. One edits the code four times while the same tests fail and gets paused. The other fails twice, changes approach, passes, and is left alone. A timeline report is written to supervisor_report.html.

Run the service locally

On Windows, see the local PowerShell guide. The helper python scripts/local.py serve loads the repository's .env file; the bare agent-supra serve command reads exported environment variables.

cp .env.example .env
agent-supra serve           # SQLite by default; http://localhost:8000

Or with Postgres, the way production runs:

docker compose up --build

Sign up, create an API key, then follow the quickstart at /docs/quickstart.

Connect an agent

To exercise our own business agent first, see the invoice-reconciliation agent. It uses Gemini, calculator and ledger-edit tools, with healthy, stuck, and observation scenarios against an isolated Supra HTTP service.

The reliability benchmark expands this to 24 known-outcome controls and six optional real-Gemini tasks, with separate failure and timing reports.

For Claude Code, try the experimental hook integration. It tracks tool/test activity and can deny the next tool call when paused. It requires Agent Supra 1.1.1 or newer; model spend is not measured by hooks.

For any existing command, try CLI watch: agent-supra watch --junit ".local/results.xml" -- python my_agent.py. Observation is the default; opt-in enforcement cancels the owned process tree on pause. The agent must generate the selected JUnit report for progress detection.

For Chat Completions clients, the local provider proxy adds token/call accounting and estimated-spend checks by changing the client base URL. It supports text and streaming, stays on loopback, and requires Agent Supra 1.1.0 or newer with the proxy extra. Monetary limits are estimated thresholds; one in-flight request can overshoot them.

The following shows where supervision fits into your own agent loop; provide your own prompt, apply_fix, run_tests, and git_rev functions. For a copy-paste first-run check, use the hosted quickstart.

from google import genai
from agent_supra import Client, SupervisedRun, SupervisorPaused

sup = Client()   # AGENT_SUPRA_API_KEY and AGENT_SUPRA_URL from the environment
task = sup.create_task("Fix failing checkout tests", budget_usd=3)

with SupervisedRun(sup, task) as run:
    gemini = run.wrap_gemini(genai.Client())
    try:
        while True:
            run.check()                                   # raises SupervisorPaused when paused
            reply = gemini.models.generate_content(model="gemini-3.5-flash-lite", contents=prompt)
            run.tool("edit_file", apply_fix, reply.text, rev=git_rev())
            result = run.tool("run_tests", run_tests, rev=git_rev())
            run.report_tests(result.all_ids, result.failing_ids, rev=git_rev())
            if not result.failing_ids:
                run.finish("success")
                break
    except SupervisorPaused as paused:
        print("Paused:", paused.reason)                   # don't retry; review it in the dashboard
Call What it does
Client(fail_mode="open") Hosted backend. If the service is down, "open" keeps the agent running and buffers events; "closed" treats it as paused
run.wrap_gemini(client) google.genai.Client(): models.generate_content, generate_content_stream, chats, aio. Also the older GenerativeModel
run.wrap_openai(client) chat.completions.create and responses.create. Streaming needs stream_options={"include_usage": True}
run.wrap_anthropic(client) messages.create, including streams
run.record_model_call(model, in, out) Any other model
run.check() Refuses the next step if the run is paused or stopped
run.tool(name, fn, ..., rev=) Runs a tool and records success or failure (fingerprints only, not the raw arguments or errors)
run.report_tests(suite, failing, rev=) The main progress signal
run.child() A sub-agent run sharing the task's budget
run.finish("success" / "failed" / "unknown") Final outcome

Wrapped clients check with the supervisor before each model call, so a paused run never reaches the provider.

A complete, runnable Gemini agent is in examples/gemini_agent.py. See docs/testing-with-gemini.md.

Detection rules

Rule Fires when Default
No progress 4 attempts in a row without the number of failing tests reaching a new low, while the code changes. Swapping one failure for another doesn't count as progress Pause, once observation mode is off
Exact repeat The same failure with no code change, or a tool failing with the same arguments and error Pause, once observation mode is off
Going in circles Flipping between two versions of the code with the same failures Flag
Context running away Input tokens rising call after call (2x over 5 calls) with no progress, or over a ceiling you set Flag
Budget Estimated task spend reaches the budget, across all runs and sub-agents Always enforced
Call cap The next model call would exceed the task's cap Always enforced

Safeguards: deleting a failing test isn't progress; network and rate-limit errors never count; if events go missing, the run is only flagged, never paused. New workspaces start in observation mode (flag only) so people can check the rules on their own agents before anything gets paused.

Configuration

All server settings are environment variables. See .env.example.

Variable Default Purpose
DATABASE_URL sqlite:///supervisor.db Postgres in production (postgres:// URLs work)
BASE_URL http://localhost:8000 Public URL; https:// turns on secure cookies and HSTS
APP_NAME Agent Supra Product name shown everywhere
ALLOW_SIGNUP true false for invite-only (agent-supra create-user)
RETENTION_DAYS 30 Run and server-error data older than this is deleted every 6 hours or by the daily cron
SMTP_* unset Email alerts
AGENT_SUPRA_PRICES unset Extra model prices, {"model": [input, output]} USD per 1M tokens

Deploying

See docs/deploying.md. The hosted beta runs on Vercel with Neon Postgres at agentsupra.in.

Security

  • Passwords: scrypt. API key and session secrets are stored as SHA-256 hashes; API keys are shown once.
  • Every API request is scoped to the key's workspace; another workspace's runs return 404.
  • Dashboard forms are CSRF-protected; cookies are HttpOnly and SameSite.
  • Rate limits on events and on login/sign-up; request size limits; strict security headers.
  • Slack webhooks must point at hooks.slack.com, so the setting can't be used to reach internal URLs.
  • Prompts, model replies and code are never sent; tool arguments and errors are sent only as keyed fingerprints. Set AGENT_SUPRA_FP_KEY in your agents to make them unguessable.

Development

pip install -e ".[dev]"
python -m pytest                                  # SQLite test suite
TEST_DATABASE_URL=postgresql+psycopg://user:pass@localhost/test python -m pytest   # on Postgres

CI (.github/workflows/tests.yml) runs both.

Limits worth knowing

  • Costs are estimates from token counts and the price table (Gemini prices built in, checked 13 Oct 2026). Not your invoice.
  • Pausing is cooperative: in-flight calls and tools finish. Agents that call the provider directly, bypassing the wrapper, are not stopped.
  • Budgets are checked, not reserved: several sub-agents running in parallel can each make one more call after the budget is crossed.
  • Rate limits are per server process.
  • Thresholds are starting points. Tune them in observation mode on real runs.

MIT licensed.

Metadata

Release files for agent-supra 1.2.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 agent-supra 1.2.0
File Size Uploaded Provenance Actions
agent_supra-1.2.0.tar.gz 2.3 MB With provenance Details for agent_supra-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agent-supra 1.2.0
File Interpreter ABI Platform Actions
agent_supra-1.2.0-py3-none-any.whl Python 3 none any Details for agent_supra-1.2.0-py3-none-any.whl

Total release size: 4.4 MB

Release files / agent_supra-1.2.0.tar.gz

Download URL agent_supra-1.2.0.tar.gz
Size 2.3 MB
Tags Source
SHA-256 checksum
How to use checksums
49cd63aaa8be1155c654cbf8c70103a52c6f67912ea3f74bf2952fa9c8e41406
BLAKE2b-256 checksum
How to use checksums
6df1b8c6d37929a98526c1a1e36c418819da84e6e8226f7b473e76d9a1de1020
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 2, 2026.

Transparency log

Release files / agent_supra-1.2.0-py3-none-any.whl

Download URL agent_supra-1.2.0-py3-none-any.whl
Size 2.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
0e7eb3b94399519f96315938f2102d1f15ffe91825c0166cacd5a0954090cdbc
BLAKE2b-256 checksum
How to use checksums
519aa154fff08bd1402fbbcaddb3f10892af8789c7f3b7feebefee38d303e812
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 2, 2026.

Transparency log

Security for agent-supra 1.2.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 agent_supra-1.2.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 Nov 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.

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