2. Set Up Your Environment

Prerequisites

  • Python 3.12 — the version this tutorial was verified with.
  • Access to a terminal or command prompt.
  • Git, for fetching the repository.
  • A code editor (for example, Visual Studio Code) is recommended.

Clone the repository

This tutorial runs the helloworld sample as it exists at one specific commit, so every reader gets the same code. From an empty directory, fetch exactly that commit — no full clone, no branch checkout:

git init a2a-samples
cd a2a-samples
git fetch --depth 1 https://github.com/a2aproject/a2a-samples.git 6603ba3f2c31a7ef33e70b9d8b5b5f8be42ac9a3
git checkout --detach FETCH_HEAD

Already have this commit locally in an existing checkout? Then git checkout 6603ba3f2c31a7ef33e70b9d8b5b5f8be42ac9a3 is enough. If the checkout does not have the commit yet, fetch it first (git fetch --depth 1 origin 6603ba3f2c31a7ef33e70b9d8b5b5f8be42ac9a3), then git checkout --detach FETCH_HEAD.

Python environment and SDK installation

Using a virtual environment is recommended for Python projects. The A2A Python SDK uses uv for dependency management, but you can use pip with venv as well.

1. Create and activate a virtual environment (using the standard library venv):

python3.12 -m venv .venv
source .venv/bin/activate
py -3.12 -m venv .venv
./.venv/Scripts/Activate.ps1

If PowerShell blocks the activation script, you do not need to change your execution policy: call the environment’s Python directly in later commands, for example ./.venv/Scripts/python.exe -c "import a2a".

2. Install the SDK and the other direct dependencies, pinned:

python -m pip install --prefer-binary 'a2a-sdk[http-server]==1.3.0' 'uvicorn==0.54.0' 'python-dotenv==1.2.4' 'pytest==9.2.0'

These four are the tutorial’s pinned direct dependencies; everything else (for example httpx, starlette, sse-starlette) is a transitive dependency that pip resolves on its own. pytest is pinned because test_client.py imports it at the top, so the interactive client does not start without it. --prefer-binary makes pip prefer available wheels, reducing the cases where it tries to build transitive packages such as cryptography from source. Verified on this site on 2026-11-14: on the pinned commit, with Python 3.12, these exact versions install, import, run the server, and pass pytest samples/python/agents/helloworld/test_client.py.

For reference, the repository ships two other lists, neither of which this tutorial follows: samples/python/requirements.txt declares only the lower bound a2a-sdk[http-server]>=0.3.0 and leaves uvicorn and python-dotenv unpinned, and samples/python/agents/helloworld/requirements.txt pins a2a-sdk==1.1.0. Pinning the versions above is what makes the steps reproducible.

Verify installation

After installation, import the four direct dependencies and print their versions:

python -c "from importlib.metadata import version; [print(p, version(p)) for p in ('a2a-sdk','uvicorn','python-dotenv','pytest')]; import a2a, uvicorn, dotenv, pytest"

If the command prints the pinned versions without error, your environment is set up correctly.

Three version numbers, three different things

The tutorial touches three distinct versions — keep them apart when something misbehaves:

  • The application version is version in the Agent Card (0.0.1 in helloworld). It is the sample agent’s own release number and is unrelated to any package.
  • The SDK version is the a2a-sdk Python package installed above (1.3.0). It determines which SDK APIs and wire types your code sees.
  • The interface protocol version is protocolVersion in each supportedInterfaces entry of the card (1.0). It is the A2A protocol revision the endpoint speaks — negotiated per interface, not tied to the SDK package version.

Next step

Continue with Agent Skills and Agent Card .

Source: A2A official documentation · Setup