Overview
End-to-end runnable scripts demonstrating autogen.beta. Each example is self-contained, instantiates a GeminiConfig directly, and exercises one or two specific harness primitives so you can read it top-to-bottom and copy what you need.
Examples#
| # | Page | Topic | Primitives covered |
|---|---|---|---|
| 01 | Hello Agent | Minimal Agent — one config, one ask | Agent, GeminiConfig |
| 02 | Recipe Builder | Tools + Pydantic structured output | Agent, tools=, response_schema= |
| 03 | Travel Planner | Multi-turn chat via chained reply.ask() | agent.ask(), reply.ask() |
| 04 | Token Watchdog | Built-in + custom observers, ObserverAlert | BaseObserver, TokenMonitor, LoopDetector, EventWatch |
| 05 | Research Squad | Parallel subtasks + sibling delegation | run_subtasks(parallel=True), Agent.as_tool() |
| 06 | Journal Companion | Persistent memory across runs | KnowledgeConfig, WorkingMemoryAggregate, WorkingMemoryPolicy |
| 07 | Long-Doc Chat | Composing assembly policies + compaction | assembly=[...], SlidingWindowPolicy, TokenBudgetPolicy, TailWindowCompact |
| 08 | Safety Guard | FATAL alert → AlertPolicy → HaltEvent | ObserverAlert(FATAL), AlertPolicy, HaltEvent |
Set GEMINI_API_KEY (or swap in another provider's ModelConfig — AnthropicConfig, OpenAIConfig, etc.) before running.