Skip to content
BENIBIX Learn

Single Message Input

AI🧩 Claude Agent SDKAgent SDK Basics

Also known as single message mode, one-shot query, Claude Agent SDK Single Message Input

The mode that sends one prompt and ends, for jobs done in one go.

Think of it like

It is like sending a letter. You write it once, and wait for the reply.

Example

Leo's nightly job asks the agent to sum up the day's commits. One prompt is all it needs, so he uses single message input.

Why it matters

It is the simplest way to run a task, as long as the task needs no follow-up.

Definition

Single message input is the way to use the Agent SDK where you pass one prompt to query and read the result. It suits one-shot jobs and places that keep no state, such as a lambda. It cannot take images, queue more messages or be stopped. If a run hits a limit, the call raises an error after the result.

Common mistake

Not wrapping it in a try block. A run that hits max turns raises an error after the result.

Key takeaways

  1. 1
    One prompt, one run. Then done.
  2. 2
    No images or interrupts. Limited.
  3. 3
    Raises on limits. Use try.

Compare