agentscope-ai / agentscope-ai/agentscope
[Feature]: Pass Actual Acting Result to `post_acting_hook` in React Agent
- Linguagem predominante
- Python
- Estrelas
- 31.5k
- Forks
- 3.5k
- Merge médio
- 1d 23h
- PRs com merge (30d)
- 95
Descrição
**Is your feature request related to a problem? Please describe.**
Yes. The default `post_acting_hook` in the official React Agent cannot access the actual tool execution result. When the acting phase does not produce structured output, the value passed into `post_acting_hook` is `None`, even if the agent has successfully executed tools and obtained meaningful results.
This makes it difficult to implement common post-acting behaviors such as:
* observing the real acting result,
* logging tool outputs,
* collecting metrics,
* auditing execution details,
* triggering callbacks based on actual acting outcomes.
As a result, the practical usefulness of `post_acting_hook` is significantly reduced, and its behavior is unintuitive for users who expect it to receive the real output of the acting phase.
---
**Describe the solution you'd like**
The React Agent should pass the actual acting result into `post_acting_hook`, regardless of whether structured output is produced.
Specifically:
* If the acting phase successfully produces a tool execution result or final result, that result should be forwarded to `post_acting_hook`.
* `None` should only be used when there is truly no acting result, rather than as a fallback for non-structured-output cases.
This change would make `post_acting_hook` more practical and aligned with expectations, enabling:
* reliable observation of acting outcomes,
* clean implementation of post-processing logic,
* proper logging and tracing,
* easier debugging,
* extensibility via result-based callbacks.
---
**Describe alternatives you've considered**
Several workarounds were considered:
1. **Overriding or patching the acting logic**
* Store the acting result manually and access it indirectly.
* Drawbacks:
* increases implementation complexity,
* relies on internal logic,
* reduces maintainability and portability.
2. **Using custom wrappers or other callbacks**
* Intercept tool execution outside of the hook system.
* Drawbacks:
* not equivalent to a true post-acting hook,
* may miss final acting context,
* breaks the intended hook abstraction.
Overall, these alternatives are less clean and deviate from expected hook semantics.
---
**Additional context**
This issue becomes especially apparent in observability and integration scenarios. For example, developers may want to:
* inspect tool outputs inside `post_acting_hook`,
* record acting results for tracing or debugging,
* trigger downstream logic based on actual results.
Currently, these use cases are difficult or impossible to implement cleanly because the hook receives `None` in non-structured-output flows.
From an API design perspective, a "post-acting" hook is generally expected to receive the actual output of the acting phase. Aligning the behavior with this expectation would significantly improve developer experience and consistency of the hook mechanism.
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.