agentscope-ai / agentscope-ai/agentscope
[Bug]:set_console_output_enabled(False) unexpectedly disables AgentScope Studio tracing/output
- 主要语言
- Python
- 星标
- 31.6k
- 派生
- 3.5k
- 平均合并
- 1 天 16 小时
- 30 天内合并 PR
- 103
描述
### Description
In recent versions of AgentScope (main branch), calling:
```python
agent.set_console_output_enabled(enabled=False)
```
does not only disable console output, but also **silently disables message forwarding to AgentScope Studio**, including message display and tracing.
This behavior is **not documented** and is **inconsistent with the method name and its docstring**, which only mention disabling console output in production environments.
------
### Expected Behavior
- `set_console_output_enabled(False)` should **only affect console printing**
- AgentScope Studio should continue to receive:
- messages
- metadata
- traces / spans
This was the behavior in earlier versions, where console output and Studio tracing were independent.
------
### Actual Behavior
When `set_console_output_enabled(False)` is set:
- Console output is disabled ✅
- **Studio message display and tracing are also disabled ❌**
- No warning or documentation indicates this global side effect
Root cause (from source code):
In
`src/agentscope/hooks/_studio_hooks.py`
```python
if self._disable_console_output:
return
```
Studio hooks directly depend on the console output flag, effectively treating Studio as a “visual console” rather than an independent output channel.
------
### Why This Is a Problem
1. **Semantic mismatch**
- Method name and docstring only reference console output:
> “in a production environment, you may want to disable the console output to avoid messy logs”
- There is no mention that this disables Studio / tracing.
2. **Breaks production workflows**
- A common use case is:
- disable console logs in production
- keep Studio / tracing enabled for observability
- This is currently impossible without modifying source code.
3. **Backward incompatibility**
- Previous AgentScope versions allowed disabling console output while keeping tracing intact.
- The behavior change is undocumented.
------
### Suggested Improvements
One of the following would resolve the issue:
1. **Decouple Studio output from console output**
- Introduce a separate flag, e.g.:
```
set_studio_output_enabled(True | False)
```
2. **At minimum, update documentation**
- Clearly state that `set_console_output_enabled(False)`:
- disables console output
- disables Studio message display
- disables tracing
3. **Emit a warning**
- When disabling console output while Studio is enabled, warn users about the side effect.
------
### Temporary Workaround
Manually comment out or modify the following line:
https://github.com/agentscope-ai/agentscope/blob/main/src/agentscope/hooks/_studio_hooks.py#L19
```
if self._disable_console_output:
return
```
This restores the expected behavior:
**console disabled, Studio still active**.
------
### Environment
- AgentScope version: `main` (current)
- Python: 3.13.7
- AgentScope Studio: latest available
- OS: Windows / Linux
------
### Closing
This appears to be an architectural change made for consistency, but without sufficient documentation or API-level clarity.
Clarifying or decoupling these behaviors would significantly improve usability in production and observability-focused setups.
贡献指南
评估
这个 Issue 还没有评估数据。