Skip to content

Examples

28+ comprehensive examples covering all Agenkit features.

Overview

Our examples demonstrate real-world usage patterns with:

  • Complete code - Ready to run
  • Explanations - Why, not just what
  • Best practices - Production patterns
  • Both languages - Python and Go

Quick Start Examples

New to Agenkit? Start here:

  1. 01_basic_agent.py - Create your first agent
  2. 02_sequential_pattern.py - Chain agents in a pipeline
  3. 03_parallel_pattern.py - Run agents concurrently

Examples by Category

Core Patterns (6 examples)

Basic agent creation and composition patterns.

Example Description Python Go
Basic Agent Simple message processing 📄 📄
Sequential Pattern Pipeline processing 📄 📄
Parallel Pattern Concurrent execution 📄 📄
Router Pattern Conditional dispatch 📄 -
Tool Usage Tool integration 📄 📄
Pattern Composition Complex workflows 📄 -

Transport Layer (3 examples)

Cross-process and cross-language communication.

Example Description Python Go
WebSocket Bidirectional streaming 📄 📄
gRPC High-performance RPC 📄 📄

Middleware (6 examples)

Production resilience and observability.

Example Description Python Go
Circuit Breaker Fail-fast pattern 📄 📄
Retry Exponential backoff 📄 📄
Timeout Request deadlines 📄 📄
Rate Limiter Token bucket 📄 📄
Caching LRU cache with TTL 📄 📄
Batching Request aggregation 📄 📄

Composition Patterns (4 examples)

Advanced multi-agent orchestration.

Example Description Python Go
Sequential Advanced pipelines 📄 📄
Parallel Result aggregation 📄 📄
Fallback High availability 📄 📄
Conditional Dynamic routing 📄 📄

Tools (4 examples)

Tool integration and function calling.

Example Description Python Go
Calculator Math operations 📄 📄
Search External API calls 📄 -
Database Database operations 📄 -
OS Tools File system & processes 📄 -

Adapters (3 examples)

Remote agents and streaming.

Example Description Python Go
Basic Remote Cross-process agents 📄 -
Agent Registry Service discovery 📄 -
Streaming Stream processing 📄 -

Observability (2 examples)

Tracing, metrics, and logging.

Example Description Python Go
Full Stack Complete observability 📄 📄
Metrics Prometheus integration 📄 📄

Running Examples

Python

# Clone repository
git clone https://github.com/scttfrdmn/agenkit.git
cd agenkit

# Install dependencies
pip install -e ".[dev]"

# Run any example
python examples/01_basic_agent.py
python examples/middleware/circuit_breaker_example.py

Go

# Clone repository
git clone https://github.com/scttfrdmn/agenkit.git
cd agenkit/agenkit-go/examples

# Run any example
go run basic/main.go
go run middleware/circuit_breaker_example.go

Learning Path

Follow this order for the best learning experience:

1. Fundamentals (Day 1)

  • 01_basic_agent.py
  • 02_sequential_pattern.py
  • 03_parallel_pattern.py
  • 04_router_pattern.py
  • 05_tool_usage.py
  • 06_pattern_composition.py

2. Transport & Remote (Day 2)

  • adapters/01_basic_remote_agent.py
  • transport/grpc_example.py
  • transport/websocket_example.py

3. Production Middleware (Day 3)

  • middleware/retry_example.py
  • middleware/timeout_example.py
  • middleware/circuit_breaker_example.py
  • middleware/rate_limiter_example.py
  • middleware/caching_example.py
  • middleware/batching_example.py

4. Observability (Day 4)

  • middleware/metrics_example.py
  • observability/observability_example.py

5. Advanced (Day 5)

  • composition/fallback_example.py
  • composition/conditional_example.py
  • tools/* (all tool examples)

Example Statistics

  • Total Examples: 28+ (Python) + 16 (Go) = 44+ examples
  • Lines of Code: ~6,700 lines with documentation
  • Coverage: All features demonstrated
  • Maintenance: Updated with each release

Next Steps

  • Run examples - Clone the repo and try them out
  • Read guides - Deepen understanding with guides
  • Build something - Use examples as templates
  • Contribute - Share your examples with the community