Quickstart

Install the Trodo SDK, wrap your agent, and see your first run in Traces. Or let a coding agent wire it up for you.

You need two things in your code: init once at startup, and a wrap around each agent entry point. Model calls made inside the wrap are captured on their own.

1. Get your site ID

The site ID is the only credential the SDK needs. Copy it from Settings → General in the Trodo app and set it as TRODO_SITE_ID in your environment.

Settings → General with the Site ID and its copy button.

2. Instrument your agent

Paste this into Claude Code, Cursor or another coding agent, with your site ID filled in. The app shows the same prompt, already filled in, the first time you sign in.

Install the Trodo agent-tracing skill from github.com/trodoai/skills
(npx skills add trodoai/skills), then follow it to add tracing to every agent
in this project. My Trodo site ID is <your-site-id>. Map all agent entry points
and show me the run plan before writing code.

The skill finds your stack and your agent entry points, shows you a plan, and writes code only after you approve it.

Install the SDK and the instrumentor for your model provider (which package?):

npm install trodo-node@^3 @opentelemetry/instrumentation-openai

Call init once, before anything imports your model client, then wrap the agent:

import trodo from 'trodo-node';

trodo.init({ siteId: process.env.TRODO_SITE_ID! });

const { result } = await trodo.wrapAgent(
  'support-agent',
  async (run) => {
    run.setInput(question);
    const answer = await agent.run(question); // model calls inside are captured
    run.setOutput(answer);
    return answer;
  },
  { distinctId: user.id, conversationId: thread.id },
);

Install the SDK and the instrumentor for your model provider (which package?):

pip install "trodo-python>=3" opentelemetry-instrumentation-openai

Call init once, before anything imports your model client, then wrap the agent:

import os, trodo

trodo.init(site_id=os.environ["TRODO_SITE_ID"])

with trodo.wrap_agent("support-agent", distinct_id=user.id, conversation_id=thread.id) as run:
    run.set_input(question)
    answer = agent.run(question)  # model calls inside are captured
    run.set_output(answer)

Three things make the run useful, and the code above sets all of them:

  • Input and output: the question and the final answer. Evals and Lucid read them.
  • distinctId: who the run was for. Without it, users show up as anonymous ids. See Users.
  • conversationId: which chat or thread the turn belongs to, so turns group together. See Conversations.

3. See the run

Run your agent once, then open Traces → Runs. Each row is one run, with its duration, tokens, cost, user and conversation. Click it to see the span tree.

Traces → Runs: one row per run with its duration, user, tokens, cost, errors, agent, span count and conversation.

Nothing there after a minute? Turn on debug: true (Python: debug=True) in init and run again; the SDK logs every send and every skipped instrumentor. The usual causes:

SymptomCause
No run at allinit never ran, or a script exited before sending. Call await trodo.flush() (Python: trodo.flush()) before a script or serverless handler returns. See Delivery & runtimes.
A run, but no model calls under itThe model client was created before init, or its instrumentor isn't installed. Move init into the first module your app imports.
Model calls show up twiceTwo instrumentors capture the same call, e.g. LangChain and OpenAI. Turn one off with disableInstrumentations: ['openai'].

Next

  • Concepts: runs, spans, conversations and users, and the IDs that tie them together
  • Wrap your agent: every option on the wrap, and what the run handle can set
  • Your first eval: score every run you just started sending

On this page