Skip to content

About

A2A protocol - A minimal Python a2a-sdk demo implementing an Agent-to-Agent workflow with a greeting agent server, Starlette/uvicorn A2A endpoint, and a client that discovers and invokes the agent.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

a2a-workflow

This project demonstrates a simple Agent-to-Agent (A2A) workflow using the a2a-sdk. It implements a basic "Greeting Agent" server and a client to interact with it, showcasing how to build and consume agents using the A2A protocol.

Features

  • Greeting Agent: A simple agent that responds with a greeting message.
  • A2A Server: Built using starlette and uvicorn, exposing the agent via the A2A protocol.
  • A2A Client: A client script that discovers the agent via its Agent Card and sends a message.
  • Modern Tooling: Uses uv for fast Python package and project management.

Prerequisites

  • Python 3.11 or higher
  • uv

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd a2a-workflow
  2. Install dependencies using uv:

    This project uses uv to manage dependencies. Run the following command to create a virtual environment and install the required packages defined in pyproject.toml.

    uv sync

Usage

To see the agent in action, run the server in one terminal and the client in another.

1. Start the Agent Server

The server hosts the "Greeting Agent" on http://localhost:9999.

Run the server using the module entry point:

uv run -m dummy_agent

You should see output indicating that uvicorn is running:

INFO:     Started server process [...]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:9999 (Press CTRL+C to quit)

2. Run the Client

The client connects to the server, retrieves the Agent Card, and sends a test message.

Open a new terminal window and run:

uv run dummy_agent/client.py

Expected Output:

Agent Card {
  "name": "Greeting Agent",
  "description": "A simple agent that returns a greeting",
  ...
}
A2A Client Initialized
Response {
  ...
  "content": "Hi Everyone! Welcome to AI with Devendra."
  ...
}

Project Structure

  • dummy_agent/: Contains the source code for the agent and client.
    • __main__.py: The entry point for the server. Configures the AgentCard, AgentSkill, and starts the A2AStarletteApplication.
    • agent_executor.py: Defines the GreetingAgent logic and the GreetingAgentExecutor which handles the execution context.
    • client.py: A client script that uses a2a.client to communicate with the running agent.
  • main.py: A simple placeholder script.
  • pyproject.toml: Project configuration and dependencies.

Development

This project uses uv for dependency management.

  • Add a dependency:

    uv add <package-name>
  • Run a script in the virtual environment:

    uv run <script.py>
  • Update dependencies:

    uv lock --upgrade

About

A2A protocol - A minimal Python a2a-sdk demo implementing an Agent-to-Agent workflow with a greeting agent server, Starlette/uvicorn A2A endpoint, and a client that discovers and invokes the agent.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages