Documentation Index
Fetch the complete documentation index at: https://traceroot.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Set a Session ID to group traces together — all turns in a conversation, or all steps in a multi-agent workflow.
Using using_attributes / usingAttributes
Propagate a Session ID to all traces within a block:
from traceroot import using_attributes
with using_attributes(session_id="chat-abc-123"):
response_1 = agent.run("What's the weather in SF?")
response_2 = agent.run("What about tomorrow?")
Combine with a User ID to get full context on every trace:with using_attributes(session_id="chat-abc-123", user_id="user-42"):
agent.run(query)
import { usingAttributes } from '@traceroot-ai/traceroot';
await usingAttributes({ sessionId: 'chat-abc-123' }, async () => {
await agent.run("What's the weather in SF?");
await agent.run('What about tomorrow?');
});
Combine with a User ID to get full context on every trace:await usingAttributes({ sessionId: 'chat-abc-123', userId: 'user-42' }, async () => {
await agent.run(query);
});
Using observe / inside a function
Call update_current_trace / updateCurrentTrace from within any observed function:
from traceroot import observe, update_current_trace
@observe(name="handle_request", type="agent")
def handle_request(query: str, session_id: str):
update_current_trace(session_id=session_id)
return process(query)
import { observe, updateCurrentTrace } from '@traceroot-ai/traceroot';
async function handleRequest(query: string, sessionId: string) {
return observe({ name: 'handle_request', type: 'agent' }, async () => {
updateCurrentTrace({ sessionId });
return process(query);
});
}