Autogen Playground showcases several multi-agent workflows that you can run locally with Python 3.12+. The repository ships a collection of command-line demos along with a FastAPI backend for Gmail labeling workflows.
- Python 3.12 and
uvfor dependency management - OpenAI or Composio API credentials stored in a local
.env
uv venv && uv sync
# Reason: start from the backend template and fill in your secrets
cp config/env.example .envPopulate .env with keys such as OPENAI_API_KEY and COMPOSIO_API_KEY before launching any
agents.
Activate the virtual environment when you are not using uv run directly:
source .venv/bin/activateRun the baseline single-threaded flow:
uv run python main.pyOther multi-agent examples live at the repository root:
uv run python customer-support.pyuv run python group-chat-example.pyuv run python gmail-organizer.py
Each script prints progress to the terminal so you can observe the message routing between
agents. Stop the preview with Ctrl+C.
Spin up the backend API that powers the Gmail labeler workflows:
uv run uvicorn backend.app.main:create_app --reload --host 0.0.0.0 --port 8000The interactive OpenAPI docs are available at http://localhost:8000/docs.
The Gmail Labeler backend includes a complete AI-powered auto-labeling system that learns from your behavior and automatically categorizes emails during the fetch process.
Pattern-Based Auto-Labeling
- Automatically labels emails as "Important" or "Not Important" based on learned patterns
- Multi-factor scoring: Domain matching (50%), Keywords (30%), Subject patterns (20%)
- Configurable confidence threshold (default: 40%)
- Applies labels directly to Gmail and local database
Accelerated Learning
- Learns from manual labels you apply
- Re-mark detection: When you correct an auto-label, the system learns 2x faster
- Pattern weights increase from corrections (1.0x → 2.0x → up to 5.0x)
- Continuous improvement from user feedback
Privacy
- Personal information is sanitised before being used in AI classification or stored as learned patterns
The auto-labeling system provides enhanced REST endpoints:
GET /api/emails - Fetch emails with statistics
# Filter by category
curl "http://localhost:8000/api/emails?user_id=UUID&category=important"
curl "http://localhost:8000/api/emails?user_id=UUID&category=not_important"
curl "http://localhost:8000/api/emails?user_id=UUID&category=uncategorized"
# Response includes statistics
{
"items": [...],
"stats": {
"total": 10,
"important": 3,
"notImportant": 2,
"uncategorized": 5,
"autoLabeled": 3,
"manualLabeled": 2
}
}The project includes comprehensive test coverage for the OAuth workflow and Composio integration.
Run all tests:
uv run pytest backend/tests/ -vRun tests with coverage:
uv run pytest backend/tests/ --cov=backend/app --cov-report=htmlOAuth Workflow Tests (test_routes.py):
uv run pytest backend/tests/test_routes.py -vComposio Adapter Tests (test_composio_adapter.py):
uv run pytest backend/tests/test_composio_adapter.py -v✅ OAuth Flow (2 tests)
- Authorization URL generation
- Token exchange and storage
✅ Composio Integration (9 tests)
- Composio 1.0 API compliance
- Gmail message fetching
- Label application
- Token management
- Error handling
✅ API Routes (4 tests)
- Health checks
- Email operations
- Agent execution
Run linting and formatting:
# Format code
uv run ruff format .
# Check for linting issues
uv run ruff check .
# Auto-fix linting issues
uv run ruff check --fix .Run type checking:
uv run mypy backend/- Review
docs/COMPOSIO_INTEGRATION_FIX.mdfor Composio setup instructions - Read
docs/OAUTH_TEST_REPORT.mdfor detailed test documentation - Read
docs/PII_PROTECTION.mdfor details on how email data is handled - See
CLAUDE.mdfor project-specific development guidelines