Skip to content
BENIBIX Learn

UserMessage

AI🧩 Claude Agent SDKSDK Messages

Also known as SDK user message, tool result message, Claude Agent SDK UserMessage

The message that takes a tool's result, or your own words, back to Claude.

Think of it like

It is like the note a helper gets back once they check.

Example

Leo's tests fail inside the agent. He prints each UserMessage and sees the exact error Claude was given.

Why it matters

When the agent does something odd, the tool result is often why.

Definition

UserMessage is the Agent SDK message type for what goes back to Claude. After each tool runs, the SDK yields one with the tool's result, such as the output of a command. It also carries any message you stream in while the agent works. Reading it shows you what Claude saw before its next step.

Common mistake

Thinking it only holds what a person typed. Most UserMessages hold tool results.

Key takeaways

  1. 1
    Tool results. After each call.
  2. 2
    Your streamed input. Too.
  3. 3
    What Claude saw. Before acting.