definable/examples/ directory contains self-contained, runnable Python scripts demonstrating all major features. Each example includes a docstring explaining what it covers and any required API keys.
Running Examples
Prerequisites
Set API keys for the providers you want to use:Example Categories
Models
Basic invocation, async, streaming, structured output, multi-provider, vision and audio.
Agents
Simple agents, tools, toolkits, multi-turn, streaming, and async.
Tools
Basic tools, parameters, async tools, hooks, caching, and dependencies.
Knowledge
Basic RAG, document management, chunking, embedders, vector databases, reranking.
Memory
Basic memory, store protocol walkthrough, and backend smoke tests.
Interfaces
Discord bot, Signal bot, and multi-interface with identity resolution.
Readers
Basic readers, custom parsers, standalone usage, and provider overrides.
Runtime
Webhooks, cron jobs, event triggers, lifecycle hooks, and unified serving.
MCP
Basic MCP, multiple servers, resources, config files, mock servers, prompts, error handling.
Directory Structure
examples
models
01_basic_invoke.py
02_async_invoke.py
03_streaming.py
04_structured_output.py
05_multi_provider.py
06_vision_and_audio.py
agents
01_simple_agent.py
02_agent_with_tools.py
03_agent_with_toolkit.py
04_multi_turn.py
05_streaming_agent.py
06_async_agent.py
tools
01_basic_tool.py
02_tool_parameters.py
03_async_tools.py
04_tool_hooks.py
05_tool_caching.py
06_tool_dependencies.py
toolkits
01_custom_toolkit.py
02_toolkit_dependencies.py
03_knowledge_toolkit.py
knowledge
01_basic_rag.py
02_document_management.py
03_chunking_strategies.py
04_custom_embedder.py
05_vector_databases.py
06_agent_with_knowledge.py
07_reranking.py
memory
01_basic_memory.py
02_store_protocol.py
03_store_backends.py
interfaces
01_discord_bot.py
02_signal_bot.py
03_multi_interface.py
readers
01_basic_readers.py
02_custom_reader.py
03_standalone_usage.py
04_provider_override.py
mcp
01_basic_mcp.py
02_multiple_servers.py
03_resources.py
04_config_file.py
05_mock_server_basics.py
06_prompts_provider.py
07_error_handling.py
08_mock_server_agent.py
runtime
01_webhook_basic.py
02_cron_basic.py
03_unified.py
advanced
01_middleware.py
02_tracing.py
03_error_handling.py
04_cost_tracking.py