Skip to content

Commit 0bcda2f

Browse files
scale-ballenclaude
andcommitted
fix: add current user message to input_list and fix langgraph model in sync tutorials
- 010_multiturn/acp.py: append current user message to input_list before Runner.run(); without this, Runner.run() was called with an empty list (history excludes current turn), causing an OpenAI API error for missing input - 020_streaming/acp.py: same fix for Runner.run_streamed(); also add `return` after yielding the no-API-key error message so the generator does not fall through - 030_langgraph/graph.py: change MODEL_NAME from "gpt-5" (invalid) to "gpt-4o"; remove unsupported `reasoning` kwarg from ChatOpenAI constructor Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 264a8f4 commit 0bcda2f

File tree

3 files changed

+8
-2
lines changed
  • examples/tutorials/00_sync

3 files changed

+8
-2
lines changed

examples/tutorials/00_sync/010_multiturn/project/acp.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ async def handle_message_send(
8888
# Convert task messages to OpenAI Agents SDK format
8989
input_list = convert_task_messages_to_oai_agents_inputs(task_messages)
9090

91+
# Append the current user message (not yet persisted in task history)
92+
input_list.append({"role": "user", "content": params.content.content})
93+
9194
# Run the agent
9295
result = await Runner.run(test_agent, input_list, run_config=run_config)
9396

examples/tutorials/00_sync/020_streaming/project/acp.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ async def handle_message_send(
5656
content="Hey, sorry I'm unable to respond to your message because you're running this example without an OpenAI API key. Please set the OPENAI_API_KEY environment variable to run this example. Do this by either by adding a .env file to the project/ directory or by setting the environment variable in your terminal.",
5757
),
5858
)
59+
return
5960

6061
# Try to retrieve the state. If it doesn't exist, create it.
6162
task_state = await adk.state.get_by_task_and_agent(task_id=params.task.id, agent_id=params.agent.id)
@@ -86,6 +87,9 @@ async def handle_message_send(
8687
# Convert task messages to OpenAI Agents SDK format
8788
input_list = convert_task_messages_to_oai_agents_inputs(task_messages)
8889

90+
# Append the current user message (not yet persisted in task history)
91+
input_list.append({"role": "user", "content": params.content.content})
92+
8993
# Run the agent and stream the events
9094
result = Runner.run_streamed(test_agent, input_list, run_config=run_config)
9195

examples/tutorials/00_sync/030_langgraph/project/graph.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from project.tools import TOOLS
2121
from agentex.lib.adk import create_checkpointer
2222

23-
MODEL_NAME = "gpt-5"
23+
MODEL_NAME = "gpt-4o"
2424
SYSTEM_PROMPT = """You are a helpful AI assistant with access to tools.
2525
2626
Current date and time: {timestamp}
@@ -46,7 +46,6 @@ async def create_graph():
4646
"""
4747
llm = ChatOpenAI(
4848
model=MODEL_NAME,
49-
reasoning={"effort": "high", "summary": "auto"},
5049
)
5150
llm_with_tools = llm.bind_tools(TOOLS)
5251

0 commit comments

Comments
 (0)