Single-feature demos that explain core enzu behaviors.
Enzu's key differentiator: budgets are enforced, not suggested. When you set a token limit, enzu guarantees you won't exceed it.
budget_hardstop_demo.py - The definitive budget enforcement demo
Asks for a 500-word essay with only 50 tokens of budget. Shows how enzu:
- Enforces the limit absolutely
- Returns partial results when budget exhausted
- Provides detailed accounting breakdown
Quick proofs of budget behavior:
| Example | What It Shows |
|---|---|
minimal_budget_clamp.py |
Output gets clamped at budget limit |
minimal_budget_exceeded.py |
BUDGET_EXCEEDED outcome with partial results |
minimal_p95_logging.py |
Collect metrics across runs |
Different ways to cap costs:
| Example | Budget Type | Use Case |
|---|---|---|
budget_cap_total_tokens.py |
Total tokens | Predictable token accounting |
budget_cap_seconds.py |
Elapsed time | Response time SLAs |
budget_cap_cost_openrouter.py |
USD cost | Direct cost control |
typed_outcomes_demo.py - All possible outcomes and how to handle them
Enzu returns deterministic outcomes:
SUCCESS- Task completed within budgetBUDGET_EXCEEDED- Hit budget limit, may have partial resultTIMEOUT- Time limit exceededPROVIDER_ERROR- API failureVERIFICATION_FAILED- Output didn't meet criteria
chat_with_budget.py - Chat mode with budget constraints
Shows SuccessCriteria with required_substrings for validation.
Ready for production patterns? See ../production/ for sessions, async jobs, and real-world applications.