Quickstart
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.
Create new account in Keywords AI
- Go to Keywords AI and create a new account.
- Get your API key from the API Keys page in Settings.
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:
A full example with LLM calls
In this example, you will see how to implement a workflow that includes LLM calls. We use OpenAI SDK as an example.
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:
A full example with LLM calls
In this example, you will see how to implement a workflow that includes LLM calls. We use OpenAI SDK as an example.
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:
Create a simple task
Create a workflow combining tasks
In this example, we create a workflow pirate_joke_workflow
that combines the createJoke
task with a translateJoke
task.
The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows.
Install the SDK
Install the package using your preferred package manager:
Set up Keywords AI trace processor
Get your API key from the API Keys page in Settings, then configure it in your environment.
Call the agent
Now you can call the agent and it will be traced by Keywords AI automatically.
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 Traces.
Example adapted from Traceloop
Decorating Classes (Python only)
While the examples above shows how to decorate functions, you can also decorate classes. In this case, you will also need to provide the name of the method that runs the workflow and task.