Set up Traces
Monitor complex LLM workflows including chains, agents with tools, and advanced prompts in your AI products using Traces.
Traces is currently in beta. Please share any feedback or suggestions.
Set up Traces
Install the SDK
Install the package using your preferred package manager:
Set up Environment Variables
Get your API key from the API Keys page in Settings, then configure it in your environment:
Annotate your workflows
Use the @workflow
and @task
decorators to instrument your code:
Understanding Workflows and Tasks
A workflow is a sequence of tasks that you want to monitor. Each task represents a single unit of work within that workflow.
Example
Below is an example that demonstrates how to use tasks and workflows. We’ll create a workflow that:
- Generates a joke
- Translates it to pirate speak
- Adds a signature
Each operation is implemented as a separate task that can be used independently or as part of the workflow.
Chain these tasks together in a workflow:
You can then see the trace in the Traces.
Example adapted from Traceloop