A Python package for creating servers and clients 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 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smarta2a-0.2.1.tar.gz.
File metadata
- Download URL: smarta2a-0.2.1.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
244cfd9f9b18c22217b7120eeb8d84b09db068f58cb7961bd451b8e552279099
|
|
| MD5 |
04b090522a6611680a65693ff02b05aa
|
|
| BLAKE2b-256 |
bc599278530841b5a238e12c9f0cfbbbee9c23cce580fdd9ff1ceb9a7d7026cd
|
File details
Details for the file smarta2a-0.2.1-py3-none-any.whl.
File metadata
- Download URL: smarta2a-0.2.1-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c989a77c0589d544d71a133fc2682e6ba4f79496201ffcee4abd7bc9fd95134
|
|
| MD5 |
0f003dd54238de7cdc1298ca7b53493d
|
|
| BLAKE2b-256 |
70e90fc82bcdc80f9ba4a1caeb17eb21d8b41d1bdfab702888da8e7cb74a1d95
|