promptulate
promptulate copied to clipboard
Add stream output for Agent
Related to #833
Add stream output support for ToolAgent.
-
ToolAgent Class:
- Add
stream
parameter to therun
method. - Implement logic to handle the
stream
parameter. - Modify the
_run
method to support streaming output. - Raise error if
stream=True
andoutput_schema
is not provided.
- Add
-
BaseAgent Class:
- Add
stream
parameter to therun
method. - Implement
_run_stream
method to handle streaming output.
- Add
-
Example:
- Update
example/agent/tool_agent_usage.py
to demonstrate the usage ofagent.run(..., stream=True)
.
- Update
-
Tests:
- Add tests in
tests/agents/test_tool_agent.py
to verify the stream mode output functionality.
- Add tests in
For more details, open the Copilot Workspace session.
Summary by CodeRabbit
-
New Features
- Introduced streaming capabilities for the agent, allowing real-time output during execution.
- Enhanced the tool agent to process multiple responses dynamically.
-
Bug Fixes
- Added validation to ensure necessary parameters for streaming operations are provided.
-
Tests
- Added a new test to validate the tool agent's behavior in stream mode.