Tracing
Troubleshooting
The mistakes that make a trace wrong or missing, how to spot each one, and the fix.
Turn on debug: true in init first (Python: debug=True). The SDK then logs every send, every error, and every instrumentor it couldn't load.
Common mistakes
Each of these produces a trace that looks fine but is wrong:
| You see | Cause | Fix |
|---|---|---|
| One user question makes several runs | A wrapAgent around each sub-agent, tool or model call | Wrap only the entry point; sub-agents are agent spans. Multi-agent |
| One run holds a whole chat session | One run kept open across turns | One run per turn, grouped by conversationId. Conversations |
Blank input, or output like { status: 'ok' } | setInput not called; the HTTP response or a stream handle set as output | Set the user's message and the final answer. Wrap your agent |
Users all show as anon_... | No distinctId, or a different one per service | Pass your stable user ID everywhere. Users |
| Turns don't group | No conversationId on some turns | Pass the thread ID on every turn |
| A run with no model calls under it | Model client created before init, or instrumentor not installed | Call init in the first module your app loads. Frameworks |
| Model calls or tokens counted twice | Two instrumentors on one call, or trodo.llm around an auto-captured call | Keep one. Frameworks |
| Failures show as green | Errors caught and returned as data | Call setError (span) or setErrorSummary (run). Status & errors |
| A tool never shows up | await trodo.tool(name, fn): the helper was created, never called | Call the function tool() returns. Manual spans |
MCP calls stuck as running runs | wrapAgent or startRun around tools/call | Use trackMcp. Trace your MCP server |
| Nothing arrives from a script or job | The process exited before sending | await trodo.flush() before exit. Delivery & runtimes |
Questions
Still stuck? Email developers@trodo.ai.