Skip to content

Commit 5467f03

Browse files
committed
change previous_response_id bootstrap value from "bootstrap" to empty string
1 parent f3ae68b commit 5467f03

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

docs/running_agents.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,13 @@ from agents import Agent, Runner
174174
async def main():
175175
agent = Agent(name="Assistant", instructions="Reply very concisely.")
176176

177-
# First turn
178-
result1 = await Runner.run(agent, "What city is the Golden Gate Bridge in?")
177+
# First turn: since there's no previous_response_id yet,
178+
# you can set it to an empty string to force-enable response chaining
179+
# for internal function calls inside the first turn.
180+
result1 = await Runner.run(
181+
agent,
182+
"What city is the Golden Gate Bridge in?",
183+
previous_response_id="")
179184
print(result1.final_output)
180185
# San Francisco
181186

@@ -189,8 +194,6 @@ async def main():
189194
# California
190195
```
191196

192-
For the first turn where no real `previous_response_id` exists, you can set `previous_response_id="bootstrap"` to force-enable response chaining for internal function calls inside the first turn.
193-
194197
## Long running agents & human-in-the-loop
195198

196199
You can use the Agents SDK [Temporal](https://temporal.io/) integration to run durable, long-running workflows, including human-in-the-loop tasks. View a demo of Temporal and the Agents SDK working in action to complete long-running tasks [in this video](https://www.youtube.com/watch?v=fFBZqzT4DD8), and [view docs here](https://github.com/temporalio/sdk-python/tree/main/temporalio/contrib/openai_agents).

src/agents/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class _ServerConversationTracker:
131131
"""Tracks server-side conversation state for either conversation_id or
132132
previous_response_id modes.
133133
134-
Special value 'bootstrap' for previous_response_id enables chaining for internal
134+
Special value '' (empty string) for previous_response_id enables chaining for internal
135135
function calls in the first turn, even when there's no actual previous response ID yet.
136136
"""
137137

@@ -1364,7 +1364,7 @@ async def _run_single_turn_streamed(
13641364
previous_response_id = (
13651365
server_conversation_tracker.previous_response_id
13661366
if server_conversation_tracker
1367-
and server_conversation_tracker.previous_response_id != "bootstrap"
1367+
and server_conversation_tracker.previous_response_id != ""
13681368
else None
13691369
)
13701370
conversation_id = (
@@ -1803,7 +1803,7 @@ async def _get_new_response(
18031803
previous_response_id = (
18041804
server_conversation_tracker.previous_response_id
18051805
if server_conversation_tracker
1806-
and server_conversation_tracker.previous_response_id != "bootstrap"
1806+
and server_conversation_tracker.previous_response_id != ""
18071807
else None
18081808
)
18091809
conversation_id = (

tests/test_agent_runner.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ async def test_default_send_all_items_streamed():
12261226

12271227
@pytest.mark.asyncio
12281228
async def test_bootstrap_mode_multi_turn():
1229-
"""Test that bootstrap mode (previous_response_id='bootstrap') enables
1229+
"""Test that bootstrap mode (previous_response_id='') enables
12301230
chaining from the first internal turn."""
12311231
model = FakeModel()
12321232
agent = Agent(
@@ -1244,7 +1244,7 @@ async def test_bootstrap_mode_multi_turn():
12441244
]
12451245
)
12461246

1247-
result = await Runner.run(agent, input="user_message", previous_response_id="bootstrap")
1247+
result = await Runner.run(agent, input="user_message", previous_response_id="")
12481248
assert result.final_output == "done"
12491249

12501250
# Check the first call
@@ -1281,7 +1281,7 @@ async def test_bootstrap_mode_multi_turn():
12811281

12821282
@pytest.mark.asyncio
12831283
async def test_bootstrap_mode_multi_turn_streamed():
1284-
"""Test that bootstrap mode (previous_response_id='bootstrap') enables
1284+
"""Test that bootstrap mode (previous_response_id='') enables
12851285
chaining from the first internal turn (streamed mode)."""
12861286
model = FakeModel()
12871287
agent = Agent(
@@ -1299,7 +1299,7 @@ async def test_bootstrap_mode_multi_turn_streamed():
12991299
]
13001300
)
13011301

1302-
result = Runner.run_streamed(agent, input="user_message", previous_response_id="bootstrap")
1302+
result = Runner.run_streamed(agent, input="user_message", previous_response_id="")
13031303
async for _ in result.stream_events():
13041304
pass
13051305

0 commit comments

Comments
 (0)