Skip to main content

Trace

Therix provides a tracing feature. Tracing acts like a detective tool for your Language Model (LM), helping understand what's happening, identifying the root cause of problems, and tracking the cost borne by different models based on tokens used. Additionally, it shows you a statistical representation of your Language Model (LM) usage.

Why Trace

Tracing helps you find problems like:

  • Unexpected Results: When things don't turn out as expected.
  • Agent Loops: When your agents keep doing the same thing over and over.
  • Slow Chains: When things are moving slower than they should.
  • Token Usage: Keep track of how many tokens are used at each step.

Getting Started

To add tracing to your Language Model (LM), redirect to therix-cloud and create a project of your choice.

After redirecting, you'll see a screen similar to this. trace_dashboard

Go to API keys section and create API Keys to add it to your agent trace_settings_dashboard

Integrating Tracing into Your Code while using the SDK

Make sure you have the API Keys avaialable to you from the dashboard. Here is an example of sample API Keys

trace_config = {
"secret_key": [TRACE_SECRET_KEY],
"public_key": [TRACE_PUBLIC_KEY],
"identifier": [PIPELINE_NAME],
}

Now pass the trace_config to your .add method in your code. Here is a basic example to demonstrate it.

.add(Trace(config = trace_config))

Example

agent = Agent(name="Summarizer Agent")
(agent
.add(Trace(config = trace_config))
.add(// Any other configuration you want to add)
.save())


answer = agent.invoke(text)

Integrating Tracing into Your Code while using Therix-Cloud

It's very simple to add traces while using Therix-cloud, just add the created API Key in your .env and it's done

Example

# Inside your environment, create a variable like this
THERIX_API_KEY='your-api-key'