-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Problem Description
When using Agents or Workflows with multiple tools, there's no way to selectively control event streaming for individual tools. This creates two main issues:
-
Noisy utility tools: Frequently-called auxiliary tools (logging, status checks, etc.) generate excessive event streams that clutter logs and obscure important business logic events.
-
External API calls: Some tools make external API calls that users don't need to see in the event stream, but currently all tool executions are equally visible.
Current limitation:
# ❌ Can only control ALL tools globally
agent.run(stream=True, stream_events=False) # Disables all events
workflow = Workflow(stream_executor_events=False) # Disables all executor eventsProposed Solution
Add a stream_events parameter at the tool definition level to allow per-tool control:
@tool(stream_events=False) # Silence this specific tool
def fetch_external_api(url: str) -> str:
"""External API call users don't need to see"""
return requests.get(url).text
@tool(stream_events=True) # Default behavior, explicit
def critical_business_tool(data: str) -> str:
"""Core business tool with visible execution"""
return process_data(data)Expected behavior:
- Tool executes normally and returns results to the agent
- No ToolCallStartedEvent or ToolCallCompletedEvent generated for silenced tools
- Other tools' events remain unaffected
Alternatives Considered
Manual filtering at application layer (current workaround):
for event in agent.run("query", stream=True, stream_events=True):
if hasattr(event, 'tool') and event.tool. tool_name == 'noisy_tool':
continue # Skip unwanted events
process_event(event)Drawbacks:
- Repetitive code at every usage point
- Events still generated and transmitted (performance overhead)
- Not elegant for Workflows where events are processed internally
Using events_to_skip (Workflow-only):
workflow = Workflow(
events_to_skip=[WorkflowRunEvent. tool_call_started],
)Drawbacks:
- Only available at Workflow level
- Skips event types for ALL tools, not specific tools
- Cannot achieve "silence certain tools only" requirement
Additional Context
No response
Would you like to work on this?
- Yes, I’d love to work on it!
- I’m open to collaborating but need guidance.
- No, I’m just sharing the idea.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request