2025-05-12 14:29:47 -05:00
# 2. Setup Your Environment
2025-05-01 11:05:18 -05:00
2025-05-12 14:29:47 -05:00
## Prerequisites
2025-05-01 11:05:18 -05:00
2025-06-04 11:22:31 -04:00
- Python 3.10 or higher.
2025-05-12 14:29:47 -05:00
- Access to a terminal or command prompt.
- Git, for cloning the repository.
2025-06-03 10:44:32 -05:00
- A code editor (e.g., Visual Studio Code) is recommended.
2025-05-01 11:05:18 -05:00
2025-05-12 14:29:47 -05:00
## Clone the Repository
2025-05-01 11:05:18 -05:00
2025-05-27 16:31:32 -05:00
If you haven't already, clone the A2A Samples repository:
2025-05-01 11:05:18 -05:00
2025-05-12 14:29:47 -05:00
```bash
2025-06-23 21:34:48 +02:00
git clone https://github.com/a2aproject/a2a-samples.git -b main --depth 1
2025-05-27 16:31:32 -05:00
cd a2a-samples
2025-05-12 14:29:47 -05:00
```
2025-05-01 11:05:18 -05:00
2025-05-12 14:29:47 -05:00
## Python Environment & SDK Installation
2025-05-01 11:05:18 -05:00
2025-05-12 14:29:47 -05:00
We recommend using a virtual environment for Python projects. The A2A Python SDK uses `uv` for dependency management, but you can use `pip` with `venv` as well.
2025-05-01 11:05:18 -05:00
2025-05-12 14:29:47 -05:00
1. **Create and activate a virtual environment:**
Using `venv` (standard library):
=== "Mac/Linux"
```sh
python -m venv .venv
source .venv/bin/activate
```
=== "Windows"
```powershell
python -m venv .venv
.venv\Scripts\activate
```
2025-05-29 11:14:33 -04:00
2. **Install needed Python dependencies along with the A2A SDK and its dependencies:**
2025-05-12 14:29:47 -05:00
```bash
2025-06-02 14:26:25 -04:00
pip install -r samples/python/requirements.txt
2025-05-12 14:29:47 -05:00
```
## Verify Installation
2025-05-01 11:05:18 -05:00
2025-05-12 14:29:47 -05:00
After installation, you should be able to import the `a2a` package in a Python interpreter:
2025-05-01 11:05:18 -05:00
```bash
2025-05-12 14:29:47 -05:00
python -c "import a2a; print('A2A SDK imported successfully')"
2025-05-01 11:05:18 -05:00
```
2025-05-12 14:29:47 -05:00
If this command runs without error and prints the success message, your environment is set up correctly.