Skip to main content

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. 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.
Install the skill once in your coding-agent environment:
Run the framework-specific prompt below from the application root. Review the resulting diff before deploying it.

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().
Call 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: false with the Letta errorCode when the turn fails, for example llm_api_error, max_steps, or approval_conflict
  • the Letta agent ID, the Letta conversation ID, and the names of the tools the agent called, as event properties
The same code works with 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 the archive 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 the chatId 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 calls await agnost.shutdown() before it exits.
  • Output is empty: read the reply from the result message (message.result). assistant messages carry text fragments, not the whole reply.
  • Failed events with approval_conflict: a tool needed approval. Approve it in canUseTool or set a permissionMode that fits your app.
  • Every turn is a separate conversation: pass the same conversationId to agnost.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

Next steps

  • Conversations: review each Letta turn in context.
  • Events: inspect inputs, outputs, and tool properties.
  • Patterns: organize production conversations by what users wanted.