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.0.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.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spolm_tracer-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 398729c0b01417273d05a298b07e874736287d6a4af8eac6b97b9f210e959a3f
MD5 c1b0fe575c5d0df6cbe3a55524763dac
BLAKE2b-256 952e3d3f4a7675ce3429822d75ba6fa11773a5a1cec977bb8a6d9ce60216c679

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spolm_tracer-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a8c136f648474793cc749a1c1075a38180c70a727f2087b71ba13006f64e478
MD5 870923e26c758da8a0718fc9584c6cd9
BLAKE2b-256 3edf6df3050c5761517d1c9e7f37d7c5587d1e81214d553baebd7091d2ee47f8

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