Skip to content

Latest commit

 

History

History

examples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Examples

Examples are grouped by the main API surface they demonstrate.

  • apps/ contains end-to-end demos.
  • agents/ contains agent loops, tools, hooks, and MCP examples.
  • media/ contains image, video, speech, transcription, multimodal, embedding, and reranking examples.
  • models/ contains model streaming, structured output, and provider examples.
  • external/ contains examples that use coding-agent CLIs (Claude Code, Codex, fx, pi) where a model goes (experimental; run with run-examples.py --external).

Provider-specific model examples live under models/<provider>/, such as models/gateway/, models/openai/, models/anthropic/, and models/typesafe/.

Directory Examples Guide
agents Basic, custom loop, subagent, content tool, streaming tool Agents
agents Tool approval, custom hook, MCP, telemetry Tools
media Embeddings, image edit, image generation, inline image, multimodal input, reranking, speech, transcription, video Model operations
models Connection check, buffered generation, prompt caching, streaming, structured output Streaming
models/gateway Web search, decisions, Jev Python AST, model parameters, streaming Providers
models/openai Image decisions, explicit client, Chat Completions, streaming Providers
models/anthropic, models/typesafe Anthropic web search, Anthropic streaming, TypeSafe image decisions Providers

Single-file examples use the root environment: uv run examples/agents/basic.py. Live examples need the API keys named in their source. Follow each app's README for its services and dependencies. To test an app against this checkout, add --with-editable /absolute/path/to/ai-python to its uv run command.

models/gateway/jev_python_ast.py uses Jev to build Python code through typed AST choices, with a live terminal preview and streamed prompt expansion and review. Set AI_GATEWAY_API_KEY and run it with uv run python examples/models/gateway/jev_python_ast.py. Set MODEL_ID to override the expansion/review model.