Fix/tool error as tool result#121
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the LangGraph integration’s event conversion so that on_tool_error is emitted as a TOOL_RESULT event (instead of ERROR), aligning tool failures with the tool-result lifecycle and updating related integration tests. It also bumps the package version to 0.0.36.
Changes:
- Convert LangGraph
on_tool_errorintoEventType.TOOL_RESULTwithdata={"id": ..., "result": ...}. - Update integration tests to assert
TOOL_RESULTsemantics and field names (id/result). - Bump SDK version from
0.0.35to0.0.36.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
agentrun/integration/langgraph/agent_converter.py |
Changes tool error conversion to emit TOOL_RESULT rather than ERROR. |
tests/unittests/integration/test_langgraph_events.py |
Updates expectations for tool-error events to be TOOL_RESULT with id/result. |
tests/unittests/integration/test_langgraph_to_agent_event.py |
Mirrors the tool-error expectation changes for the agent-event conversion path. |
pyproject.toml |
Bumps project version to 0.0.36. |
agentrun/__init__.py |
Bumps __version__ to 0.0.36. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
919
to
+923
| yield AgentResult( | ||
| event=EventType.ERROR, | ||
| event=EventType.TOOL_RESULT, | ||
| data={ | ||
| "message": ( | ||
| "id": tool_call_id, | ||
| "result": ( |
Convert LangGraph tool failures into TOOL_RESULT events so downstream consumers treat them as tool outcomes instead of run-level errors. Constraint: preserve existing non-tool error handling. Rejected: keep emitting EventType.ERROR for on_tool_error | that escalates tool failures into run failures. Confidence: high Scope-risk: narrow Directive: future tool-error handling should stay aligned with TOOL_RESULT unless the protocol contract changes. Tested: uv run pytest -q tests/unittests/integration/test_langgraph_events.py tests/unittests/integration/test_langgraph_to_agent_event.py; git diff --check Not-tested: full repository test suite Change-Id: Ie7c4a6264afcbb7613b5382075978e82f9c7ef30 Co-developed-by: Codex <noreply@openai.com>
8a45006 to
6c4e035
Compare
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.
Fix bugs
Bug detail
Pull request tasks
Update docs
Reason for update
Pull request tasks
Add contributor
Contributed content
Content detail
Others
Reason for update