Messages API and Tool Use Under Questioning
Explore how to work with Anthropic's Messages API, manage conversation history, and integrate client-side tools within AI systems. Understand how to handle API responses, stop reasons, and common interview pitfalls to demonstrate fluency in building reliable AI assistants during Forward Deployed Engineer interviews at Anthropic.
Every Claude system an FDE builds rests on one endpoint. Chat assistants, document reviewers, and multi-step agents all send requests to the Messages API and read responses in the same shape.
Anthropic’s interviewers use this layer to separate candidates who have built on Claude from candidates who have only read about it. In the technical use-case screen or the coding round, an interviewer may ask you to wire a tool into Claude live or to explain why a half-working integration fails. Fluency here shows up in small details, such as how you store the conversation, how you branch on a response, and how you return a tool’s result.
The examples follow one scenario: an expense audit assistant that helps a finance team check employee expense reports against company policy.
The request shape interviewers check
The Messages API is Anthropic’s interface for sending a conversation to Claude and receiving Claude’s next turn. Each request carries four core fields.
model: The Claude model that answers, such asclaude-sonnet-5-5.max_tokens: The upper limit on the length of Claude’s reply.system: An optional prompt that sets Claude’s role and rules for the whole conversation.messages: The conversation so far, as a list of user and assistant turns.
Claude’s reply arrives as a list of content blocks. A content block is one typed piece of a message, such as a text block, a tool_use block, or a thinking block. Code that checks each block’s type keeps working when a reply carries more than text.
The API is stateless, which means it keeps no memory between requests. Each request carries the full conversation, and your code owns the history. This detail creates a common interview trap. A candidate who rebuilds the assistant turn from its text alone drops the tool_use and thinking blocks, and the next request fails or loses context. The safe habit is to append the assistant’s content exactly as the API returned it.
Let’s send a first request to the expense assistant, then a follow-up that only makes sense with the history.
Lines 3–5: We created the client with our API key and set the model and a short system prompt for the expense assistant.
Line 8: We ...