- Use Google ADK features locally without requiring Google Cloud services.
- Keep the codebase easy to reason about (small, explicit modules).
- Enforce a “green build”: pytest + mypy + ruff must pass.
src/blacki/server.py: Main platform entrypoint (FastAPI + ADK + Postgres)src/blacki/agent.py: Agent definition (exportsroot_agent)src/blacki/utils/: Shared helper modules (config + observability)tests/: Unit and integration tests.env: Configuration file (API keys, DB URL)
Create .env in the project root:
AGENT_NAME: Unique identifier for the agent service (required)GOOGLE_API_KEY: Google AI Studio key (optional if using OpenRouter)OPENROUTER_API_KEY: OpenRouter API key (required for non-Google models)DATABASE_URL: Postgres URL for sessions (required for persistence)
Observability (Optional):
OTEL_EXPORTER_OTLP_ENDPOINT: OTLP backend URLOTEL_EXPORTER_OTLP_HEADERS: Authentication headersOTEL_EXPORTER_OTLP_PROTOCOL: Protocol (http/protobuf or grpc)
Optional:
HOST: server bind host (default:127.0.0.1)PORT: server port (default:8080)LOG_LEVEL: Logging verbosity (default:INFO)SERVE_WEB_INTERFACE: Whether to serve the ADK web UI (default:false)
uv syncLocal Python:
uv run python -m blacki.serverDocker Compose (Recommended for full stack):
docker compose up --build --watch- Develop: Edit files in
src/. - Test: Run unit tests frequently.
- Check: Run quality checks before committing.
We enforce high standards to ensure long-term maintainability.
Commands (Must be 100% Green):
uv run ruff check . # Linting
uv run ruff format --check . # Formatting check
uv run mypy . # Type checking
uv run pytest # Unit tests (100% coverage required)Standards:
- Type Hints: Strict
mypy. Use modern Python 3.13+ syntax (e.g.,str | None,list[str]). Pydantic for validation. - Code Style:
ruffdefault configuration (88-char lines). Usepathlib.Pathinstead ofos.pathwhere possible. - Docstrings: Google-style format. Document arguments, return values, and exceptions.
- Testing: 100% coverage required for new code.
uv add package-name # Add runtime dependency
uv add --group dev package-name # Add dev dependency
uv lock --upgrade # Update all dependencies