Repository navigation
feat: add ScaffoldController middleware for configurable ReAct scaffolding - #2022
Open
Alwin4Zhang wants to merge 1 commit into
Open
Alwin4Zhang wants to merge 1 commit into
Alwin4Zhang wants to merge 1 commit into
Conversation
Contributor
|
This PR is marked as stale because there has been no activity for 60 days. Remove stale label or add new comments or this PR will be closed in 30 days. |
This branch has not been deployed
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.
Motivation
This provides a path to optimize the fixed ReActAgent pattern with task-specific scaffold policies, while preserving AgentScope's existing abstractions and keeping scaffold behavior opt-in.
Summary
This PR adds a low-intrusion ScaffoldController layer for AgentScope agents.
The scaffold flow is:
Task -> ScaffoldController -> ScaffoldSpec -> ScaffoldCompiler -> ScaffoldPolicy -> Agent middleware hooks
It keeps the existing Agent/ReAct rollout unchanged and applies scaffold behavior through the current middleware system.
Changes
Add
ScaffoldSpecto describe scaffold runtime policy:Add controller/compiler abstractions:
ScaffoldControllerBaseStaticScaffoldControllerModelScaffoldControllerScaffoldCompilerAdd
ScaffoldMiddlewareintegration:on_system_prompt: inject scaffold prompton_model_call: filter model-visible toolson_reasoning: apply step budget and tool choice policyon_reply: collect lightweight trace summary for later evaluation/store useExport scaffold APIs from
agentscope.middleware.Add tests for:
Design Notes
The implementation is intentionally non-invasive. It does not modify the core
Agentloop, toolkit registration, state model, or ReAct execution logic. Runtime behavior is applied through existing middleware hooks, so users can enable scaffold behavior by configuration or constructor arguments.ModelScaffoldControllerallows a stronger model to generateScaffoldSpecvia structured output, while falling back to a static scaffold if generation fails.Validation