Skip to main content
The Messages view renders an agent’s trace as a chat-style conversation: user prompts, model responses, tool calls, and tool results, in order. It works automatically with any of the integrations listed in the table on this page. A couple of integrations (wrap_anthropic alone, and the JavaScript Claude Agent SDK) need a single metadata key set manually, which are listed in the table and in Known limitations.

Supported integrations

For the full detection rules, expected payload shape, and worked JSON examples for each integration, see Trace format reference.

Known limitations

A few integrations need a metadata override to be picked up:
  • wrap_anthropic alone: the wrapper does not set ls_message_format, so detection doesn’t match today. Set metadata={"ls_message_format": "anthropic"} on the call (or via RunnableConfig) for the run to be claimed.
  • Claude Agent SDK (JS): auto-detection currently allowlists only "claude-agent-sdk" and "claude-code", not the JS-emitted "claude-agent-sdk-js". Set ls_message_format: "anthropic" explicitly on JS traces.
  • langchain.create_agent: not in the explicit detection allowlist. It’s claimed today via ls_provider/ls_message_format fallthroughs in the matching OpenAI/Anthropic detection, or via graph_id / langgraph_node when the agent runs inside LangGraph. If routing is unreliable, set metadata.ls_message_format: "langchain" explicitly.

Exclude runs from the Messages view

Setting LS_MESSAGE_VIEW_EXCLUDE on a run’s metadata tells the Messages view to skip that run. The key’s presence is what matters; True is the conventional value. The filter runs before any extraction strategy sees the trace, so an excluded LLM or tool run never affects detection, message extraction, or tool-call pairing. LS_MESSAGE_VIEW_EXCLUDE is a top-level constant exported from langsmith (Python and JS) whose value is the string "ls_message_view_exclude". Prefer the constant to avoid typos; the literal string still works. Use it for LLM subspans that are not conversational turns, such as classification calls, embedding lookups, safety filters, or routing/guardrail decisions, that you still want visible elsewhere in LangSmith but do not want cluttering the conversation transcript.

Python

1. On a @traceable decorator: exclude a whole function’s run.
2. Via the trace context manager: exclude an ad-hoc span.
3. From inside a running function: set the key on the current run tree at any point before the run is patched.
4. Per-call when using wrap_openai / wrap_anthropic: pass langsmith_extra through to the wrapped client call.
5. LangChain RunnableConfig: exclude a single invocation of a chain or chat model.

TypeScript

1. On a traceable wrapper: exclude a whole function’s run.
2. From inside a running function: mutate the current run tree.
3. Per-call with wrapOpenAI: pass langsmithExtra on the call.
4. Vercel AI SDK middleware: pass the key via lsConfig.metadata on wrapAISDK. The middleware merges this onto every emitted LLM run.
To exclude only some calls and not others, wrap with wrapAISDK normally and instead mutate getCurrentRunTree() from inside a parent traceable that calls into the AI SDK, or use a child RunTree with createChild({ extra: { metadata: { [LS_MESSAGE_VIEW_EXCLUDE]: true } } }). 5. Manual RunTree.createChild: when you’re building runs by hand.

Notes

  • The filter checks for the presence of the key, not truthiness. {LS_MESSAGE_VIEW_EXCLUDE: false} still excludes the run. Omit the key entirely to include the run.
  • Child runs that execute inside a @traceable (Python) or traceable (JS) parent inherit the exclusion through the shared tracing context: Python’s _METADATA ContextVar and JS’s AsyncLocalStorage. The child’s own decorator-time metadata layers on top of the inherited values.
  • Excluded runs still appear in the regular trace view, runs explorer, and metrics. Only the Messages view filters them out.

Manual instrumentation

If you trace without one of the wrappers in Supported integrations—for example, emitting runs through RunTree, the REST API, or a custom wrapper around a provider SDK—set ls_message_format on each LLM run’s metadata to route the trace to the correct extractor: For the JSON shape each extractor expects, see the Trace format reference.