Repository navigation
fix: end an agent's turn only after a committed action - #16
Merged
Merged
Conversation
Port of the v0.2.1 fix (9aa897e) to main. Since v0.2.0, BaseAgent ended a turn after any successful environment tool call, so read-only tools (e.g. Hospital get_job_queue, find_available_slots) cut the turn short before the agent could act on what it saw. Tools now report a committed action with "action_committed": True; BaseAgent strips the key before the result reaches the model and still honors legacy state_updates. Main-only: IsThisSeatTakenTools has only action tools, so it flags every successful result. Its turns end exactly as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019aZZj794GDrpH36PWqn1ZM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports the v0.2.1 fix (
9aa897e, tagv0.2.1) tomain: an agent's turn ends only after a committed action, not after any successful environment tool call.Since v0.2.0,
BaseAgentset_env_state_committedfor every environment tool result without an error. That was a side effect of removingstate_updates(the old commit signal) inedef37b, and it made read-only tools such as Hospitalget_job_queueandfind_available_slotsend the turn before the agent could act on what it saw.Changes
BaseAgentcommits a turn only when a result carries"action_committed": True, and strips the key before the result reaches the model. Legacystate_updatesresults still commit.IsThisSeatTakenToolshas only action tools, so it flags every successful result and its turns end exactly as before.docs/components/tools.mddocuments the flag; CHANGELOG gets av0.2.1entry under[Unreleased].Testing
terrarium/tests/test_base_agent_turn_commit.py: 5 of its v0.2.1 tests fail on unpatched v0.2.0, as intended; 2 more cover the seat environment onmain.🤖 Generated with Claude Code
https://claude.ai/code/session_019aZZj794GDrpH36PWqn1ZM