Quick Start Guide
Basic Usage
-
Create a Toolbox:
-
Define and Add Tools:
-
Set up your system prompt:
-
Generate a response from your LLM:
-
Parse the response:
-
(optional) Use async streaming for calling tools ASAP:
import asyncio async def main(): # Stream the response async for chunk in anthropic_stream(system, prompt): for event in parser.parse_chunk(chunk): if event.is_tool_call: await toolbox.use_async(event) # Make sure to reset the parser and handle any unclosed tool tags events = parser.flush() # Optionally you can handle unclosed tool tags, or just ignore them for event in events: if event.is_tool_call: await toolbox.use_async(event) asyncio.run(main())