Skip to main content
The 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

# From the repository root
python definable/examples/models/01_basic_invoke.py
python definable/examples/agents/02_agent_with_tools.py

Prerequisites

Set API keys for the providers you want to use:
export OPENAI_API_KEY="sk-..."
export DEEPSEEK_API_KEY="sk-..."       # For DeepSeek examples
export MOONSHOT_API_KEY="sk-..."       # For Moonshot examples
export XAI_API_KEY="xai-..."           # For xAI examples
export VOYAGE_API_KEY="pa-..."         # For Voyage AI embeddings
export COHERE_API_KEY="..."            # For Cohere reranking
Only the keys for examples you want to run are needed.

Example Categories

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