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

Models

Invocation, streaming, structured output, multi-provider.

Agents

Simple agents, tools, multi-turn, streaming.

Teams

Coordinate, route, collaborate, and tasks modes.

Workflows

Sequential, parallel, conditional, loop, and router.

Tools

Parameters, async tools, hooks, caching, dependencies.

Knowledge

RAG, chunking, embedders, vector databases, reranking.

Memory

Stores, agent integration, summarization.

Interfaces

Discord, Slack, Telegram, multi-interface.

Browser

Playwright CDP automation, element refs, forms.

Guardrails

Input, output, and tool guardrails with composition.

Security

Tool policies, rate limiting, security audits.

Evaluation

Accuracy, performance, reliability, agent-as-judge.

MCP

MCP servers, resources, config, mock servers.

Readers

PDF, DOCX, custom parsers, provider overrides.

Skills

Built-in skills, markdown skills, macOS control.

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_multi_interface.py
03_desktop_control_via_telegram.py
04_gateway_telegram.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
skills
01_markdown_skills.py
02_macos_basic.py
auth
01_unified_auth.py
guardrails
01_basic_guardrails.py
02_custom_guardrails.py
replay
01_basic_replay.py
research
01_basic_research.py
02_agent_with_research.py
claude_code
01_basic.py
02_full_features.py
03_coding_agent.py
browser
01_browser_agent.py
02_browser_tools_direct.py
03_connect_existing_browser.py
advanced
01_middleware.py
02_tracing.py
03_error_handling.py
04_cost_tracking.py
05_pipeline_customization.py
06_all_features.py