Use tracing when one user request triggers multiple LLM calls or tool steps. Each step becomes a decision; the trace ties them together under one session_id.

Python

with h.trace(agent_id="research-bot", session_id="run-42", domain="general") as trace:
    step1 = your_llm_call(messages)
    trace.step("research", input=messages, output=step1)

    step2 = your_llm_call(step1 + followup)
    trace.step("response", input=step1, output=step2)

    trace.complete(final_output=step2, resolved=True)

h.flush()

TypeScript

const trace = h.trace({ agentId: "research-bot", sessionId: "run-42", domain: "general" });

const step1 = await yourLLMCall(messages);
trace.step("research", { input: messages, output: step1 });

const step2 = await yourLLMCall([...step1, ...followup]);
trace.step("response", { input: step1, output: step2 });

trace.complete({ finalOutput: step2, resolved: true });
await h.flush();

When to trace vs single observe

Single observe()Trace
One LLM call per user turnChain of calls (RAG, ReAct, multi-agent)
Simple chatbotsResearch → draft → review pipelines
Lowest overheadFull visibility into each step

Step names

Use stable step names (research, tool_call, final) so Monitoring and debugging stay readable across sessions.