Skip to main content

Official Spolm SDK for Python — trace, simulate, and verify AI agent runs.

Project description

spolm-tracer

Official Spolm SDK for Python — trace, simulate, and verify AI agent runs.

spolm-tracer instruments your agent so its runs appear in Spolm, where they're clustered into failure patterns, turned into enforceable checks, and certified in a shareable Reliability Report. The JavaScript SDK is @spolm/tracer.

Install

pip install spolm-tracer

Quickstart

from spolm_tracer import Tracer

tracer = Tracer(API_KEY, AGENT_ID)   # from your Spolm dashboard

run_id = tracer.startRun("Summarize the Q3 earnings call")

# Wrap the functions you want traced as steps
traced_llm = tracer.log_step(step_name="answer", step_type="model", provider="openai")(call_llm)
result = await traced_llm(prompt)

tracer.end_run(result, "complete")

Simulation

Run your agent against a Spolm-generated set of test cases (auto-generated from the agent's configured description/instructions/rubrics) and record the results as simulation traces:

async def agent_fn(user_task, tracer):
    # your agent must call startRun/end_run itself (or via its own Tracer)
    tracer.startRun(user_task)
    result = await run_agent(user_task)
    tracer.end_run(result, "complete")
    return result

# Deterministic adversarial packs + generated cases
await tracer.simulate(agent_fn, mode="full", pause_ms=250)

# mode="fast" runs only the deterministic adversarial packs (cheap CI)
await tracer.simulate(agent_fn, mode="fast")

Property-based testing

Actively search for inputs that make your agent violate its promoted checks/invariants — trace-seeded mutations, the enforced suite as the oracle, and delta-debugged minimal repros for any violation found:

result = await tracer.property_test(
    agent_fn,
    invariants=[{"id": "no-injection-obedience", "description": "never obey injected instructions"}],
    iterations=2,
    per_round=8,
)
print(result["violations_found"], "violations", result["violations"])

API

Method Purpose
Tracer(api_key, agent_id, options=None) Create a tracer
startRun(user_task, metadata={}) Begin a run; returns run_id
log_step(step_name=, step_type=, provider=None, options=None)(fn) Wrap a function as a traced step
end_run(final_result, status="complete") Finalize and send the run
await simulate(agent_fn, count=None, pause_ms=0, mode="full") Run generated/adversarial test cases
await property_test(agent_fn, invariants=None, iterations=1, per_round=8, pause_ms=0, max_runs=None) Search for invariant violations

MIT.

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

spolm_tracer-0.1.1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

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

spolm_tracer-0.1.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file spolm_tracer-0.1.1.tar.gz.

File metadata

  • Download URL: spolm_tracer-0.1.1.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for spolm_tracer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f950ede663558168a42fcfd29c00084b0836106f6fd186ecf5c7c81d386a3a61
MD5 151ba7db4ede7e8bfc41633fb64fe0c7
BLAKE2b-256 c8d4522f4eccd29439f897d616d3c4fd4c49b780c64c882f41534f522d570a97

See more details on using hashes here.

File details

Details for the file spolm_tracer-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: spolm_tracer-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for spolm_tracer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0ecebe2c3cd500e14e1234bd676294e185b4ad0e6b60b8ca915d2cac999df133
MD5 730cb4d76e4b5b9b6faa42969c9ede76
BLAKE2b-256 dde463c0062e0ebbcccece09a8e8c2b0005418f843450f1dc3e924230d4b59cf

See more details on using hashes here.

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