feat(agentscope): Add ReAct Span Support#140
Merged
Cirilla-zmh merged 5 commits intomainfrom Mar 12, 2026
Merged
Conversation
Change-Id: I531eed928a02863b167eaf8716adcd0cb8a1490a Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I00078449e10b00c5757c77a5cd5f7fd3d97f99a7 Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I35332b6ec9e130332442d9ac372df0c4b0a521ee Co-developed-by: Cursor <noreply@cursor.com>
Collaborator
|
@copilot review the PR. |
7 tasks
Contributor
|
@123liuziming I've opened a new pull request, #146, to work on those changes. Once the pull request is ready, I'll request review from you. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds ReAct “react step” span instrumentation for AgentScope ReAct agents to improve trace visualization per reasoning→acting iteration, implemented via instance-level hooks.
Changes:
- Introduce per-iteration
react stepspan lifecycle management via AgentScope instance hooks. - Add VCR-backed test coverage for text-only, tool-call, multi-tool, error, and hook-cleanup scenarios.
- Update docs/changelog to describe the new ReAct step spans.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| instrumentation-loongsuite/loongsuite-instrumentation-agentscope/src/opentelemetry/instrumentation/agentscope/_wrapper.py | Adds hook-based ReAct step span tracking and cleanup around agent calls. |
| instrumentation-loongsuite/loongsuite-instrumentation-agentscope/tests/test_agent.py | Adds VCR tests validating step span creation, attributes, error status, and hook cleanup. |
| instrumentation-loongsuite/loongsuite-instrumentation-agentscope/tests/conftest.py | Forces skip_dep_check=True when instrumenting during tests. |
| instrumentation-loongsuite/loongsuite-instrumentation-agentscope/tests/cassettes/*.yaml | Adds new VCR recordings for the new ReAct step span tests. |
| instrumentation-loongsuite/loongsuite-instrumentation-agentscope/README.md | Documents ReAct step span support. |
| instrumentation-loongsuite/loongsuite-instrumentation-agentscope/CHANGELOG.md | Adds changelog entry for ReAct step span instrumentation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ongsuite-instrumentation-agentscope/src/opentelemetry/instrumentation/agentscope/_wrapper.py
Outdated
Show resolved
Hide resolved
...ongsuite-instrumentation-agentscope/src/opentelemetry/instrumentation/agentscope/_wrapper.py
Show resolved
Hide resolved
...ongsuite-instrumentation-agentscope/src/opentelemetry/instrumentation/agentscope/_wrapper.py
Show resolved
Hide resolved
...ongsuite-instrumentation-agentscope/src/opentelemetry/instrumentation/agentscope/_wrapper.py
Show resolved
Hide resolved
instrumentation-loongsuite/loongsuite-instrumentation-agentscope/tests/test_agent.py
Outdated
Show resolved
Hide resolved
instrumentation-loongsuite/loongsuite-instrumentation-agentscope/tests/test_agent.py
Outdated
Show resolved
Hide resolved
Change-Id: I31c72844933f848cbc2b803af48fbe7c6b88a220 Co-developed-by: Cursor <noreply@cursor.com>
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.
Description
Add
react stepspan instrumentation for AgentScope ReAct agents. Each ReAct iteration (reasoning → acting) is wrapped in a dedicated span for trace visualization.Implemented via AgentScope's built-in instance-level hook system, no internal monkey-patching needed.
Fixes #137
Type of change
How Has This Been Tested?
5 new VCR test cases covering: text-only response, single/multi tool calls, exception handling, hook cleanup.
Verified with live traffic against CMS 2.0 OTLP backend.
TestReactStepSpan— 5 tests passedDoes This PR Require a Core Repo Change?
Checklist: