Debugging in the Playground
Generally the Playground gives a lot of information about what’s happening, but when that is insufficient, you have other options.Logging the raw request and response from LLM calls
You can provide arawRequestResponseHandler to the agent to log the raw
request and response from the LLM.
You could use this to log the request and response to a table, or use console
logs with
Log Streaming to
allow debugging and searching through Axiom or another logging service.
Logging the context messages via the contextHandler
You can log the context messages via the contextHandler, if you’re curious what exactly the LLM is receiving.Tracing LLM calls with OpenTelemetry
When you passexperimental_telemetry to a
generate or stream call, the AI SDK emits OpenTelemetry spans with the model,
token usage, prompt, and response.
To export them to an OTLP backend, register a tracer provider:
Inspecting the database in the console
You can go to the Data tab in the console and select the agent component above the table list to see the Agent data. The organization of the tables matches the schema. The most useful tables are:threadshas one row per threadmessageshas a separate row for each ModelMessage - e.g. a user message, assistant tool call, tool result, assistant message, etc. The most important fields areagentNamefor which agent it’s associated with,status,orderandstepOrderwhich are used to order the messages, andmessagewhich is roughly what is passed to the LLM.streamingMessageshas an entry for each streamed message, until it’s cleaned up. You can take the ID to look at the associatedstreamDeltastable.filescaptures the files tracked by the Agent from content that was sent in a message that got stored in File Storage.
Troubleshooting
Type errors on components.agent
If you get type errors about components.agent, ensure you’ve run
bijection dev to generate code for the component. The types expected by the
library are in the npm library, and the types for components.agent currently
come from generated code in your project (via bijection dev).
Circular dependencies
Having the return value of workflows depend on other Bijection functions can lead to circular dependencies due to theinternal.foo.bar way of specifying
functions. The way to fix this is to explicitly type the return value of the
workflow. When in doubt, add return types to more handler functions, like
this: