Module 04: Prompts
Deep dive into prompt requests and response handling.What You’ll Learn
PromptRequeststructure — session ID and content listPromptResponseandStopReasonvalues- Content types for prompts
The Code
PromptRequest takes a session ID (from Module 03) and a list of content items. The response includes a StopReason that tells you why the agent stopped generating — check this to know if the response is complete, truncated, or refused:
Stop Reasons
TheStopReason tells you why the agent finished:
| StopReason | Description |
|---|---|
END_TURN | Agent finished responding normally |
MAX_TOKENS | Token limit reached |
REFUSAL | Agent refused the request |
CANCELLED | Prompt was cancelled by the client |
END_TURN is the normal case. MAX_TOKENS means the response was truncated. REFUSAL may require rephrasing the prompt.