Skip to main content

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

Release files for agenteval-sdk 0.3.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agenteval-sdk 0.3.8
File Size Uploaded
agenteval_sdk-0.3.8.tar.gz 21.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agenteval-sdk 0.3.8
File Interpreter ABI Platform
agenteval_sdk-0.3.8-py3-none-any.whl Python 3 none any Details

Total release size: 45.5 kB

Release files / agenteval_sdk-0.3.8.tar.gz

Download URL agenteval_sdk-0.3.8.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d00a6700fbdb9feda1dc79f807e81bdb3d671642e8066e9f080003c3f69853f7
BLAKE2b-256 checksum
How to use checksums
32bd8c1093ce1c10a991411fb54d406b01fd1d76b575167a0dd740325c79678d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / agenteval_sdk-0.3.8-py3-none-any.whl

Download URL agenteval_sdk-0.3.8-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f52967de960ca6548e199c68428b07773a524b7c36ee5187abeaf12fefc839a4
BLAKE2b-256 checksum
How to use checksums
74b142b10a56bbfb71e379fe882c3693180ad11157b554b080bd6c74b5f78398
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.3.8 This release

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

1 release file

0.1.0

2 release files

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