Skip to main content

Augur SDK — instrument any screenshot-grounded computer-use agent (CUA). Sentry-style DSN streaming + local bundle writer.

Project description

augur-sdk

PyPI Python License: Apache 2.0 Docs

Full docs: https://mercurialsolo.github.io/augur-sdk/

Instrument any screenshot-grounded computer-use agent (CUA) with one context manager. Streams traces to Augur (a hosted cloud service for CUA observability) over a Sentry-style DSN AND writes a path-stable bundle to disk — both work, both at once, no extra glue.

This is the public client SDK. The Augur server, viewer, and CLI are a managed cloud service — sign up at augur (URL TBD) to get a DSN. The SDK also works standalone in local-bundle mode with no account.

from augur_sdk import CaptureMode, DebugSession

with DebugSession(
    run_id="run_abc",
    client_name="myagent",
    capture_mode=CaptureMode.SCREENSHOTS,
    out_dir="/var/log/augur/run_abc",
) as session:
    pre  = session.attach_observation(step_index=0, kind="pre",  png_bytes=...)
    post = session.attach_observation(step_index=0, kind="post", png_bytes=...)
    session.record_step({
        "step_id":          "run_abc/step/0000",
        "step_index":       0,
        "step_type":        "click",
        "intent":           "Click the login button",
        "status":           "succeeded",
        "started_at":       "2026-05-19T00:00:00Z",
        "observation_pre":  pre,
        "observation_post": post,
        "action":   {"type": "click", "params": {"x": 100, "y": 200},
                     "coordinate_space": "viewport_css_px",
                     "dispatch_backend": "playwright"},
        "grounding": {"provider": "myagent", "provenance": "screenshot"},
        "verdict":   {"status": "passed"},
    })

Set AUGUR_DSN=… and the same code streams to your Augur server. No code change required to switch between local-only and hosted modes.

Install

From PyPI (when published)

pip install augur-sdk
# or
uv pip install augur-sdk

From source (today)

git clone https://github.com/mercurialsolo/augur-sdk.git
cd augur-sdk
pip install -e .
# or
uv pip install -e .

Requirements

  • Python ≥ 3.11
  • jsonschema, referencing, urllib3 (installed automatically)

The SDK is self-contained: JSON Schemas are vendored inside the package (augur_sdk._schema), so import augur_sdk requires no other Augur components. The Augur server, viewer, and CLI are operated as a hosted service — you only need this package on the client side (your CUA runtime).

Quickstart — three modes

1. Local-only (no server)

The default. Bundles are written under out_dir/. Use augur view <dir> from the main Augur repo to render them in the viewer, or hand the path to a coding agent.

from augur_sdk import CaptureMode, DebugSession

with DebugSession(
    run_id="run_abc",
    client_name="myagent",
    out_dir="/var/log/augur/run_abc",
    capture_mode=CaptureMode.SCREENSHOTS,
) as session:
    ...

2. Stream to an Augur server (Sentry-style)

Set one env var; nothing else changes.

export AUGUR_DSN='https://augur.example/api/v1?token=<api_key>&tenant=<tenant_slug>'

The SDK heart-beats every 15 s while a session is open so the server's connection-status indicator stays green. Each step + screenshot + event streams over HTTPS with Authorization: Bearer <api_key>. The local bundle is still written; streaming is observe-only on top.

Or pass the DSN directly:

DebugSession(dsn="https://augur.example/api/v1?token=...&tenant=...", ...)

Get a DSN by asking an Augur admin to run:

augur admin dsn-issue --tenant <your-tenant> --label <client-name>

3. Adapter pattern (existing CUA exports)

Already have a trace exporter (Mantis-style)? Write a small adapter that maps your shape to Augur records. See the adapter authoring guide.

What gets written

Every bundle is path-stable — no discovery needed:

out_dir/
  manifest.json           # envelope: schema_version, bundle_format, paths, signatures
  trace.json              # session + ordered steps[]
  AGENT.md                # coding-agent-friendly index (first-read hints, layout)
  steps/0000.json         # one StepTrace per file
  events/0000.jsonl       # decision events per step (planner / grounding / verifier / recovery)
  screenshots/0000_pre.png
  screenshots/0000_post.png
  diagnostics/findings.json   # if `augur diagnose` has been run
  schema/*.schema.json    # canonical record schemas (vendored for offline validation)

The same bundle drives the viewer, the CLI, and any coding agent. See docs/concepts/bundle-layout.md for the full normative spec.

Capture modes

The capture_mode arg controls how much the SDK writes:

Mode What it captures Cost
off Manifest envelope only none
metadata + run/step ids, status, action type, failure class tiny
trace + decisions, verifier output, recovery, grounding summary low
screenshots + pre/post PNGs + coordinate overlays med
video + video / MJPEG references med
model_io + prompts, model responses, redacted secrets med
dispatch + input dispatch details, retries, post-action state checks low
replay + observation/task/context state for replay fixtures med
full All above, subject to redaction + retention high

Set via capture_mode=CaptureMode.FULL or AUGUR_CAPTURE_MODE=full.

Redaction

default-pii-v1 ships in the box and is applied to every bundle:

  • Drops Authorization, Cookie, Set-Cookie, X-API-Key headers entirely.
  • Masks token, api_key, ssn, credit_card, cvv keys.
  • Regex-scrubs bearer tokens, AWS keys, JWTs, password=… patterns out of strings.
  • Honors sensitive=True on a step: pre/post screenshots are dropped.

Subclass augur_sdk.RedactionPolicy for tighter rules:

from augur_sdk import DebugSession, RedactionPolicy

class StrictPolicy(RedactionPolicy):
    id = "strict-v1"
    drop_keys = RedactionPolicy.drop_keys | frozenset({"customer_email"})

DebugSession(redaction_policy=StrictPolicy(), ...)

Diagnostics

Augur ships a generic CUA rules pack you can run against any bundle:

from augur_sdk.diagnostics import RulesEngine, load_pack

engine = RulesEngine(load_pack("cua"))
findings = engine.evaluate("/path/to/bundle")
for f in findings:
    print(f["severity"], f["rule_id"], f["summary"])

Adapter-specific packs (e.g. mantis) are registered via the augur.rule_packs entry-point group; install the corresponding adapter package alongside this SDK and they appear automatically in load_pack(...).

CUA contract — what the SDK enforces

Per Augur's design invariant: runtime action selection MUST remain screenshot-grounded. The SDK doesn't enforce this at write time, but the diagnostic-rules engine and the viewer both flag DOM-derived coordinates that show up in grounding.provenance != "screenshot" and get used as runtime inputs. Tag DOM probes as provenance: dom so they stay visible as diagnostic evidence without being mistaken for the agent's real target.

Develop

git clone https://github.com/mercurialsolo/augur-sdk.git
cd augur-sdk
uv sync                 # creates .venv and installs dev deps
uv run pytest           # tests
uv run ruff check .     # lint
uv run mypy -p augur_sdk  # types

Publish to PyPI

Releases are tag-driven and run through .github/workflows/release.yml, which authenticates to PyPI via OIDC Trusted Publishing — no API token is stored anywhere.

One-time setup

  1. Register the project on PyPI as a pending publisher: https://pypi.org/manage/account/publishing/

    • PyPI project name: augur-sdk
    • Owner: mercurialsolo
    • Repository: augur-sdk
    • Workflow name: release.yml
    • Environment name: pypi
  2. (Optional) Pre-create the pypi GitHub Environment if you want to gate releases behind required reviewers:

    gh api -X PUT /repos/mercurialsolo/augur-sdk/environments/pypi
    

Cut a release

  1. Bump __version__ in src/augur_sdk/_version.py and version in pyproject.toml.

  2. Move the [Unreleased] block in CHANGELOG.md under the new version.

  3. Commit, tag, push:

    git commit -am "Release v0.1.0"
    git tag v0.1.0 -m "Initial release"
    git push origin main v0.1.0
    

The tag push triggers release.yml: lint → typecheck → test → uv build → publish to PyPI via OIDC. The wheel + sdist are also uploaded as workflow artefacts.

Local build / manual upload (escape hatch)

If you need to publish outside CI (don't, normally):

uv build              # produces dist/*.whl + dist/*.tar.gz
uv publish            # uses ~/.pypirc or UV_PUBLISH_TOKEN

Where Augur lives

Augur (server, viewer, CLI, diagnostic rule packs, Mantis adapter) is a hosted cloud service — not open source. This SDK is the only component your CUA runtime needs; everything else is operated for you.

License

Apache 2.0 — see LICENSE.

Project details


Download files

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

Source Distribution

augur_sdk-0.2.1.tar.gz (93.3 kB view details)

Uploaded Source

Built Distribution

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

augur_sdk-0.2.1-py3-none-any.whl (67.0 kB view details)

Uploaded Python 3

File details

Details for the file augur_sdk-0.2.1.tar.gz.

File metadata

  • Download URL: augur_sdk-0.2.1.tar.gz
  • Upload date:
  • Size: 93.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for augur_sdk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 0e9ab3438b3c114f44a52d0da3af9cc4ea4679d694650e469ac6cf16f85ca99b
MD5 59dd9d3e10dbb3cc3b2622d337edaf24
BLAKE2b-256 6a3ef5a04612b80b9624e05756017537ca92d65beb216a86ad52721a3eedfc13

See more details on using hashes here.

Provenance

The following attestation bundles were made for augur_sdk-0.2.1.tar.gz:

Publisher: release.yml on mercurialsolo/augur-sdk

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

File details

Details for the file augur_sdk-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: augur_sdk-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 67.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for augur_sdk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 69f26079d6840b390e29ed0b2af8a1bf998646074616a819210ab178baf2a735
MD5 195bfc5e21bc2f75dd44719b30f29e21
BLAKE2b-256 c8b9b02d8f19b6b728c0c262b001799d1f72243246f45192511ae4c6b2702ee0

See more details on using hashes here.

Provenance

The following attestation bundles were made for augur_sdk-0.2.1-py3-none-any.whl:

Publisher: release.yml on mercurialsolo/augur-sdk

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page