Examples
All examples are in theexamples/ directory. Each is self-contained and runnable.
Quick Start
| Example | What It Shows |
|---|---|
basic_usage.py | Minimal @llm_function call with typed output |
template_params_example.py | Dynamic docstring templates with _template_params |
Tool Usage
| Example | What It Shows |
|---|---|
tool_usage_example.py | @tool decorator, multi-tool agent |
multimodal_tool_example.py | Tools returning ImgPath/ImgUrl |
agent_as_tool_example.py | Nesting one agent as a tool for another |
Chat & Streaming
| Example | What It Shows |
|---|---|
streaming_example.py | Consuming LLMChunkArriveEvent for real-time output |
event_stream_example.py | Full event stream consumption pattern |
abort_example.py | AbortSignal for cancellation |
PyRepl & Runtime
| Example | What It Shows |
|---|---|
pyrepl_example.py | Persistent REPL: variables, streaming, reset |
pyrepl_seaborn_multimodal_images.py | PyRepl image artifact capture and multimodal tool return with multiple seaborn plots |
selfref_example.py | runtime.selfref.context.* primitives |
Full Agent
| Example | What It Shows |
|---|---|
tui_general_agent_example.py | Complete coding agent with TUI, PyRepl, FileToolset, SelfRef, fork, compaction |
Running Examples
Building Your Own
Start from one of these patterns:One-shot Function
@llm_function — typed input/output, no stateChat Agent
@llm_chat + tools — multi-turn with ReAct loopFull Agent
PyRepl + SelfRef + FileToolset + TUI — production-grade