Running Examples

Running Examples

After completing the Environment Setup, you can start running the A2A Protocol example code.

The example code is located in the a2acn/_docs/docs/samples/ directory and includes implementations in both Python and JavaScript.

Running Python Examples

  1. Navigate to the directory:

    # Assuming you are in the root of the a2a-protocol repository
    cd a2acn/_docs/docs/samples/python
  2. Install dependencies: (Choose the appropriate command based on the guidance in setup.md and the actual project files)

    # Example: if using requirements.txt and pip
    pip install -r requirements.txt
    # Example: if using pyproject.toml and uv
    # uv sync
  3. Run the Agent:

    • (Specific run commands need to be added here. For example: scripts to run Client Agent and Server Agent)
    • python client_agent.py (Example)
    • python server_agent.py (Example)

    Please refer to the README file or the main Python scripts within the a2acn/_docs/docs/samples/python/ directory for the exact execution instructions.

Running JavaScript (Node.js) Examples

  1. Navigate to the directory:

    # Assuming you are in the root of the a2a-protocol repository
    cd a2acn/_docs/docs/samples/js # Or samples/javascript, adjust based on the actual directory name
  2. Install dependencies:

    npm install
    # or yarn install
  3. Run the Agent:

    • (Specific run commands need to be added here. For example: Node.js scripts to start Client and Server)
    • node client.js (Example)
    • node server.js (Example)

    Please refer to the README file or the scripts section in package.json within the a2acn/_docs/docs/samples/js/ (or javascript/) directory for the exact execution instructions.

After successfully running the examples, you should be able to observe the communication and interaction between the Client Agent and Server Agent, depending on the design of the specific example.