Skip to main content

A Python package for creating servers and clients following Google's Agent2Agent protocol

Project description

FastA2A

A Python package for creating a server following Google's Agent2Agent protocol

Features

Full A2A Protocol Compliance - Implements all required endpoints and response formats

Decorator-Driven Development - Rapid endpoint configuration with type safety

🧩 Automatic Protocol Conversion - Simple returns become valid A2A responses

🔀 Flexible Response Handling - Support for Tasks, Artifacts, Streaming, and raw protocol types if needed!

🛡️ Built-in Validation - Automatic Pydantic validation of A2A schemas

Single File Setup - Get compliant in <10 lines of code

🌍 Production Ready - CORS, async support, and error handling included

Installation

pip install fasta2a

Simple Echo Server Implementation

from fasta2a import FastA2A

app = FastA2A("EchoServer")

@app.on_send_task()
def handle_task(request):
    """Echo the input text back as a completed task"""
    input_text = request.content[0].text
    return f"Echo: {input_text}"

if __name__ == "__main__":
    app.run()

Automatically contructs the response:

{
  "jsonrpc": "2.0",
  "id": "test",
  "result": {
    "id": "echo-task",
    "status": {"state": "completed"},
    "artifacts": [{
      "parts": [{"type": "text", "text": "Echo: Hello!"}]
    }]
  }
}

Development

To set up the development environment:

# Clone the repository
git clone https://github.com/siddharthsma/fasta2a.git
cd fasta2a

# Create and activate virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install development dependencies
pip install -e ".[dev]"

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smarta2a-0.1.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smarta2a-0.1.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file smarta2a-0.1.0.tar.gz.

File metadata

  • Download URL: smarta2a-0.1.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for smarta2a-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5a7a1f299a6175a304b00d11a531dd38f8d676f00dc374ff426fe6f1defe9bcd
MD5 292f9ea0a96d3f6cff13f998179016ff
BLAKE2b-256 35901a8741bad57d81b13e72b4be33594032a2b2fa2c5170894e6b8e1c2b6f6d

See more details on using hashes here.

File details

Details for the file smarta2a-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: smarta2a-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for smarta2a-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ba23497d194a8bfdc54d57c81a69ecca83159d6145836d8ff5eb3f39eb395ad4
MD5 ecb07b40988f37f69fac4089a5acbe2b
BLAKE2b-256 997a4b18f9c55dd8f1334cddf687283bb03ecfed3e4a17329dee5ee0d75e56b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page