Skip to content

1.1. Python

Why does the reference agent use Python?

Google ADK's Python package provides the agent, tool, callback, session, evaluation, and A2A APIs used by the course. Python also gives the project mature local tooling for strict linting, typing, security auditing, and tests. The choice is about the concrete teaching stack, not a claim that every agent should use Python.

Which Python version is required?

The agent requires Python 3.13, declared in agents/python/pyproject.toml. uv provisions a compatible interpreter and creates agents/python/.venv; do not depend on the operating system Python.

What do mise and uv each own?

  • mise pins the uv CLI and exposes stable tasks.
  • uv resolves pyproject.toml, locks all transitive dependencies in uv.lock, installs the interpreter, and synchronizes .venv.

The lockfile, rather than a version range shown in prose, records the exact environment that was tested.

How do you install only the agent project?

cd agents/python
mise run install

From the repository root, mise run install already performs this step.

Which runtime boundaries are installed?

The relevant dependency declarations are:

dependencies = [
  "aiosqlite>=0.22.1,<0.23", # async SQLite driver for ADK sessions and the A2A task store
  "google-adk[a2a]>=2.4.0", # locked agent runtime + A2A serving; avoid the unused Spanner `db` extra
  "mcp>=1.28.1", # Model Context Protocol server (FastMCP) + client (McpToolset), Ch. 3.3
  "openai>=2.45.0", # OSS SDK used by ADK OpenAILlm for direct Ollama or agentgateway
  "opentelemetry-exporter-otlp-proto-http>=1.42.0,<=1.42.1", # match ADK's OTel cap; export to Collector/MLflow
  "pydantic-settings>=2.14.2",
  "presidio-analyzer==2.2.362", # paired release; 2.2.363 caps cryptography below the security floor
  "presidio-anonymizer==2.2.362", # PII redaction paired exactly with the analyzer
  "spacy>=3.8,<3.9", # Presidio's NLP engine; pinned to match the en_core_web_sm model below
  "en-core-web-sm", # small English spaCy model for Presidio (URL-pinned in [tool.uv.sources])
  "cryptography>=48.0.1,<49", # latest MLflow-compatible line and floor for GHSA-537c-gmf6-5ccf
  "sqlite-vec>=0.1.6",
  "sqlalchemy[asyncio]>=2.0.51,<2.1", # persistent SQLite sessions/tasks without cloud database adapters
]

The build-checked excerpt is the runtime dependency set. ADK provides the agent and A2A runtime. Explicit SQLite/SQLAlchemy dependencies provide persistent local sessions and tasks without installing ADK's unused cloud-database extra. MCP provides the tool-server/client protocol. The openai package is the OSS client used by ADK's OpenAI-compatible adapter for direct Ollama and agentgateway. OpenTelemetry exports runtime signals. Pydantic validates configuration and tool boundaries. Presidio performs local PII analysis and anonymization.

The full file contains compatible version floors/caps and a pinned spaCy model. uv.lock resolves them exactly.

Which commands should you memorize?

mise run format       # Ruff import sorting and formatting
mise run check        # format, lint, type, lock, metadata, and vulnerability checks
mise run test         # deterministic pytest suite with branch coverage
mise run data:reset   # delete disposable runtime state, never the seed
mise run mcp          # stdio MCP server
mise run mcp:http     # streamable HTTP MCP server on 127.0.0.1:8000
mise run a2a          # persistent loopback A2A server on 127.0.0.1:8080

Model-backed run, web, eval, and eval:mlflow tasks require the relevant provider or gateway configuration. redteam is a deterministic offline adversarial regression suite; it is intentionally not marketed as live-model penetration testing.

What is the Python checkpoint?

cd agents/python
mise run check
mise run test

Continue when there are no warnings, pytest passes, and branch coverage meets the enforced 95% threshold. A passing import alone is not sufficient.

Pytest treats every unexpected warning as an error. The configuration filters only exact, reviewed warnings emitted by the locked ADK experimental A2A/tool-confirmation APIs and their current Starlette/OpenTelemetry compatibility layers. A new message or category therefore fails the gate instead of disappearing behind a broad warning suppression; revisit the narrow filters when those upstream APIs stabilize.