Choose a setup method
Start with one method for a call path. Combining SDK tracking with framework
OpenTelemetry on the same call can create duplicate interactions.
Recommended: Agnost AI skill
Recommended. Choose this path when you want your coding agent to inspect the
project, select a supported transport, make the smallest instrumentation change,
send a test event, and verify that it reached Agnost AI.
Manual setup: Agnost AI SDK
Letta applications talk to agents through the Letta Agent SDK (@letta-ai/letta-agent-sdk).
Each turn is one session.send() followed by one session.stream() loop that ends with a
result message. Wrap that turn with agnost.begin() and interaction.end().
await agnost.shutdown() once when the application exits, not after each turn.
What this records for each turn:
- the user message as input and the turn’s final assistant text (
result.result) as output success: falsewith the LettaerrorCodewhen the turn fails, for examplellm_api_error,max_steps, orapproval_conflict- the Letta agent ID, the Letta conversation ID, and the names of the tools the agent called, as event properties
backend: "local" (the SDK starts Letta Code on the same machine) and
backend: "remote" (your own Letta App Server). Only the LettaAgentClient options change.
Tool calls stream as several tool_call fragments that share one toolCallId, which is why the
example keys tool names by toolCallId. Custom tools need approval in the default standard
permission mode, so the example allows get_weather through canUseTool. Without that, the turn
ends with errorCode: "approval_conflict", which the example records as a failed interaction.
Why there is no OpenTelemetry section
Letta Code, the runtime behind the Agent SDK, the CLI, and the App Server, does not export OpenTelemetry traces. The OpenTelemetry support in the older Python Letta server went away when that server was retired to thearchive branch of letta-ai/letta. OpenLIT’s Letta instrumentation
patches module paths from the old letta-client 0.x Python client, which the current 1.x client no
longer has. Use the Agnost AI SDK wrapper above.
Verify and troubleshoot
Verify
Run one turn, then open Conversations in Agnost AI and find thechatId you passed. Confirm
the event shows your user ID, the prompt as input, the assistant reply as output, and
letta.tools listing any tool the agent called.
Troubleshooting
- No events: confirm
agnost.init("your-org-id")runs before the first turn, and that the process callsawait agnost.shutdown()before it exits. - Output is empty: read the reply from the
resultmessage (message.result).assistantmessages carry text fragments, not the whole reply. - Failed events with
approval_conflict: a tool needed approval. Approve it incanUseToolor set apermissionModethat fits your app. - Every turn is a separate conversation: pass the same
conversationIdtoagnost.begin()for every turn in one chat. - Python apps: the Letta Agent SDK is TypeScript only. Wrap your own turn boundary with the Python SDK in the same way.
References
- Letta Agent SDK quickstart
- Sending messages and message types
- MCP and client tools
- Permissions
- Self-hosting and the local backend
Next steps
- Conversations: review each Letta turn in context.
- Events: inspect inputs, outputs, and tool properties.
- Patterns: organize production conversations by what users wanted.