AgentX
The top-level client. Create one per process.
Constructor
Class methods
Attributes
Tracer
Accessed via client.tracer. Handles both tracing and CI/CD evaluation.
trace()
_TraceSpan that works as a decorator or context manager.
flush()
use_span()
span (created on another thread) the active span for the duration of the block, on the calling thread.
The active-span stack is thread-local, so a span opened with tracer.trace(...) on the main thread isn’t automatically visible inside a ThreadPoolExecutor worker (or any other thread). Wrap the worker’s body in use_span() to attach its LLM and tool calls to the parent span instead of starting an independent trace.
run_eval()
agent_fn for every test case, submits results, finalizes, and returns the gate decision.
Raises CIGateFailure (containing the CIRunResult) when fail_on_gate=True and the gate is "fail".
create_ci_run()
submit_result()
finalize_ci_run()
get_ci_run()
evaluate_trace()
{ run_id, trace_id, rating, justification, status }. trace_id comes from a prior tracer.trace(..., sync=True) call’s span.trace_id.
_TraceSpan
Returned by tracer.trace(). Can be used as a decorator or context manager.
Attributes
Methods
add_tool_call()
set_error()
__exit__.
Usage patterns
CI/CD Dataclasses
CIRun
Returned by create_ci_run().
CITestCase
CIQuestionScore
Returned by submit_result().
CIRunResult
Returned by finalize_ci_run() and run_eval().
CIRunStatus
Returned by get_ci_run().
ThresholdViolation
Exceptions
All exceptions inherit fromAgentXError.

