We now support GPT 5.6 - #8
Conversation
Migrate the main framework and the TravelPlanner example from the legacy functions/function_call interface to the modern OpenAI SDK tool-use interface (tools / tool_calls / role:"tool"). All framework logic, prompts and tool schemas are unchanged; only the API layer differs. - llm_core.py: single shared transport. Wraps bare tool schemas, streams every request internally (reassembling one complete response), sends no temperature and never caps max_tokens, and repairs stored histories to the strict assistant/tool pairing the new protocol requires. - config.py: model / base_url / optional reasoning_effort. - TravelPlanner: 76.67% final pass rate on the validation set (sole-planning), up from 10.0% with GPT-4o. Submission file included. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
There are a few correctness and reliability issues in the new transport/tooling path (thread-safety in client caching, tool schema wrapping dropping required, cross-platform process cleanup, and an off-by-one headcount cap) that should be fixed before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR migrates the core MegaAgent framework and the TravelPlanner example from the legacy functions / function_call API to the modern OpenAI SDK tool-use protocol (tools / tool_calls / role:"tool"), centralizing the transport logic in a new llm_core.py shared layer.
Changes:
- Introduces
llm_core.pyas a shared OpenAI SDK transport (streaming + message sanitation + tool wrapping) and updates the rootllm.pyto delegate to it. - Updates agent/tool execution loops (core
agent.pyand TravelPlannermain.py) to dispatch ontool_callsand emitrole:"tool"results withtool_call_id. - Refreshes TravelPlanner benchmark runner ergonomics/logging (
execute.py), updates configs tobase_url+reasoning_effort, and documents the new interface inREADME.md.
File summaries
| File | Description |
|---|---|
| requirements.txt | Adds Python dependencies needed for SDK/http transport and evaluation utilities. |
| README.md | Documents the new tool-use backbone and updates TravelPlanner results presentation. |
| llm.py | Switches root framework LLM calls to delegate through llm_core and updates retry/usage handling. |
| llm_core.py | Adds the shared SDK transport: tool wrapping, message sanitation, internal streaming accumulation. |
| examples/travel planner/main.py | Migrates TravelPlanner runtime loop to tool_calls, adds recruitment guardrails, and hardens history lookup. |
| examples/travel planner/llm.py | Migrates TravelPlanner LLM calls to llm_core and fixes written_files bookkeeping type. |
| examples/travel planner/execute.py | Reworks benchmark runner to add CLI args, timeouts, retries, log archival, and plan validation/salvage. |
| examples/travel planner/config.py | Updates example config to base_url + reasoning_effort and new model name. |
| config.py | Updates root config to base_url + reasoning_effort and new model name. |
| agent.py | Migrates core agent execution loop from function_call to tool_calls and adjusts memory filtering. |
| .gitignore | Ignores benchmark artifacts/logs while preserving the merged submission output. |
Review details
- Files reviewed: 9/12 changed files
- Comments generated: 5
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
| import json | ||
| import logging | ||
|
|
||
| import httpx | ||
| from openai import OpenAI | ||
|
|
||
| _clients = {} | ||
|
|
||
|
|
||
| def get_client(api_key, base_url): | ||
| key = (api_key, base_url) | ||
| if key not in _clients: | ||
| _clients[key] = OpenAI( | ||
| api_key=api_key, | ||
| base_url=base_url, | ||
| # Reasoning models can think for a long time, so the read timeout | ||
| # is generous — but not unlimited: some gateways occasionally | ||
| # accept a request and never answer it, and an unbounded read | ||
| # would hang that agent forever. 30 min covers any observed | ||
| # xhigh generation with wide margin; the callers' retry loops | ||
| # re-issue the request if it ever trips. | ||
| timeout=httpx.Timeout(connect=30.0, read=1800.0, write=600.0, pool=30.0), | ||
| ) | ||
| return _clients[key] |
| wrapped = [] | ||
| for t in bare_tools: | ||
| fn = {"name": t["name"]} | ||
| if "description" in t: | ||
| fn["description"] = t["description"] | ||
| fn["parameters"] = t.get("parameters", {"type": "object", "properties": {}}) | ||
| wrapped.append({"type": "function", "function": fn}) | ||
| return wrapped |
| def kill_process_tree(proc): | ||
| subprocess.run(['taskkill', '/F', '/T', '/PID', str(proc.pid)], | ||
| capture_output=True) |
| def run_row(index, row, config_content, timeout): | ||
| """Run main.py for one benchmark row. Returns a status string.""" |
| with recruit_lock: | ||
| if len(employee_dict) > MAX_EMPLOYEES: | ||
| result = f"Error: the team already has {MAX_EMPLOYEES} members. No more agents can be recruited." | ||
| else: |
Migrates the main framework and the TravelPlanner example from the legacy
functions/function_callinterface to the modern OpenAI SDK tool-use interface (tools/tool_calls/role:"tool").All framework logic, prompts and tool schemas are unchanged — only the API layer differs. Dynamic agent generation (
add_agent),<talk>-based inter-agent messaging, TODO-driven supervision and the git-backed shared file workspace all behave as before.What changed
llm_core.py(new) — one shared transport that every migratedllm.pydelegates to, so the interface exists in a single place:{"type":"function","function":{...}}form (a no-parameter tool such asterminategets the canonical empty object schema),temperatureand never capsmax_tokens,config.py—model,base_url, and an optionalreasoning_effortthat is only sent when set.agent.py/llm.py/ TravelPlannermain.py— dispatch ontool_calls, return results asrole:"tool"with the matchingtool_call_id.Results
TravelPlanner validation set, sole-planning mode, GPT-5.6 with
reasoning_effort=xhigh:The submission file (
merged_plans.jsonl) is included.Scope
The other examples under
examples/are untouched and still use the legacy interface.🤖 Generated with Claude Code