Skip to content

feat(agentscope): Add ReAct Span Support#140

Merged
Cirilla-zmh merged 5 commits intomainfrom
liuyu/agentscope-react-step
Mar 12, 2026
Merged

feat(agentscope): Add ReAct Span Support#140
Cirilla-zmh merged 5 commits intomainfrom
liuyu/agentscope-react-step

Conversation

@sipercai
Copy link
Collaborator

@sipercai sipercai commented Mar 10, 2026

Description

Add react step span 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

  • New feature (non-breaking change which adds functionality)

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 passed

Does This PR Require a Core Repo Change?

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

Change-Id: I531eed928a02863b167eaf8716adcd0cb8a1490a
Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I00078449e10b00c5757c77a5cd5f7fd3d97f99a7
Co-developed-by: Cursor <noreply@cursor.com>
@Cirilla-zmh Cirilla-zmh added documentation Improvements or additions to documentation enhancement New feature or request instrumentaion The instrumentation label represents issues related to instrumentation. genai The genai label represents issues related to generative AI. labels Mar 10, 2026
Change-Id: I35332b6ec9e130332442d9ac372df0c4b0a521ee
Co-developed-by: Cursor <noreply@cursor.com>
@123liuziming
Copy link
Collaborator

@copilot review the PR.

Copy link
Contributor

Copilot AI commented Mar 11, 2026

@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.

@123liuziming 123liuziming requested a review from Copilot March 11, 2026 12:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 step span 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.

sipercai and others added 2 commits March 11, 2026 21:02
Change-Id: I31c72844933f848cbc2b803af48fbe7c6b88a220
Co-developed-by: Cursor <noreply@cursor.com>
@Cirilla-zmh Cirilla-zmh merged commit 15d683f into main Mar 12, 2026
194 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request genai The genai label represents issues related to generative AI. instrumentaion The instrumentation label represents issues related to instrumentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Refactor loongsuite-instrumentation-agentscope for the latest OTel/LoongSuite semantic conventions.

6 participants