Skip to content

Examples

Run curated, copy‑paste examples (5–15 minutes end‑to‑end). Requires Python 3.10+ and pip install alloy-ai (or -e '.[dev]' for the repo). Set a provider key; ALLOY_BACKEND=fake is optional for offline demos.


Quick Decision Guide

"I want to…"

Run

  • Each example is a standalone script: python examples/<category>/<file>.py
  • Offline mode: export ALLOY_BACKEND=fake for deterministic demo outputs.

Browse by Category

  • Exploration: examples/00-explore/
  • Commands: examples/10-commands/
  • Typed outputs: examples/20-typed/
  • Tools: examples/30-tools/
  • Contracts: examples/40-contracts/
  • Composition: examples/50-composition/
  • Integration: examples/60-integration/
  • Providers: examples/70-providers/
  • Patterns: examples/80-patterns/
  • Advanced: examples/90-advanced/

Browse on GitHub

Tips

  • Read the Common Pitfalls for quick wins (streaming limits, typed outputs, tool loops).