Generic agent runtime wrapping PydanticAI with full-spectrum streaming.
- High-fidelity streaming with callbacks for every lifecycle event
- Block start/end notifications for UI rendering
- Real-time streaming of text, thinking, and tool arguments
- Tool execution and result callbacks
- Message history management
- Dynamic instruction override
- Toolset composition
pip install bond-agentfrombondimportBondAgent, StreamHandlers, create_print_handlersfrombond.tools.memoryimportmemory_toolset, QdrantMemoryStore# Create agent with memory toolsagent=BondAgent(
name="assistant",
instructions="You are a helpful assistant with memory capabilities.",
model="anthropic:claude-sonnet-4-20250514",
toolsets=[memory_toolset],
deps=QdrantMemoryStore(), # In-memory for development
)
# Stream with console outputhandlers=create_print_handlers(show_thinking=True)
response=awaitagent.ask("Remember my preference for dark mode", handlers=handlers)Bond provides factory functions for common streaming scenarios:
create_websocket_handlers(send)- JSON events over WebSocketcreate_sse_handlers(send)- Server-Sent Events formatcreate_print_handlers()- Console output for CLI/debugging