diff --git a/docs/overrides/partials/logo.html b/docs/overrides/partials/logo.html
new file mode 100644
index 0000000..b1deef6
--- /dev/null
+++ b/docs/overrides/partials/logo.html
@@ -0,0 +1,3 @@
+┌─┐┌─┐┬ ┌─┐┌─┐┌┬┐┌─┐┌─┐┬ ┌─┐
+└─┐├┤ │ ├┤ │ │ │ ││ ││ └─┐
+└─┘└─┘┴─┘└─┘└─┘ ┴ └─┘└─┘┴─┘└─┘
diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css
index b3c49a8..05fd84c 100644
--- a/docs/stylesheets/extra.css
+++ b/docs/stylesheets/extra.css
@@ -30,7 +30,39 @@
background: var(--md-primary-fg-color);
border-bottom: 1px solid rgba(255,255,255,0.06);
}
-.md-header__title { font-weight: 700; }
+
+/* Wordmark logo — terminal box-drawing art matching landing page */
+.wm { display: inline-flex; align-items: center; }
+.wm--3 {
+ font-family: 'JetBrains Mono', ui-monospace, monospace;
+ color: #22d3ee;
+ align-items: center;
+ vertical-align: middle;
+}
+.wm--3__banner {
+ display: block;
+ font-size: 5.5px;
+ line-height: 1;
+ letter-spacing: 0;
+ white-space: pre;
+ text-shadow: 0 0 6px rgba(34, 211, 238, 0.55);
+ margin: 0;
+ user-select: none;
+ filter: drop-shadow(0 0 2px rgba(34, 211, 238, 0.4));
+}
+@media (min-width: 720px) { .wm--3__banner { font-size: 6.5px; } }
+
+/* Size the logo container to fit the wordmark */
+.md-header__button.md-logo {
+ padding: 4px 8px 4px 0;
+}
+
+/* Hide site-name text — wordmark logo serves as primary brand mark.
+ Page title still appears on scroll (second .md-header__topic). */
+.md-header__title > .md-header__topic:first-child {
+ opacity: 0;
+ pointer-events: none;
+}
/* Tabs */
.md-tabs {
diff --git a/landing/examples/index.html b/landing/examples/index.html
index 5ceabda..39c85d2 100644
--- a/landing/examples/index.html
+++ b/landing/examples/index.html
@@ -15,7 +15,7 @@
body{background:var(--bg);color:var(--tx);font-family:var(--font);font-size:14px}
nav{position:sticky;top:0;z-index:50;background:rgba(15,23,42,0.85);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border-bottom:1px solid var(--bd);height:52px}
nav .w{max-width:960px;margin:0 auto;padding:0 20px;display:flex;align-items:center;justify-content:space-between;height:100%}
-.nl{font-weight:800;font-size:15px;color:#fff;text-decoration:none}.nl span{color:var(--dm);font-weight:500;margin-left:8px;font-size:13px}
+.wm{display:inline-flex;align-items:center}.wm--3{font-family:var(--mono);color:var(--exec-color);align-items:center;vertical-align:middle}.wm--3__banner{display:block;font-size:5.5px;line-height:1;letter-spacing:0;white-space:pre;text-shadow:0 0 6px var(--exec-glow);margin:0;user-select:none;filter:drop-shadow(0 0 2px rgba(34,211,238,0.4))}@media(min-width:720px){.wm--3__banner{font-size:6.5px}}.nav-logo{display:inline-flex;align-items:center;gap:8px;text-decoration:none}.nav-logo__sub{font-size:13px;color:var(--dm);font-weight:500}.vh{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.nr{display:flex;gap:20px;font-size:13px;color:var(--dm)}.nr a{color:inherit;text-decoration:none}.nr a:hover{color:#fff}
.ex-term{max-width:960px;margin:32px auto 24px;background:#0b1220;border:1px solid var(--bd);border-radius:14px;box-shadow:0 20px 60px -28px rgba(0,0,0,0.55),0 0 0 1px rgba(34,211,238,0.05);overflow:hidden}
.ex-term__bar{display:flex;align-items:center;gap:8px;padding:12px 16px;border-bottom:1px solid var(--bd);background:rgba(15,23,42,0.7)}
@@ -42,30 +42,46 @@
.ct{max-width:960px;margin:0 auto;padding:0 20px 16px;display:flex;flex-direction:column;gap:10px;position:sticky;top:52px;z-index:40;background:var(--bg);padding-top:10px}
.si{flex:1;background:var(--sf);border:1px solid var(--bd);border-radius:8px;padding:10px 14px;color:var(--tx);font-family:var(--font);font-size:14px;outline:none}
.si:focus{border-color:var(--cy);box-shadow:0 0 0 2px rgba(34,211,238,0.12)}.si::placeholder{color:var(--ft)}
-.ex-rail{display:flex;gap:2px;height:40px;border-radius:8px;overflow:hidden;border:1px solid var(--bd);background:rgba(30,41,59,0.4)}
-.ex-rail__seg{flex:var(--seg-weight,1) 1 0;min-width:56px;height:100%;display:flex;align-items:center;justify-content:center;gap:6px;font-family:var(--mono);font-size:12px;color:var(--dm);background:transparent;border:none;cursor:pointer;transition:background .15s,color .15s;position:relative;padding:0 8px;white-space:nowrap}
-.ex-rail__seg--all{flex:0 0 72px}
+.ex-search{position:relative;display:flex;align-items:center}
+.ex-search__glyph{position:absolute;left:14px;color:var(--ft);font-size:14px;pointer-events:none}
+.ex-search__kbd{position:absolute;right:12px;font-family:var(--mono);font-size:11px;color:var(--ft);background:rgba(100,116,139,0.15);padding:2px 6px;border-radius:4px;pointer-events:none}
+.ex-search .si{padding-left:36px;padding-right:36px}
+.ex-rail{display:flex;gap:2px;height:40px;border-radius:8px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;scroll-snap-type:x mandatory;border:1px solid var(--bd);background:rgba(30,41,59,0.4)}
+.ex-rail__seg{flex:0 0 auto;scroll-snap-align:start;height:100%;display:flex;align-items:center;justify-content:center;gap:5px;font-family:var(--mono);font-size:12px;color:var(--dm);background:transparent;border:none;cursor:pointer;transition:background .15s,color .15s;position:relative;padding:0 12px;white-space:nowrap}
+.ex-rail__seg--all{min-width:64px}
.ex-rail__seg:hover{background:rgba(34,211,238,0.08);color:var(--tx)}
.ex-rail__seg.on{background:rgba(34,211,238,0.12);color:var(--cy);box-shadow:inset 0 -2px 0 var(--exec-color)}
.ex-rail__name{font-size:12px}
.ex-rail__count{font-size:11px;color:var(--cy);opacity:0.75}
.ex-rail.in-view .ex-rail__seg{animation:exec-stamp 0.6s var(--exec-ease-soft) both;animation-delay:calc(var(--seg-index,0) * 80ms)}
-@media(max-width:640px){.ex-rail{overflow-x:auto;-webkit-overflow-scrolling:touch;scroll-snap-type:x mandatory;height:44px}.ex-rail__seg{flex:0 0 auto;min-width:80px;scroll-snap-align:start}}
+@media(max-width:640px){.ex-rail{height:44px}}
@media(prefers-reduced-motion:reduce){.ex-rail.in-view .ex-rail__seg{animation:none}}
.rc{font-family:var(--mono);font-size:11px;color:var(--ft);padding:2px 0}
.el{max-width:960px;margin:0 auto;padding:0 20px 60px;display:flex;flex-direction:column;gap:2px}
.ec{border:1px solid var(--bd);border-radius:8px;overflow:hidden;background:var(--sf);background-image:var(--gr);transition:border-color .15s}
.ec:hover{border-color:rgba(34,211,238,0.2)}.ec.op{border-color:rgba(34,211,238,0.3)}
-.eh{display:flex;align-items:center;gap:14px;padding:14px 18px;cursor:pointer;user-select:none}
-.en{font-family:var(--mono);font-size:12px;font-weight:500;color:var(--cy);min-width:24px;flex-shrink:0}
-.ei{flex:1;min-width:0}.et{font-weight:600;font-size:13px;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
-.ed{font-size:12px;color:var(--dm);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
-.em{display:flex;gap:8px;align-items:center;flex-shrink:0}
-.ek{font-family:var(--mono);font-size:10px;color:var(--ft);background:rgba(100,116,139,0.15);padding:2px 8px;border-radius:100px}
-.enk{font-family:var(--mono);font-size:10px;color:var(--gn);background:rgba(34,197,94,0.1);padding:2px 8px;border-radius:100px}
-.eln{font-family:var(--mono);font-size:10px;color:var(--ft)}
-.ev{font-size:10px;color:var(--ft);transition:transform .2s}.ec.op .ev{transform:rotate(180deg)}
+.ex-row{display:grid;grid-template-columns:32px 112px 54px 72px minmax(180px,1.5fr) minmax(0,3fr) 20px;align-items:center;gap:16px;padding:12px 18px;font-family:var(--mono);font-size:12px;cursor:pointer;user-select:none;transition:background-color .15s,border-left-color .15s;border-left:2px solid transparent}
+.ex-row:hover{background:rgba(34,211,238,0.04);border-left-color:var(--cy)}
+.ec.op .ex-row{background:rgba(34,211,238,0.06)}
+.ex-row__num{color:var(--cy);font-weight:500}
+.ex-row__perm{color:var(--ft)}
+.ex-row__size{color:var(--ft);text-align:right}
+.ex-row__key{font-size:10px;padding:2px 8px;border-radius:100px;text-align:center}
+.ex-row__key--free{color:var(--gn);background:rgba(34,197,94,0.1)}
+.ex-row__key--paid{color:var(--ft);background:rgba(100,116,139,0.15)}
+.ex-row__file{color:var(--cy);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
+.ex-row__desc{color:var(--tx);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
+.ex-row__chev{font-size:10px;color:var(--ft);transition:transform 0.22s var(--exec-ease-soft);text-align:center}
+.ec.op .ex-row__chev{transform:rotate(180deg)}
+.ex-row--enter{animation:ex-row-in 0.35s var(--exec-ease-soft) both;animation-delay:calc(var(--row-index,0) * 14ms)}
+@keyframes ex-row-in{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
+@media(max-width:640px){.ex-row{grid-template-columns:32px 1fr 20px;gap:8px 12px}.ex-row__num{grid-column:1;grid-row:1 / 3;align-self:start}.ex-row__perm{display:none}.ex-row__file{grid-column:2;grid-row:1}.ex-row__chev{grid-column:3;grid-row:1 / 3;align-self:start}.ex-row__size{grid-column:2;grid-row:2;display:inline;margin-right:8px;color:var(--ft)}.ex-row__key{grid-column:2;grid-row:2;display:inline;margin-right:8px}.ex-row__desc{grid-column:2;grid-row:2;display:inline;color:var(--dm)}}
+@media(prefers-reduced-motion:reduce){.ex-row--enter{animation:none}.ex-row__chev{transition-duration:0.01s}}
+.ex-rail__seg:focus-visible{outline:2px solid var(--cy);outline-offset:2px}
+.ex-row:focus-visible{outline:2px solid var(--cy);outline-offset:2px}
.eb{padding:0 18px 18px}.eg{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:12px}
+.ex-cat-prefix{font-family:var(--mono);font-size:11px;color:var(--ft);padding:0 0 10px;user-select:text}
+.ex-cat-prefix__glyph{color:var(--gn);margin-right:6px}
.ec1{font-family:var(--mono);font-size:10px;padding:3px 8px;border-radius:4px;background:rgba(59,130,246,0.1);color:#93c5fd;text-decoration:none;transition:background .12s}
a.ec1:hover{background:rgba(59,130,246,0.2);color:#bfdbfe}
.ea{display:flex;gap:8px;margin-bottom:12px}
@@ -92,7 +108,9 @@
-
01
Hello World — Your first Selectools agent
No API key needed. Runs entirely offline with the built-in LocalProvider.
No Key46L
▼
-
02
Search and Weather tools with ToolRegistry and @tool
No API key needed — runs with the built-in LocalProvider.
No Key69L
▼
-
03
Pre-built Toolbox — 22 ready-made tools for files, data, text, datetime, and web
No API key needed for exploring tool schemas.
No Key205L
▼
-
04
Multi-turn Conversation Memory with automatic context preservation
API Key89L
▼
-
05
Cost Tracking — token counting, cost estimation, and usage summaries
API Key133L
▼
-
06
Async Agent — arun(), concurrent agents, and FastAPI integration patterns
API Key194L
▼
-
07
Streaming Tools — Generator-based progressive output for long-running operations
No Key354L
▼
-
08
Streaming and Parallel Tool Execution — astream(), asyncio.gather, StreamChunk
API Key315L
▼
-
09
Response Caching — InMemoryCache (LRU+TTL) and RedisCache for avoiding redundant LLM calls
API Key219L
▼
-
10
Routing Mode — Agent selects a tool without executing it. Intent classification
API Key312L
▼
-
11
Tool Usage Analytics — call counts, success rates, timing, cost attribution
API Key341L
▼
-
12
Observability Hooks — lifecycle callbacks and tool validation at registration time
NOTE: For production observability (Langfuse, Datadog, OpenTelemetry), prefer the class-based AgentObserver protocol introduced in v0.14.0. It provides
No Key300L
▼
-
13
Dynamic Tools — ToolLoader, plugin directories, hot-reload, runtime tool management
No Key220L
▼
-
14
Basic RAG — document loading, chunking, embedding, vector search, and question answering
API Key157L
▼
-
15
Semantic Search — pure embedding-based search with metadata filtering
API Key339L
▼
-
16
Advanced RAG — PDFs, SQLite persistent storage, custom chunking, metadata filtering
API Key328L
▼
-
17
Multi-Provider RAG Comparison — compare embeddings, stores, and chunk sizes across providers
Optional: ANTHROPIC_API_KEY, GOOGLE_API_KEY for cross-provider comparisons
API Key536L
▼
-
18
Hybrid Search — BM25 keyword + vector semantic search with RRF/weighted fusion and reranking
API Key270L
▼
-
19
Advanced Chunking — SemanticChunker (embedding-based) and ContextualChunker (LLM-enriched)
API Key224L
▼
-
20
Customer Support Bot — multi-tool workflow combining search, ticketing, and escalation
API Key547L
▼
-
21
Data Analysis Agent — data exploration, filtering, aggregation, and visualization tools
API Key820L
▼
-
22
Ollama Local Model — run agents with fully local LLMs via Ollama. No cloud API needed
API Key253L
▼
-
23
Structured Output — Get typed, validated responses from the LLM
Demonstrates: 1. Pydantic BaseModel as response_format
API Key243L
▼
-
24
Execution Traces & Reasoning Visibility — See exactly what the agent did and why
Demonstrates: 1. result.trace with TraceStep timeline
API Key246L
▼
-
25
Provider Fallback — Automatic failover between LLM providers
Demonstrates: 1. FallbackProvider with priority ordering
API Key250L
▼
-
26
Batch Processing — Classify multiple requests concurrently
Demonstrates: 1. agent.batch() for sync concurrent processing
API Key263L
▼
-
27
Tool Policy & Human-in-the-Loop — Control which tools the agent can execute
Demonstrates: 1. ToolPolicy with allow/review/deny rules
API Key308L
▼
-
28
AgentObserver Protocol — structured lifecycle observability for production
Demonstrates: 1. Custom AgentObserver subclass with run_id/call_id correlation
API Key363L
▼
-
29
Guardrails Engine
Demonstrates input and output guardrails for content validation, PII redaction, topic blocking, and format enforcement.
No Key155L
▼
-
30
Audit Logging
Demonstrates JSONL audit logging with privacy controls and daily file rotation.
No Key88L
▼
-
31
Tool Output Screening
Demonstrates prompt injection detection in tool outputs, both per-tool and global screening.
API Key109L
▼
-
32
Coherence Checking
Demonstrates LLM-based intent verification that catches tool calls diverging from the user's original request (prompt injection defence).
API Key128L
▼
-
33
Persistent Sessions — Save and restore conversation memory across agent instances
Demonstrates JsonFileSessionStore: the agent's conversation history is persisted to disk and restored when a new agent is created with the same session_id.
No Key71L
▼
-
34
Summarize-on-Trim — Automatically summarize old messages when memory is trimmed
When the conversation exceeds max_messages, the oldest messages are removed. With summarize_on_trim=True the agent asks an LLM to condense them into a
No Key70L
▼
-
35
Entity Memory — Extract and track named entities across conversation turns
EntityMemory merges entities into a deduplicated registry and builds a context block for the system prompt. This example manually feeds entities to demonstrate
No Key78L
▼
-
36
Knowledge Graph Memory — Track relationship triples across conversation turns
KnowledgeGraphMemory stores subject-relation-object triples in a TripleStore. Relevant triples are queried each turn and injected into the system prompt.
No Key81L
▼
-
37
Knowledge Memory — Persistent cross-session facts with daily logs
KnowledgeMemory stores daily log entries and persistent facts in MEMORY.md. When configured on an agent, a ``remember`` tool is auto-registered and the
No Key79L
▼
-
38
Example 38 — Terminal Tools and Stop Conditions
Demonstrates how to stop the agent loop after a specific tool fires, without making another LLM call. Two mechanisms:
No Key139L
▼
-
39
Built-in Eval Framework
==================================== Evaluate your agent's accuracy, tool use, latency, cost, and safety
No Key166L
▼
-
40
Advanced Eval — A/B Testing, LLM Judges, Snapshots, Badges
====================================================================== Showcases advanced eval features:
No Key188L
▼
-
41
MCP Client — Connect to MCP Tool Servers
===================================================== Use tools from any MCP-compatible server in your selectools agent.
No Key127L
▼
-
42
MCP Server — Expose Selectools Tools as MCP
======================================================== Turn any selectools @tool function into an MCP-compliant server.
API Key80L
▼
-
43
Token Budget Per Run — stop agents before they burn money
Demonstrates: - max_total_tokens: hard limit on cumulative tokens
API Key165L
▼
-
44
Agent Cancellation — cooperative stopping from any thread
Demonstrates: - CancellationToken for cooperative cancellation
API Key203L
▼
-
45
Per-Tool Approval Gate — require human approval for dangerous tools
Demonstrates: - @tool(requires_approval=True) decorator flag
API Key212L
▼
-
46
SimpleStepObserver — single callback for all agent events
Demonstrates: - SimpleStepObserver routes 31 events to one function
API Key178L
▼
-
47
Token Estimation — estimate costs before running an agent
Demonstrates: - estimate_tokens() for single strings
API Key136L
▼
-
48
Model Switching — use different models per iteration
Demonstrates: - model_selector callback on AgentConfig
API Key202L
▼
-
49
Knowledge Memory Stores — persistent knowledge with importance and TTL
Demonstrates: - KnowledgeMemory with SQLiteKnowledgeStore backend
API Key188L
▼
-
50
Reasoning Strategies — ReAct, Chain-of-Thought, and Plan-Then-Act
Demonstrates: - reasoning_strategy="react" — Thought → Action → Observation cycle
API Key132L
▼
-
51
Tool Result Caching — avoid re-executing expensive tools
Demonstrates: - @tool(cacheable=True) — cache tool results by name + args
API Key93L
▼
-
52
Semantic Cache — serve LLM responses for similar (not just identical) queries
Demonstrates: - SemanticCache as a drop-in replacement for InMemoryCache
API Key204L
▼
-
53
Prompt Compression — prevent context-window overflow in long conversations
Demonstrates: - compress_context=True — enable proactive context compression
API Key264L
▼
-
54
Conversation Branching — fork conversation history for A/B exploration
Demonstrates: - ConversationMemory.branch() — snapshot memory for safe experimentation
API Key203L
▼
-
55
Linear AgentGraph pipeline
Demonstrates a simple 3-node linear graph: planner → writer → reviewer → END
No Key64L
▼
-
56
Parallel fan-out with AgentGraph
Demonstrates parallel execution of multiple agents with state merging: entry → [researcher_a, researcher_b, researcher_c] → summarizer → END
No Key66L
▼
-
57
Conditional routing with AgentGraph
Demonstrates conditional edges with path_map validation: drafter → router → (revise | publish) → END
No Key71L
▼
-
58
Human-in-the-loop with AgentGraph
Demonstrates generator nodes with yield InterruptRequest: - Graph pauses at reviewer node
No Key109L
▼
-
59
Checkpointing with AgentGraph
Demonstrates durable mid-graph persistence using FileCheckpointStore: - Save checkpoints after each node
No Key107L
▼
-
60
SupervisorAgent with multiple coordination strategies
Demonstrates all four supervisor strategies: - plan_and_execute: LLM generates a plan, then executes each step
No Key124L
▼
-
61
Nested subgraphs with AgentGraph
Demonstrates SubgraphNode — an AgentGraph embedded as a node in another graph. Uses input_map and output_map for explicit state key translation.
No Key84L
▼
-
62
Loading an Agent from YAML config
Demonstrates the structured AgentConfig workflow (v0.19.0): - Write a YAML config file describing the agent
No Key101L
▼
-
63
Agent Templates
Demonstrates the template system (v0.19.0): - List available built-in templates
No Key165L
▼
-
64
Serving an Agent over HTTP
Demonstrates the `selectools serve` pattern (v0.19.0): - Create an agent with tools
No Key183L
▼
-
65
Tool Composition with compose()
Demonstrates composing multiple tools into a single composite tool (v0.19.0): - Define individual tools with @tool()
No Key122L
▼
-
66
Streaming Pipeline with astream()
Demonstrates pipeline streaming (v0.19.0): - Build a multi-step pipeline with @step
API Key132L
▼
-
67
Type-Safe Pipeline Contracts
Demonstrates type-safe step contracts in pipelines (v0.19.0): - Steps infer input/output types from type hints
API Key137L
▼
-
68
PostgresCheckpointStore for AgentGraph
Demonstrates using PostgreSQL as a checkpoint backend (v0.19.0): - Create a PostgresCheckpointStore with a connection string
API Key158L
▼
-
69
Trace Storage and Querying
Demonstrates saving and querying agent traces (v0.19.0): - InMemoryTraceStore for development
No Key369L
▼
-
70
PlanAndExecuteAgent
The planner Agent generates a JSON execution plan. Executor agents handle each step in sequence. Results are aggregated into a final output.
No Key107L
▼
-
71
ReflectiveAgent
The actor Agent produces an initial draft. The critic Agent evaluates it and provides feedback. The actor revises based on the critique. This cycle repeats
No Key107L
▼
-
72
DebateAgent
Multiple agents argue opposing positions over max_rounds rounds. Each agent sees the prior round transcript so they can respond to each other. A judge
No Key123L
▼
-
73
TeamLeadAgent
The lead Agent generates a subtask plan and delegates to team members. Three delegation strategies are demonstrated:
No Key199L
▼
-
74
trace_to_html — HTML Trace Viewer
Renders an AgentTrace as a standalone HTML waterfall timeline. No external dependencies — the output is a single self-contained HTML file.
No Key66L
▼
-
75
Stability Markers — @stable, @beta, @deprecated
The stability module provides three decorators for annotating the public API stability of any class or function.
API Key112L
▼
-
76
Visual Agent Builder (v0.20.0)
topology in a browser, generate Python or YAML, copy or download. Start the builder with one command (no config file needed):
API Key39L
▼
-
77
FAISS Vector Store -- fast local similarity search with persistence
No API key needed. Uses FAISS (Facebook AI Similarity Search) for high-performance local vector search. Supports save/load to disk.
API Key49L
▼
-
78
Qdrant Vector Store -- production vector search with metadata filtering
Qdrant is a high-performance vector database with advanced filtering. This example shows the API pattern (requires a running Qdrant server).
API Key46L
▼
-
79
pgvector Store -- PostgreSQL-native vector search
Use your existing PostgreSQL database for vector similarity search. No additional database infrastructure needed.
API Key43L
▼
-
80
Document Loaders -- CSV, JSON, HTML, URL loading
No API key needed. Demonstrates all new document loader methods.
API Key76L
▼
-
81
Multimodal Messages -- send images to your agent
No API key needed for this demo. Shows how to create messages with images for vision-enabled models (GPT-4o, Claude 3.5, Gemini).
API Key57L
▼
-
82
Code Execution Tools -- run Python and shell commands from agents
No API key needed. Demonstrates the execute_python and execute_shell tools. WARNING: These tools execute code on your local machine. Do not use with
API Key64L
▼
-
83
Web Search Tools -- search the web and scrape URLs
No API key needed. Uses DuckDuckGo for search (no rate limits for moderate use).
API Key52L
▼
-
84
GitHub Tools -- search repos, read files, list issues from agents
No API key needed (optional GITHUB_TOKEN increases rate limit from 60 to 5000/hr). Read-only operations only.
API Key53L
▼
-
85
Database Query Tools -- SQL queries from agents (read-only)
No API key needed. Creates a sample SQLite database and queries it. Also supports PostgreSQL with psycopg2.
API Key88L
▼
-
86
Azure OpenAI Provider -- use OpenAI models via Azure endpoints
Requires: AZURE_OPENAI_ENDPOINT and AZURE_OPENAI_API_KEY env vars.
API Key52L
▼
-
87
OpenTelemetry Observer -- send agent traces to Datadog, Jaeger, Grafana
Maps selectools observer events to OTel GenAI semantic convention spans. Works with any OTel-compatible backend.
API Key56L
▼
-
88
Langfuse Observer -- send agent traces to Langfuse for LLM observability
Langfuse is the most popular open-source LLM observability platform. Traces include LLM calls, tool executions, costs, and latencies.
API Key59L
▼
+
01-rw-r--r--46Lno-keyhello_world.pyNo API key needed. Runs entirely offline with the built-in LocalProvider.▾
$cat examples/01_hello_world.py
+
02-rw-r--r--69Lno-keysearch_weather.pyNo API key needed — runs with the built-in LocalProvider.▾
$cat examples/02_search_weather.py
+
03-rw-r--r--205Lno-keytoolbox.pyNo API key needed for exploring tool schemas.▾
$cat examples/03_toolbox.py
+
04-rw-r--r--89Lapi-keyconversation_memory.pyMulti-turn Conversation Memory with automatic context preservation▾
$cat examples/04_conversation_memory.py
+
05-rw-r--r--133Lapi-keycost_tracking.pyCost Tracking — token counting, cost estimation, and usage summaries▾
$cat examples/05_cost_tracking.py
+
06-rw-r--r--194Lapi-keyasync_agent.pyAsync Agent — arun(), concurrent agents, and FastAPI integration patterns▾
$cat examples/06_async_agent.py
+
07-rw-r--r--354Lno-keystreaming_tools.pyStreaming Tools — Generator-based progressive output for long-running operations▾
$cat examples/07_streaming_tools.py
+
08-rw-r--r--315Lapi-keystreaming_parallel.pyStreaming and Parallel Tool Execution — astream(), asyncio.gather, StreamChunk▾
$cat examples/08_streaming_parallel.py
+
09-rw-r--r--219Lapi-keycaching.pyResponse Caching — InMemoryCache (LRU+TTL) and RedisCache for avoiding redundant LLM calls▾
$cat examples/09_caching.py
+
10-rw-r--r--312Lapi-keyrouting_mode.pyRouting Mode — Agent selects a tool without executing it. Intent classification▾
$cat examples/10_routing_mode.py
+
11-rw-r--r--341Lapi-keytool_analytics.pyTool Usage Analytics — call counts, success rates, timing, cost attribution▾
$cat examples/11_tool_analytics.py
+
12-rw-r--r--300Lno-keyobservability_hooks.pyNOTE: For production observability (Langfuse, Datadog, OpenTelemetry), prefer the class-based AgentObserver protocol introduced in v0.14.0. It provides▾
$cat examples/12_observability_hooks.py
+
13-rw-r--r--220Lno-keydynamic_tools.pyDynamic Tools — ToolLoader, plugin directories, hot-reload, runtime tool management▾
$cat examples/13_dynamic_tools.py
+
14-rw-r--r--157Lapi-keyrag_basic.pyBasic RAG — document loading, chunking, embedding, vector search, and question answering▾
$cat examples/14_rag_basic.py
+
15-rw-r--r--339Lapi-keysemantic_search.pySemantic Search — pure embedding-based search with metadata filtering▾
$cat examples/15_semantic_search.py
+
16-rw-r--r--328Lapi-keyrag_advanced.pyAdvanced RAG — PDFs, SQLite persistent storage, custom chunking, metadata filtering▾
$cat examples/16_rag_advanced.py
+
17-rw-r--r--536Lapi-keyrag_multi_provider.pyOptional: ANTHROPIC_API_KEY, GOOGLE_API_KEY for cross-provider comparisons▾
$cat examples/17_rag_multi_provider.py
+
18-rw-r--r--270Lapi-keyhybrid_search.pyHybrid Search — BM25 keyword + vector semantic search with RRF/weighted fusion and reranking▾
$cat examples/18_hybrid_search.py
+
19-rw-r--r--224Lapi-keyadvanced_chunking.pyAdvanced Chunking — SemanticChunker (embedding-based) and ContextualChunker (LLM-enriched)▾
$cat examples/19_advanced_chunking.py
+
20-rw-r--r--547Lapi-keycustomer_support_bot.pyCustomer Support Bot — multi-tool workflow combining search, ticketing, and escalation▾
$cat examples/20_customer_support_bot.py
+
21-rw-r--r--820Lapi-keydata_analysis_agent.pyData Analysis Agent — data exploration, filtering, aggregation, and visualization tools▾
$cat examples/21_data_analysis_agent.py
+
22-rw-r--r--253Lapi-keyollama_local.pyOllama Local Model — run agents with fully local LLMs via Ollama. No cloud API needed▾
$cat examples/22_ollama_local.py
+
23-rw-r--r--243Lapi-keystructured_output.pyDemonstrates: 1. Pydantic BaseModel as response_format▾
$cat examples/23_structured_output.py
+
24-rw-r--r--246Lapi-keytraces_and_reasoning.pyDemonstrates: 1. result.trace with TraceStep timeline▾
$cat examples/24_traces_and_reasoning.py
+
25-rw-r--r--250Lapi-keyprovider_fallback.pyDemonstrates: 1. FallbackProvider with priority ordering▾
$cat examples/25_provider_fallback.py
+
26-rw-r--r--263Lapi-keybatch_processing.pyDemonstrates: 1. agent.batch() for sync concurrent processing▾
$cat examples/26_batch_processing.py
+
27-rw-r--r--308Lapi-keytool_policy.pyDemonstrates: 1. ToolPolicy with allow/review/deny rules▾
$cat examples/27_tool_policy.py
+
28-rw-r--r--363Lapi-keyagent_observer.pyDemonstrates: 1. Custom AgentObserver subclass with run_id/call_id correlation▾
$cat examples/28_agent_observer.py
+
29-rw-r--r--155Lno-keyguardrails.pyDemonstrates input and output guardrails for content validation, PII redaction, topic blocking, and format enforcement.▾
$cat examples/29_guardrails.py
+
30-rw-r--r--88Lno-keyaudit_logging.pyDemonstrates JSONL audit logging with privacy controls and daily file rotation.▾
$cat examples/30_audit_logging.py
+
31-rw-r--r--109Lapi-keytool_output_screening.pyDemonstrates prompt injection detection in tool outputs, both per-tool and global screening.▾
$cat examples/31_tool_output_screening.py
+
32-rw-r--r--128Lapi-keycoherence_checking.pyDemonstrates LLM-based intent verification that catches tool calls diverging from the user's original request (prompt injection defence).▾
$cat examples/32_coherence_checking.py
+
33-rw-r--r--71Lno-keypersistent_sessions.pyDemonstrates JsonFileSessionStore: the agent's conversation history is persisted to disk and restored when a new agent is created with the same session_id.▾
$cat examples/33_persistent_sessions.py
+
34-rw-r--r--70Lno-keysummarize_on_trim.pyWhen the conversation exceeds max_messages, the oldest messages are removed. With summarize_on_trim=True the agent asks an LLM to condense them into a▾
$cat examples/34_summarize_on_trim.py
+
35-rw-r--r--78Lno-keyentity_memory.pyEntityMemory merges entities into a deduplicated registry and builds a context block for the system prompt. This example manually feeds entities to demonstrate▾
$cat examples/35_entity_memory.py
+
36-rw-r--r--81Lno-keyknowledge_graph.pyKnowledgeGraphMemory stores subject-relation-object triples in a TripleStore. Relevant triples are queried each turn and injected into the system prompt.▾
$cat examples/36_knowledge_graph.py
+
37-rw-r--r--79Lno-keyknowledge_memory.pyKnowledgeMemory stores daily log entries and persistent facts in MEMORY.md. When configured on an agent, a ``remember`` tool is auto-registered and the▾
$cat examples/37_knowledge_memory.py
+
38-rw-r--r--139Lno-keyterminal_tools.pyDemonstrates how to stop the agent loop after a specific tool fires, without making another LLM call. Two mechanisms:▾
$cat examples/38_terminal_tools.py
+
39-rw-r--r--166Lno-keyeval_framework.py==================================== Evaluate your agent's accuracy, tool use, latency, cost, and safety▾
$cat examples/39_eval_framework.py
+
40-rw-r--r--188Lno-keyeval_advanced.py====================================================================== Showcases advanced eval features:▾
$cat examples/40_eval_advanced.py
+
41-rw-r--r--127Lno-keymcp_client.py===================================================== Use tools from any MCP-compatible server in your selectools agent.▾
$cat examples/41_mcp_client.py
+
42-rw-r--r--80Lapi-keymcp_server.py======================================================== Turn any selectools @tool function into an MCP-compliant server.▾
$cat examples/42_mcp_server.py
+
43-rw-r--r--165Lapi-keytoken_budget.pyDemonstrates: - max_total_tokens: hard limit on cumulative tokens▾
$cat examples/43_token_budget.py
+
44-rw-r--r--203Lapi-keycancellation.pyDemonstrates: - CancellationToken for cooperative cancellation▾
$cat examples/44_cancellation.py
+
45-rw-r--r--212Lapi-keyapproval_gate.pyDemonstrates: - @tool(requires_approval=True) decorator flag▾
$cat examples/45_approval_gate.py
+
46-rw-r--r--178Lapi-keysimple_observer.pyDemonstrates: - SimpleStepObserver routes 31 events to one function▾
$cat examples/46_simple_observer.py
+
47-rw-r--r--136Lapi-keytoken_estimation.pyDemonstrates: - estimate_tokens() for single strings▾
$cat examples/47_token_estimation.py
+
48-rw-r--r--202Lapi-keymodel_switching.pyDemonstrates: - model_selector callback on AgentConfig▾
$cat examples/48_model_switching.py
+
49-rw-r--r--188Lapi-keyknowledge_stores.pyDemonstrates: - KnowledgeMemory with SQLiteKnowledgeStore backend▾
$cat examples/49_knowledge_stores.py
+
50-rw-r--r--132Lapi-keyreasoning_strategies.pyDemonstrates: - reasoning_strategy="react" — Thought → Action → Observation cycle▾
$cat examples/50_reasoning_strategies.py
+
51-rw-r--r--93Lapi-keytool_result_caching.pyDemonstrates: - @tool(cacheable=True) — cache tool results by name + args▾
$cat examples/51_tool_result_caching.py
+
52-rw-r--r--204Lapi-keysemantic_cache.pyDemonstrates: - SemanticCache as a drop-in replacement for InMemoryCache▾
$cat examples/52_semantic_cache.py
+
53-rw-r--r--264Lapi-keyprompt_compression.pyDemonstrates: - compress_context=True — enable proactive context compression▾
$cat examples/53_prompt_compression.py
+
54-rw-r--r--203Lapi-keyconversation_branching.pyDemonstrates: - ConversationMemory.branch() — snapshot memory for safe experimentation▾
$cat examples/54_conversation_branching.py
+
55-rw-r--r--64Lno-keyagent_graph_linear.pyDemonstrates a simple 3-node linear graph: planner → writer → reviewer → END▾
$cat examples/55_agent_graph_linear.py
+
56-rw-r--r--66Lno-keyagent_graph_parallel.pyDemonstrates parallel execution of multiple agents with state merging: entry → [researcher_a, researcher_b, researcher_c] → summarizer → END▾
$cat examples/56_agent_graph_parallel.py
+
57-rw-r--r--71Lno-keyagent_graph_conditional.pyDemonstrates conditional edges with path_map validation: drafter → router → (revise | publish) → END▾
$cat examples/57_agent_graph_conditional.py
+
58-rw-r--r--109Lno-keyagent_graph_hitl.pyDemonstrates generator nodes with yield InterruptRequest: - Graph pauses at reviewer node▾
$cat examples/58_agent_graph_hitl.py
+
59-rw-r--r--107Lno-keyagent_graph_checkpointing.pyDemonstrates durable mid-graph persistence using FileCheckpointStore: - Save checkpoints after each node▾
$cat examples/59_agent_graph_checkpointing.py
+
60-rw-r--r--124Lno-keysupervisor_agent.pyDemonstrates all four supervisor strategies: - plan_and_execute: LLM generates a plan, then executes each step▾
$cat examples/60_supervisor_agent.py
+
61-rw-r--r--84Lno-keyagent_graph_subgraph.pyDemonstrates SubgraphNode — an AgentGraph embedded as a node in another graph. Uses input_map and output_map for explicit state key translation.▾
$cat examples/61_agent_graph_subgraph.py
+
62-rw-r--r--101Lno-keyyaml_config.pyDemonstrates the structured AgentConfig workflow (v0.19.0): - Write a YAML config file describing the agent▾
$cat examples/62_yaml_config.py
+
63-rw-r--r--165Lno-keyagent_templates.pyDemonstrates the template system (v0.19.0): - List available built-in templates▾
$cat examples/63_agent_templates.py
+
64-rw-r--r--183Lno-keyselectools_serve.pyDemonstrates the `selectools serve` pattern (v0.19.0): - Create an agent with tools▾
$cat examples/64_selectools_serve.py
+
65-rw-r--r--122Lno-keytool_composition.pyDemonstrates composing multiple tools into a single composite tool (v0.19.0): - Define individual tools with @tool()▾
$cat examples/65_tool_composition.py
+
66-rw-r--r--132Lapi-keystreaming_pipeline.pyDemonstrates pipeline streaming (v0.19.0): - Build a multi-step pipeline with @step▾
$cat examples/66_streaming_pipeline.py
+
67-rw-r--r--137Lapi-keytype_safe_pipeline.pyDemonstrates type-safe step contracts in pipelines (v0.19.0): - Steps infer input/output types from type hints▾
$cat examples/67_type_safe_pipeline.py
+
68-rw-r--r--158Lapi-keypostgres_checkpoints.pyDemonstrates using PostgreSQL as a checkpoint backend (v0.19.0): - Create a PostgresCheckpointStore with a connection string▾
$cat examples/68_postgres_checkpoints.py
+
69-rw-r--r--369Lno-keytrace_store.pyDemonstrates saving and querying agent traces (v0.19.0): - InMemoryTraceStore for development▾
$cat examples/69_trace_store.py
+
70-rw-r--r--107Lno-keyplan_and_execute.pyThe planner Agent generates a JSON execution plan. Executor agents handle each step in sequence. Results are aggregated into a final output.▾
$cat examples/70_plan_and_execute.py
+
71-rw-r--r--107Lno-keyreflective_agent.pyThe actor Agent produces an initial draft. The critic Agent evaluates it and provides feedback. The actor revises based on the critique. This cycle repeats▾
$cat examples/71_reflective_agent.py
+
72-rw-r--r--123Lno-keydebate_agent.pyMultiple agents argue opposing positions over max_rounds rounds. Each agent sees the prior round transcript so they can respond to each other. A judge▾
$cat examples/72_debate_agent.py
+
73-rw-r--r--199Lno-keyteam_lead_agent.pyThe lead Agent generates a subtask plan and delegates to team members. Three delegation strategies are demonstrated:▾
$cat examples/73_team_lead_agent.py
+
74-rw-r--r--66Lno-keytrace_to_html.pyRenders an AgentTrace as a standalone HTML waterfall timeline. No external dependencies — the output is a single self-contained HTML file.▾
$cat examples/74_trace_to_html.py
+
75-rw-r--r--112Lapi-keystability_markers.pyThe stability module provides three decorators for annotating the public API stability of any class or function.▾
$cat examples/75_stability_markers.py
+
76-rw-r--r--39Lapi-keyvisual_builder.pytopology in a browser, generate Python or YAML, copy or download. Start the builder with one command (no config file needed):▾
$cat examples/76_visual_builder.py
+
77-rw-r--r--49Lapi-keyfaiss_vector_store.pyNo API key needed. Uses FAISS (Facebook AI Similarity Search) for high-performance local vector search. Supports save/load to disk.▾
$cat examples/77_faiss_vector_store.py
+
78-rw-r--r--46Lapi-keyqdrant_vector_store.pyQdrant is a high-performance vector database with advanced filtering. This example shows the API pattern (requires a running Qdrant server).▾
$cat examples/78_qdrant_vector_store.py
+
79-rw-r--r--43Lapi-keypgvector_store.pyUse your existing PostgreSQL database for vector similarity search. No additional database infrastructure needed.▾
$cat examples/79_pgvector_store.py
+
80-rw-r--r--76Lapi-keydocument_loaders.pyNo API key needed. Demonstrates all new document loader methods.▾
$cat examples/80_document_loaders.py
+
81-rw-r--r--57Lapi-keymultimodal_messages.pyNo API key needed for this demo. Shows how to create messages with images for vision-enabled models (GPT-4o, Claude 3.5, Gemini).▾
$cat examples/81_multimodal_messages.py
+
82-rw-r--r--64Lapi-keycode_execution.pyNo API key needed. Demonstrates the execute_python and execute_shell tools. WARNING: These tools execute code on your local machine. Do not use with▾
$cat examples/82_code_execution.py
+
83-rw-r--r--52Lapi-keyweb_search.pyNo API key needed. Uses DuckDuckGo for search (no rate limits for moderate use).▾
$cat examples/83_web_search.py
+
84-rw-r--r--53Lapi-keygithub_tools.pyNo API key needed (optional GITHUB_TOKEN increases rate limit from 60 to 5000/hr). Read-only operations only.▾
$cat examples/84_github_tools.py
+
85-rw-r--r--88Lapi-keydatabase_query.pyNo API key needed. Creates a sample SQLite database and queries it. Also supports PostgreSQL with psycopg2.▾
$cat examples/85_database_query.py
+
86-rw-r--r--52Lapi-keyazure_openai.pyRequires: AZURE_OPENAI_ENDPOINT and AZURE_OPENAI_API_KEY env vars.▾
$cat examples/86_azure_openai.py
+
87-rw-r--r--56Lapi-keyotel_observer.pyMaps selectools observer events to OTel GenAI semantic convention spans. Works with any OTel-compatible backend.▾
$cat examples/87_otel_observer.py
+
88-rw-r--r--59Lapi-keylangfuse_observer.pyLangfuse is the most popular open-source LLM observability platform. Traces include LLM calls, tool executions, costs, and latencies.▾
$cat examples/88_langfuse_observer.py