What JSON Data Structures Do AI Agents Need After OpenAI DevDay 2026? 2026 Request, Tool Call, and Agent State Explained
DevDay split routing (Decisions) from execution (Responses / Agents), but the host still owns one chain: the model emits a call, you write a result, persist response_id and facts in state, then shape the next request. This piece covers those five JSON segments—not how to layer workflows, and not a repeat of Agents API session field names.
Before you read
| Stage | Typical JSON (Responses-first) | Who writes |
|---|---|---|
| Request | POST /v1/responses: model, input, tools; continue with previous_response_id | Your orchestrator when state.next is submit_request |
| Tool Call | Output item type function_call; call_id + name + arguments string | Model; host parses arguments then executes |
| Tool Result | Input item function_call_output; same call_id; output is stringified JSON | Host after side effects |
| Agent State | run_id, phase, ids, facts, raw_tool_outputs, next (host-defined) | Host-only persistence; Decisions answers map into facts |
| Next Action | Next request: function_call_output only, or new user message + previous_response_id | Host picks from state.next.kind—not model prose |
Facts through 2026-10-28: Responses function_call guide, Decisions GA input_json, DevDay 2026 recap. A-1042, call_3c91, run_demo_7c are fictional.
At least five JSON pieces: request, call, result, state, next hop
After DevDay, most custom agents still run side effects through a Responses tool loop: Decisions returns answers only—it will not run lookup for you. Keep an Agent State object that separates last response_id, pending call_id, verified facts (order_id, route), and a next-action enum. Hosted long tasks on Agents API swap Call/Result for session events with turn_id—a different chain, covered elsewhere.
- Request: tools plus optional previous_response_id; do not stringify the whole state into the prompt.
- Call / Result: arguments and output are strings; validate before execute; write back with the same call_id.
- State + Next: facts hold verified fields; next tells the orchestrator to send a result or a fresh request.
Three-layer workflow: Workflow walkthrough. Agents API turn_id / required_actions: Agents API data structures. Legacy field migration: API migration.
Request → call → result → state → next
1. Request. When state has route_choice=lookup, issue a tool-bearing Responses request with the prior response_id:
{
"model": "gpt-6-luna",
"previous_response_id": "resp_8k1a",
"input": [{
"role": "user",
"content": [{
"type": "input_text",
"text": "Order A-1042 was routed to lookup. Call the tool if needed."
}]
}],
"tools": [{
"type": "function",
"name": "lookup_order",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"order_id": { "type": "string", "pattern": "^[A-Z]-\\d{4}$" }
},
"required": ["order_id"],
"additionalProperties": false
}
}]
}
2. Tool Call. The response output contains a function_call; set state.phase=awaiting_tool and pending_call_id:
{
"type": "function_call",
"call_id": "call_3c91",
"name": "lookup_order",
"arguments": "{\"order_id\":\"A-1042\"}"
}
3. Tool Result. After lookup_order runs, build the writeback item (JSON placed in the next request input array):
{
"type": "function_call_output",
"call_id": "call_3c91",
"output": "{\"order_id\":\"A-1042\",\"status\":\"paid\",\"amount\":99.00}"
}
4. Agent State. No official API stores this for you; it binds response_id to business facts and declares the next action:
{
"run_id": "run_demo_7c",
"phase": "awaiting_tool",
"ids": {
"last_response_id": "resp_9f2b",
"pending_call_id": "call_3c91"
},
"facts": {
"order_id": "A-1042",
"route_choice": "lookup"
},
"raw_tool_outputs": {},
"next": { "kind": "submit_tool_output", "call_id": "call_3c91" }
}
5. Next Action. When next.kind is submit_tool_output, the next hop is often only function_call_output + previous_response_id:
{
"model": "gpt-6-luna",
"previous_response_id": "resp_9f2b",
"input": [{
"type": "function_call_output",
"call_id": "call_3c91",
"output": "{\"order_id\":\"A-1042\",\"status\":\"paid\",\"amount\":99.00}"
}]
}
Five segments align on call_id and response_id
A common post-DevDay bug: Decisions choice lands in facts but phase never updates, so duplicate function_calls fire. Use this table:
| Segment | Keys that must stay stable | Connects to |
|---|---|---|
| Request | previous_response_id, tools[].name | state.ids.last_response_id |
| Tool Call | call_id, arguments | state.ids.pending_call_id |
| Tool Result | call_id, output string | Same call_id as Call |
| Agent State | facts.*, phase, next.kind | Decisions answers → facts; Response id → ids |
| Next Action | input[] with output or new user content | Driven by state.next, not model prose |
Decisions GA lets conversation history—including function_call_output—live in input as evidence. That is not a state replacement; update facts after tool writeback.
Five steps to an auditable loop
Run fictional order_id in staging before wiring Decisions routing:
- Init state. run_id, empty facts, next=submit_request.
- Ingest Decisions answers. Write route choice to facts; phase=ready_for_tool_request.
- Send request, receive call. Store response_id in ids; validate arguments before execute.
- Write result, update state. raw_tool_outputs holds full payload; facts only downstream-safe fields.
- Send next hop from next. Use another Responses turn for structured summary—do not merge with raw.
On Agents API, swap Call/Result for session events; host state still stores facts + next.
Spread one Request and one State when debugging
Most “agent amnesia” is a drifted response_id or call_id—not weak reasoning.
- Use format on arguments; Schema validation on tool params and facts subset schemas.
- Use JSON Diff between state versions or Call arguments vs facts.order_id.
- Use JSONPath on raw_tool_outputs to verify facts copied correctly.
- Use JSON Patch for small state.phase / facts updates via RFC 6902.
- JSONSort runs locally—do not upload production tickets or keys.
When all five segments rebuild from IDs, you own Agent State—not the messages array as a database.
Common mistakes
- Using the messages array as state. Official history lacks your phase / next enum.
- Executing arguments as an object. JSON.parse first, then Schema.
- New call_id on result writeback. The harness stalls; async tools need the original call_id.
- Mixing facts and raw_tool_outputs. Downstream reads facts; audits read raw.
- Dropping previous_response_id. Loses reasoning items or duplicates tool defs.
- Treating Decisions choice as a completed tool. Choice goes to facts; Call is still its own turn.
FAQ
Must Agent State be a JSON file?
Keep a JSON object shape for Schema validation and Diff; Redis/SQL can store the same field contract.
function_call id vs call_id—which one?
2026 Responses writeback aligns function_call_output on call_id; the migration post lists legacy aliases.
Should Decisions answers go into the Request?
Do not stringify all answers; write conclusions to state.facts; Requests carry only needed user text or input_json evidence.
How is this different from the Agents API JSON data structure post?
That post covers session / turn_id / required_actions; this one covers the common post-DevDay Responses host loop.
Should next.kind be standardized?
Fix team enums (submit_tool_output, submit_request, wait_human) for logging and replay.
Conclusion
After DevDay 2026, agent JSON is not a bigger prompt—it is five clear roles: Request to start, Call to declare side effects, Result to write back, State owned by the host, Next driven by state. Decisions only feeds facts, not Call/Result.
Define your state schema before API fields. The model still only emits Calls; execute and next-hop shape stay host JSON decisions.
Further reading
- Post-DevDay agent workflow Decisions / Responses / Agents layering
- Agents API JSON data structures turn_id, required_actions, session chain
- API migration call_id and writeback shapes
- JSON Patch Small updates to state.phase and facts
- All posts More on JSON and AI development
Changelog: First published