Skip to main content

Telemetry and Observability SDK for AI Agents — with Trace Tree MRI

Project description

agenteval_sdk

Python SDK for the AgentEval observability platform. Instrument your AI agents in minutes and get Trace Tree MRI — a full visual breakdown of every agent decision, latency, PII exposure, and cost.

Install

pip install agenteval_sdk

Quick start

import os
from agenteval_sdk import AgentEvalClient, trace

client = AgentEvalClient(
    api_key=os.environ["AGENTEVAL_API_KEY"],
    project_id="aml-system",
)

# Decorate each agent function — span hierarchy is wired automatically
@trace(name="Orchestrator", latency_threshold=5000)
def run_case(case_id: str) -> str:
    result = kyc_agent(case_id)
    return result

@trace(name="KYC_Agent", latency_threshold=3000)
def kyc_agent(case_id: str) -> str:
    output = "KYC: PASS"
    client.log_trace(
        agent_name="KYC_Agent",
        input_text=f"Check case {case_id}",
        output_text=output,
        latency_ms=340,
        tokens_used=180,
        status="pass",
        pii_scan=True,          # lightweight regex pre-flight before Presidio
    )
    return output

run_case("TXN-9921")

This produces a Trace Tree visible in the AgentEval dashboard — parent/child spans, Gantt swimlane, PII audit trail, and cost estimate — with zero manual wiring.

@trace decorator

@trace                                           # bare
@trace(name="MyAgent")                          # custom display name
@trace(name="MyAgent", latency_threshold=2000)  # red UI alert if > 2 s

latency_threshold (ms) controls when the node appears red in the Trace Tree UI.
Nested agents inherit the parent's threshold unless they define their own.

AgentEvalClient.log_trace()

Parameter Type Description
agent_name str Display name in the UI
input_text str Agent input / prompt
output_text str Agent response
latency_ms int Wall-clock time for this span
tokens_used int Token count (for cost estimate)
status str "pass" / "fail" / "NEW"
trace_id str Auto-generated if omitted
session_id str Group related traces (e.g. one customer case)
pii_scan bool Client-side regex PII scan before sending
pii_types list[str] Explicit PII types (overrides pii_scan)
span_id str Auto-populated from @trace ContextVar
parent_span_id str Auto-populated from @trace ContextVar
latency_threshold int Per-span override (ms)

Standalone log_trace()

For lighter usage without AgentEvalClient:

from agenteval_sdk import log_trace

log_trace(
    trace_id="abc-123",
    input_text="Hello",
    output_text="World",
    latency_ms=200,
    tokens_used=50,
    status="pass",
    api_key=os.environ["AGENTEVAL_API_KEY"],
    pii_scan=True,
)

Environment variables

Variable Default Description
AGENTEVAL_API_URL https://sandbox.agenteval.in/trace Ingestion endpoint
AGENTEVAL_API_KEY API key (or pass directly)

Offline / local-first

AgentEvalClient writes every trace to a local SQLite database before attempting the network POST. No traces are lost on network failure. Call client.flush() to retry unsynced traces.

What you get in the dashboard

  • Trace Tree MRI — interactive D3 tree of agent spans, coloured red for slow nodes
  • Gantt swimlane — execution timeline per span
  • PII Audit Trail — which agents saw PII, what types, redacted by Presidio
  • Cost estimate — token usage → USD at GPT-4o-mini rates
  • Kill switch — freeze all agent traffic instantly from the operator panel

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

agenteval_sdk-0.3.7.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

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

agenteval_sdk-0.3.7-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file agenteval_sdk-0.3.7.tar.gz.

File metadata

  • Download URL: agenteval_sdk-0.3.7.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for agenteval_sdk-0.3.7.tar.gz
Algorithm Hash digest
SHA256 722bec578522cbadd871a757f4722673f9fd9bd8682838b3ab15bbcfb5da3d99
MD5 30e13e120de59c213f330a3c7c64493d
BLAKE2b-256 0361f501b7eaaac17c06ce19f441349aa4396aff333dbbc47d3b5ce9d64b469a

See more details on using hashes here.

File details

Details for the file agenteval_sdk-0.3.7-py3-none-any.whl.

File metadata

  • Download URL: agenteval_sdk-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for agenteval_sdk-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 94e9f3f5ffba9bb5a09cf3354e99eabd882709e37c569eee718b9a90958209dd
MD5 bf9256c53c3fa5a31c507603181d5a7d
BLAKE2b-256 0047fb4aa0b125da5a10b4d81ae0c7d7f2534fac11d8f8d59610884281828667

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