AI-разработка

Claude Opus 5.5 vs GPT-6 Astra: How Coding Agents Wire JSON, Tool Calling, and Structured Output

Около 14 мин

Оба флагмана для длинных coding agents, но JSON-контракты на разных API. Opus 5.5 — Messages. Astra — Responses. Карта полей, не таблица лидеров.

Перед чтением

Измерение Claude Opus 5.5 GPT-6 Astra
API surface POST /v1/messages; продолжение messages[] POST /v1/responses; previous_response_id
Structured output output_config.format type json_schema strict text.format type json_schema strict
Tool calling tools[].input_schema; tool_use / tool_result flat tools[]; function_call / function_call_output
tool_choice forced tool name errors; narrow with Schema auto / none on Responses; tools belong here post-DevDay
Session host-built messages[] (plus optional session_id state) previous_response_id chain; Decisions routing is separate

Факты до 2026-11-02: документация Opus 5.5, Astra/Responses. A-1042, resp_8k1a вымышлены.

Разные формы API—not тот же «JSON mode»

A coding-agent host usually juggles three jobs: a structured object for the UI, tool arguments the model requests, and the next hop after write-back. Opus 5.5 and Astra can both do it, but field names and continuations differ:

  • Opus 5.5 declares input_schema on Messages tools; the model returns tool_use (input is already an object). Extraction uses output_config.format, not a schema pasted into user text.
  • GPT-6 Astra with tools should use Responses: flat type/name/parameters, arguments often a string; write back with function_call_output on call_id. Objects use text.format.
  • Host duties stay: Schema validation, permissions, side effects, persisted state. Swapping models does not remove the JSON gate—it changes parsers and id fields.

Подробнее: Opus 5.5 deep dive и GPT-6 Astra deep dive. OpenAI после DevDay: DevDay Structured Output. Общий цикл: Coding agent loop.

Opus tools / format vs Astra text.format / flat tools

1. Opus 5.5: Messages + input_schema tool table. Same fictional order A-1042 as in coding-agent walkthroughs:

{
  "model": "claude-opus-5-5",
  "max_tokens": 16000,
  "effort": "medium",
  "tools": [{
    "name": "lookup_order",
    "description": "Look up an order by ID. Confirm before any refund.",
    "input_schema": {
      "type": "object",
      "properties": {
        "order_id": { "type": "string", "pattern": "^[A-Z]-\\d{4}$" }
      },
      "required": ["order_id"],
      "additionalProperties": false
    }
  }],
  "messages": [{
    "role": "user",
    "content": "Look up order A-1042 and say if it is paid."
  }]
}

2. Opus 5.5: UI objects via output_config.format. Keep that separate from tool calls; do not force a tool and a giant routing schema in one request.

{
  "model": "claude-opus-5-5",
  "max_tokens": 8192,
  "effort": "medium",
  "messages": [{
    "role": "user",
    "content": "Extract order A-1042 as JSON for the UI."
  }],
  "output_config": {
    "format": {
      "type": "json_schema",
      "strict": true,
      "schema": {
        "type": "object",
        "properties": {
          "order_id": { "type": "string", "pattern": "^[A-Z]-\\d{4}$" },
          "status": { "type": "string", "enum": ["paid", "open"] }
        },
        "required": ["order_id", "status"],
        "additionalProperties": false
      }
    }
  }
}

3. Astra: Responses + text.format for fields. Official Structured Outputs hook is text.format, not Chat Completions response_format.

{
  "model": "gpt-6-astra",
  "input": "Jane paid order A-1042.",
  "text": {
    "format": {
      "type": "json_schema",
      "name": "order_extract",
      "strict": true,
      "schema": {
        "type": "object",
        "properties": {
          "order_id": { "type": "string", "pattern": "^[A-Z]-\\d{4}$" },
          "status": { "type": "string", "enum": ["paid", "open"] }
        },
        "required": ["order_id", "status"],
        "additionalProperties": false
      }
    }
  }
}

4. Astra: side effects via flat strict tools + previous_response_id. Do not stringify whole function_call history by hand; chain with response ids.

{
  "model": "gpt-6-astra",
  "previous_response_id": "resp_8k1a",
  "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
    }
  }],
  "input": [{
    "role": "user",
    "content": [{ "type": "input_text", "text": "Look up A-1042 if needed." }]
  }]
}

One coding agent—which API for which job?

Choose by return contract, not by “smarter model.” Assume your host already has a vendor adapter:

You need Opus 5.5 GPT-6 Astra
Structured object for UI / downstream Messages output_config.format json_schema Responses text.format json_schema
DB lookup, file edit, shell tools + tool_use; tool_result write-back Responses flat tools + function_call_output
Long multi-turn job (dozens of turns) messages[] + host JSON state previous_response_id chain + host state
Force “must call lookup_order” avoid forced tool_choice; use Schema + prompt tool_choice auto/none; do not assume forced is stable
Bounded OpenAI routing (queue / escalate?) host rules or Decisions if on OpenAI stack Decisions answers; see DevDay split post

Programmatic Tool Calling and hosted Agents loops are OpenAI-side capabilities; Opus hosts still speak Messages. Your abstraction should store raw output items plus normalized business JSON—not one vendor string only.

Five steps to wire both stacks

Run the same fictional ticket on Opus and Astra in staging before production:

  1. Split three contracts. UI object schema, each tool’s parameters/input_schema, write-back result schema.
  2. Opus Messages adapter. Parse tool_use.id → execute → tool_result.tool_use_id.
  3. Astra Responses adapter. Parse function_call.call_id → function_call_output.
  4. Keep structured paths separate. Opus: output_config.format; Astra: text.format; do not mix into tool requests.
  5. Persist vendor-neutral facts in state. order_id, route, pending_tool in JSON state; raw call ids only for write-back alignment.

Five-segment loop fields (Request → Call → Result → State → Next) live in the Agent JSON State post; here we only ensure Call/Result shapes swap with vendor.

Spread arguments, input, and format output

Dual-stack bugs are usually “Astra call_id written into Opus tool_result” or “parse tool_use.input as a string twice.”

  • Use форматирование on tool_use.input, function_call.arguments, and format results; проверка Schema on both sides’ schemas.
  • Use JSON Diff on the same turn’s Opus messages vs Astra input items; confirm no leftover response_format.
  • Use JSONPath on host state for last_order_id; match tool args.
  • Loop field checklist: Agent JSON state.
  • JSONSort runs locally—do not upload real repo paths or keys.

Migration is done when each vendor’s JSON passes Schema—not when “both parse.”

Common mistakes

  • Assuming both vendors share Chat Completions function wrappers. Astra with tools should use flat Responses tools.
  • Using forced tool_choice as an Opus stabilizer. The supported path errors; narrow with Schema and descriptions.
  • Stuffing output_config.format and tools into one Messages “god schema.” Split objects and side effects across requests or turns.
  • Ignoring string arguments. Astra function_call needs parse + Schema; Opus tool_use.input is an object but still must validate.
  • Chaining previous_response_id while silently changing tools[] version. Log tools version with response ids for replay.
  • Writing a “who wins” pick. Facts are API and id differences; choose on compliance, latency, existing stack, and hosted features.

FAQ

Can Opus use OpenAI Responses?

Do not mix APIs. Your service can unify business JSON, but HTTP shapes must follow each vendor’s docs.

Can Astra stay on Chat Completions?

Requests without tools can; tool calling on Astra should move to Responses. See post-DevDay migration notes.

Does Structured Output replace Tool Calling?

No. format/json_schema constrains model text; side effects still need the tool channel and host execution.

Where does MCP fit?

MCP is how the host talks to external tools; the model still emits tool_use or function_call. MCP does not replace Schema gates.

Default Opus with Astra fallback?

Possible, but you need two parsers, two write-back id rules, and separate replay logs. Do not assume output items match.

Conclusion

Claude Opus 5.5 and GPT-6 Astra both push long-horizon tool JSON for coding agents, but contracts sit on different APIs: Messages + output_config + tool_use versus Responses + text.format + function_call.

Draw three schemas and write-back id rules, then pick models. The model only fills JSON; execute, permissions, and next hop stay host decisions.

Дальше

Журнал: Первая публикация