Installation
Quick Start
@observe Decorator
The@observe decorator is the primary way to instrument your AI calls. It automatically captures inputs, outputs, latency, and exceptions.
Parameters
With All Options
Manual Logging
Useclient.observe.log() when you need full control over what gets recorded.
Parameters
Sessions
Group related traces into a session using theagent_session() context manager. This is useful for multi-step agent workflows.
Spans
Break a single trace into sub-steps with thespan() context manager.
Span Methods
Scoring
Score traces for evaluation, either manually or with an AI judge.Prompt Management
Manage versioned prompts and build them with template variables.Analytics
Access trace analytics and cost data programmatically.Testing
Create test suites, add cases, and run evaluations against your AI functions.Versions
Publish, track, and roll back versioned deployments of your AI pipelines.Error Handling
All SDK errors raiseTrainlyError with structured context.