The Agent SDK's append-only item list is the agent's memory and conversation history.
Not yet available. The Agent SDK is tracked to be built — today, use the Client SDKs against the live chat completions API. The docs below describe the intended design.
An item list is the Agent SDK's representation of everything that has happened in an agent session — user messages, model responses, tool calls, tool results, and system events. It is append-only: each turn appends new items; past items are never mutated.
| Type | Description |
|---|---|
message | A user, assistant, or system message. |
tool_call | A tool invocation requested by the model. |
tool_result | The result returned by a tool execution. |
error | A captured error (tool failure, API error) that the agent can reason about. |
Each item carries a turnIndex so you can group items by the turn they appeared in.
messages array on the first callModel() call.callModel() returns the complete item list including the new turn.result.items as inputItems to the next call — no merging or slicing required.The item list is a plain array. You can inspect it to build UI, write logs, or make routing decisions.
Because the list is append-only, you can safely checkpoint it at any turn and resume from that point. Store result.items in a database or cache and pass it back to callModel() later to continue the session.
The SDK does not automatically truncate the item list. If a session grows long enough that the serialized history exceeds the model's context window, the request fails with an upstream_error from the provider. Handle this by summarising older turns and replacing them with a condensed message item before continuing.
callModel() API.