Prerequisites
Before you begin, make sure you have:- Python 3.11 or later - Handler uses modern Python features
- uv - Fast Python package manager
- just - Command runner for development tasks
- Ollama (optional) - For running the local server agent
Getting Started
1. Clone the Repository
2. Install Dependencies
uv sync.
3. Verify Installation
Development Workflow
Available Commands
Runjust with no arguments to see all available commands:
Running Tests
tests/ directory.
Code Quality Checks
Before committing, always run:- Linting -
ruff check .- Catches common issues - Formatting -
ruff format --check .- Ensures consistent style - Type Checking -
ty check- Validates type hints
Code Style Guidelines
Python Standards
- Python 3.11+ with full type hints on all functions
- Formatting: Use
ruff format(PEP 8 compliant) - Linting: Pass
ruff checkwith zero errors - Type Checking: Pass
ty checkwith zero errors - Testing: Use pytest with pytest-asyncio
Type Hints
All functions must have complete type hints:No Emojis
Important: Do not use emojis in code, docs, comments, or UI. Instead, use Unicode symbols:\u2713- Checkmark\u2717- X mark\u2192- Right arrow\u2600- Sun (for light theme)\u263E- Moon (for dark theme)
Async Conventions
All I/O operations should be async:Logging
Use the common logger:DEBUG- Detailed traces, request/response bodiesINFO- Key operations (connecting, sending, receiving)WARNING- Unexpected but handled situationsERROR- Failures and exceptions
Error Handling
Let exceptions bubble up with context:Project Structure
Understanding the codebase:Key Files
service.py - Start here to understand A2A operationscli/init.py - CLI entry point and command structure
tui/app.py - TUI main application
mcp/server.py - MCP tool definitions
server/app.py - Local A2A server setup
Making Changes
1. Create a Branch
2. Make Your Changes
Edit the code, following our style guidelines.3. Run Tests
tests/.
4. Check Code Quality
5. Commit Changes
- Use imperative mood (“Add feature” not “Added feature”)
- First line under 72 characters
- Reference issues/PRs if applicable
6. Push and Create PR
Development Tips
Running the TUI Locally
Testing CLI Commands
Running the Local Server
First, install and start Ollama:Testing the MCP Server
Debugging
Enable debug logging:- TUI: In-app logs panel
- CLI: stderr with rich formatting
Contributing Areas
Ways you can contribute:Code
- Fix bugs reported in issues
- Add new CLI commands
- Enhance TUI components
- Add new MCP tools
- Improve error handling
- Add tests
Documentation
- Improve API documentation
- Add code examples
- Write tutorials
- Fix typos
Testing
- Write unit tests
- Add integration tests
- Test against different agents
- Report bugs
Design
- Improve TUI layouts
- Enhance CLI output formatting
- Suggest UX improvements
Key Libraries
Familiarize yourself with these dependencies: A2A Protocol:- a2a-sdk - Official A2A Python SDK
- A2A Protocol Spec - Protocol documentation
- rich-click - Rich CLI framework
- Click - CLI building toolkit
- Google ADK - Agent Development Kit
- LiteLLM - LLM provider abstraction
- Starlette - ASGI web framework
- httpx - Async HTTP client
Architecture Notes
Understand these key concepts:A2AService Layer
A2AService in service.py is the core abstraction. Both CLI and TUI use it for all A2A operations. When adding features:
- Add the operation to
A2AService - Use it from CLI commands
- Use it from TUI event handlers
- Expose it via MCP tools
Session Persistence
Sessions persist to~/.handler/sessions.json and store:
context_id- For conversation continuitytask_id- For task operationscredentials- For authentication
- Use
session.pyfunctions - Index by
agent_url - Handle missing sessions gracefully
Streaming vs Non-Streaming
Handler supports both patterns: Non-streaming (service.send()):
- Collects all events
- Returns final result
- Simpler for CLI
service.stream()):
- Yields events as they arrive
- Better UX for TUI
- More complex handling
Release Process
(Maintainers only)1. Bump Version
2. Create Release
- Run tests
- Build package
- Publish to PyPI
Getting Help
If you need help:- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Handler Docs