Skip to main content

A simple Python framework (built on top of FastAPI) for creating Agents following Google's Agent2Agent protocol

Project description

SmartA2A

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 smarta2a

Simple Echo Server Implementation

from smarta2a.server import SmartA2A

app = SmartA2A("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/smarta2a.git
cd smarta2a

# 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.2.5.tar.gz (30.1 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.2.5-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for smarta2a-0.2.5.tar.gz
Algorithm Hash digest
SHA256 1d7a244fc4327825f7d2f93b1fbea23ad9f72acef92b57508cb913fcf66b7ec9
MD5 5ee5a8651ea5674c0d267e54fa251349
BLAKE2b-256 5c5e9f8a6e1b0ba9d822e72d235f7b0767232f2d75d71c37d512e1810bf058cf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smarta2a-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 35.7 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.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ed7f8c19637f59eaf223a00b0d44226be717490094340aa841c117dcdc0336c1
MD5 9707bf12d2d53b2c93fa1d6a305c404d
BLAKE2b-256 15b9b476cb0d8f72008f6ac8ae7d02127c4dc528a3ec2ddeead39ce9ee446182

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