diff --git a/docs/swarms/structs/agent.md b/docs/swarms/structs/agent.md index 8947374a..42b4f4dd 100644 --- a/docs/swarms/structs/agent.md +++ b/docs/swarms/structs/agent.md @@ -83,6 +83,7 @@ The `Agent` class establishes a conversational loop with a language model, allow | `traceback` | `Optional[Any]` | Object used for traceback handling. | | `traceback_handlers` | `Optional[Any]` | List of traceback handlers. | | `streaming_on` | `Optional[bool]` | Boolean indicating whether to stream responses. | +| `stream` | `Optional[bool]` | Boolean indicating whether to enable detailed token-by-token streaming with metadata. | | `docs` | `List[str]` | List of document paths or contents to be ingested. | | `docs_folder` | `Optional[str]` | Path to a folder containing documents to be ingested. | | `verbose` | `Optional[bool]` | Boolean indicating whether to print verbose output. | @@ -759,6 +760,22 @@ print(agent.system_prompt) ``` +### Token-by-Token Streaming + +```python +from swarms import Agent + +# Initialize agent with detailed streaming +agent = Agent( + model_name="gpt-4.1", + max_loops=1, + stream=True, # Enable detailed token-by-token streaming +) + +# Run with detailed streaming - each token shows metadata +agent.run("Tell me a short story about a robot learning to paint.") +``` + ## Agent Structured Outputs - Create a structured output schema for the agent [List[Dict]] @@ -1112,4 +1129,4 @@ The `run` method now supports several new parameters for advanced functionality: | `tool_retry_attempts` | Configure tool_retry_attempts for robust tool execution in production environments. | | `handoffs` | Use handoffs to create specialized agent teams that can intelligently route tasks based on complexity and expertise requirements. | -By following these guidelines and leveraging the Swarm Agent's extensive features, you can create powerful, flexible, and efficient autonomous agents for a wide range of applications. \ No newline at end of file +By following these guidelines and leveraging the Swarm Agent's extensive features, you can create powerful, flexible, and efficient autonomous agents for a wide range of applications.