smarta2a 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- smarta2a-0.1.0/.gitignore +105 -0
- smarta2a-0.1.0/LICENSE +21 -0
- smarta2a-0.1.0/PKG-INFO +97 -0
- smarta2a-0.1.0/README.md +79 -0
- smarta2a-0.1.0/fasta2a/__init__.py +9 -0
- smarta2a-0.1.0/fasta2a/server.py +710 -0
- smarta2a-0.1.0/fasta2a/types.py +424 -0
- smarta2a-0.1.0/pyproject.toml +44 -0
- smarta2a-0.1.0/requirements.txt +26 -0
- smarta2a-0.1.0/setup.py +25 -0
- smarta2a-0.1.0/tests/test_server.py +503 -0
@@ -0,0 +1,105 @@
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
2
|
+
__pycache__/
|
3
|
+
*.py[cod]
|
4
|
+
*$py.class
|
5
|
+
|
6
|
+
# C extensions
|
7
|
+
*.so
|
8
|
+
|
9
|
+
# Distribution / packaging
|
10
|
+
.Python
|
11
|
+
build/
|
12
|
+
develop-eggs/
|
13
|
+
dist/
|
14
|
+
downloads/
|
15
|
+
eggs/
|
16
|
+
.eggs/
|
17
|
+
lib/
|
18
|
+
lib64/
|
19
|
+
parts/
|
20
|
+
sdist/
|
21
|
+
var/
|
22
|
+
wheels/
|
23
|
+
*.egg-info/
|
24
|
+
.installed.cfg
|
25
|
+
*.egg
|
26
|
+
|
27
|
+
# PyInstaller
|
28
|
+
*.manifest
|
29
|
+
*.spec
|
30
|
+
|
31
|
+
# Installer logs
|
32
|
+
pip-log.txt
|
33
|
+
pip-delete-this-directory.txt
|
34
|
+
|
35
|
+
# Unit test / coverage reports
|
36
|
+
htmlcov/
|
37
|
+
.tox/
|
38
|
+
.coverage
|
39
|
+
.coverage.*
|
40
|
+
.cache
|
41
|
+
nosetests.xml
|
42
|
+
coverage.xml
|
43
|
+
*.cover
|
44
|
+
.hypothesis/
|
45
|
+
|
46
|
+
# Translations
|
47
|
+
*.mo
|
48
|
+
*.pot
|
49
|
+
|
50
|
+
# Django stuff:
|
51
|
+
*.log
|
52
|
+
local_settings.py
|
53
|
+
|
54
|
+
# Flask stuff:
|
55
|
+
instance/
|
56
|
+
.webassets-cache
|
57
|
+
|
58
|
+
# Scrapy stuff:
|
59
|
+
.scrapy
|
60
|
+
|
61
|
+
# Sphinx documentation
|
62
|
+
docs/_build/
|
63
|
+
|
64
|
+
# PyBuilder
|
65
|
+
target/
|
66
|
+
|
67
|
+
# Jupyter Notebook
|
68
|
+
.ipynb_checkpoints
|
69
|
+
|
70
|
+
# pyenv
|
71
|
+
.python-version
|
72
|
+
|
73
|
+
# celery beat schedule file
|
74
|
+
celerybeat-schedule
|
75
|
+
|
76
|
+
# SageMath parsed files
|
77
|
+
*.sage.py
|
78
|
+
|
79
|
+
# Environments
|
80
|
+
.env
|
81
|
+
.venv
|
82
|
+
env/
|
83
|
+
venv/
|
84
|
+
ENV/
|
85
|
+
env.bak/
|
86
|
+
venv.bak/
|
87
|
+
|
88
|
+
# Spyder project settings
|
89
|
+
.spyderproject
|
90
|
+
.spyproject
|
91
|
+
|
92
|
+
# Rope project settings
|
93
|
+
.ropeproject
|
94
|
+
|
95
|
+
# mkdocs documentation
|
96
|
+
/site
|
97
|
+
|
98
|
+
# mypy
|
99
|
+
.mypy_cache/
|
100
|
+
|
101
|
+
# IDE
|
102
|
+
.idea/
|
103
|
+
.vscode/
|
104
|
+
*.swp
|
105
|
+
*.swo
|
smarta2a-0.1.0/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Siddharth Ambegaonkar
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
smarta2a-0.1.0/PKG-INFO
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: smarta2a
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: A Python package for creating servers and clients following Google's Agent2Agent protocol
|
5
|
+
Project-URL: Homepage, https://github.com/siddharthsma/fasta2a
|
6
|
+
Project-URL: Bug Tracker, https://github.com/siddharthsma/fasta2a/issues
|
7
|
+
Author-email: Siddharth Ambegaonkar <siddharthsma@gmail.com>
|
8
|
+
License-File: LICENSE
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Operating System :: OS Independent
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
12
|
+
Requires-Python: >=3.8
|
13
|
+
Requires-Dist: fastapi
|
14
|
+
Requires-Dist: pydantic
|
15
|
+
Requires-Dist: sse-starlette
|
16
|
+
Requires-Dist: uvicorn
|
17
|
+
Description-Content-Type: text/markdown
|
18
|
+
|
19
|
+
# FastA2A
|
20
|
+
|
21
|
+
A Python package for creating a server following Google's Agent2Agent protocol
|
22
|
+
|
23
|
+
## Features
|
24
|
+
|
25
|
+
✅ **Full A2A Protocol Compliance** - Implements all required endpoints and response formats
|
26
|
+
|
27
|
+
⚡ **Decorator-Driven Development** - Rapid endpoint configuration with type safety
|
28
|
+
|
29
|
+
🧩 **Automatic Protocol Conversion** - Simple returns become valid A2A responses
|
30
|
+
|
31
|
+
🔀 **Flexible Response Handling** - Support for Tasks, Artifacts, Streaming, and raw protocol types if needed!
|
32
|
+
|
33
|
+
🛡️ **Built-in Validation** - Automatic Pydantic validation of A2A schemas
|
34
|
+
|
35
|
+
⚡ **Single File Setup** - Get compliant in <10 lines of code
|
36
|
+
|
37
|
+
🌍 **Production Ready** - CORS, async support, and error handling included
|
38
|
+
|
39
|
+
## Installation
|
40
|
+
|
41
|
+
```bash
|
42
|
+
pip install fasta2a
|
43
|
+
```
|
44
|
+
|
45
|
+
## Simple Echo Server Implementation
|
46
|
+
|
47
|
+
```python
|
48
|
+
from fasta2a import FastA2A
|
49
|
+
|
50
|
+
app = FastA2A("EchoServer")
|
51
|
+
|
52
|
+
@app.on_send_task()
|
53
|
+
def handle_task(request):
|
54
|
+
"""Echo the input text back as a completed task"""
|
55
|
+
input_text = request.content[0].text
|
56
|
+
return f"Echo: {input_text}"
|
57
|
+
|
58
|
+
if __name__ == "__main__":
|
59
|
+
app.run()
|
60
|
+
```
|
61
|
+
|
62
|
+
Automatically contructs the response:
|
63
|
+
|
64
|
+
```json
|
65
|
+
{
|
66
|
+
"jsonrpc": "2.0",
|
67
|
+
"id": "test",
|
68
|
+
"result": {
|
69
|
+
"id": "echo-task",
|
70
|
+
"status": {"state": "completed"},
|
71
|
+
"artifacts": [{
|
72
|
+
"parts": [{"type": "text", "text": "Echo: Hello!"}]
|
73
|
+
}]
|
74
|
+
}
|
75
|
+
}
|
76
|
+
```
|
77
|
+
|
78
|
+
## Development
|
79
|
+
|
80
|
+
To set up the development environment:
|
81
|
+
|
82
|
+
```bash
|
83
|
+
# Clone the repository
|
84
|
+
git clone https://github.com/siddharthsma/fasta2a.git
|
85
|
+
cd fasta2a
|
86
|
+
|
87
|
+
# Create and activate virtual environment
|
88
|
+
python -m venv venv
|
89
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
90
|
+
|
91
|
+
# Install development dependencies
|
92
|
+
pip install -e ".[dev]"
|
93
|
+
```
|
94
|
+
|
95
|
+
## License
|
96
|
+
|
97
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
smarta2a-0.1.0/README.md
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
# FastA2A
|
2
|
+
|
3
|
+
A Python package for creating a server following Google's Agent2Agent protocol
|
4
|
+
|
5
|
+
## Features
|
6
|
+
|
7
|
+
✅ **Full A2A Protocol Compliance** - Implements all required endpoints and response formats
|
8
|
+
|
9
|
+
⚡ **Decorator-Driven Development** - Rapid endpoint configuration with type safety
|
10
|
+
|
11
|
+
🧩 **Automatic Protocol Conversion** - Simple returns become valid A2A responses
|
12
|
+
|
13
|
+
🔀 **Flexible Response Handling** - Support for Tasks, Artifacts, Streaming, and raw protocol types if needed!
|
14
|
+
|
15
|
+
🛡️ **Built-in Validation** - Automatic Pydantic validation of A2A schemas
|
16
|
+
|
17
|
+
⚡ **Single File Setup** - Get compliant in <10 lines of code
|
18
|
+
|
19
|
+
🌍 **Production Ready** - CORS, async support, and error handling included
|
20
|
+
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
```bash
|
24
|
+
pip install fasta2a
|
25
|
+
```
|
26
|
+
|
27
|
+
## Simple Echo Server Implementation
|
28
|
+
|
29
|
+
```python
|
30
|
+
from fasta2a import FastA2A
|
31
|
+
|
32
|
+
app = FastA2A("EchoServer")
|
33
|
+
|
34
|
+
@app.on_send_task()
|
35
|
+
def handle_task(request):
|
36
|
+
"""Echo the input text back as a completed task"""
|
37
|
+
input_text = request.content[0].text
|
38
|
+
return f"Echo: {input_text}"
|
39
|
+
|
40
|
+
if __name__ == "__main__":
|
41
|
+
app.run()
|
42
|
+
```
|
43
|
+
|
44
|
+
Automatically contructs the response:
|
45
|
+
|
46
|
+
```json
|
47
|
+
{
|
48
|
+
"jsonrpc": "2.0",
|
49
|
+
"id": "test",
|
50
|
+
"result": {
|
51
|
+
"id": "echo-task",
|
52
|
+
"status": {"state": "completed"},
|
53
|
+
"artifacts": [{
|
54
|
+
"parts": [{"type": "text", "text": "Echo: Hello!"}]
|
55
|
+
}]
|
56
|
+
}
|
57
|
+
}
|
58
|
+
```
|
59
|
+
|
60
|
+
## Development
|
61
|
+
|
62
|
+
To set up the development environment:
|
63
|
+
|
64
|
+
```bash
|
65
|
+
# Clone the repository
|
66
|
+
git clone https://github.com/siddharthsma/fasta2a.git
|
67
|
+
cd fasta2a
|
68
|
+
|
69
|
+
# Create and activate virtual environment
|
70
|
+
python -m venv venv
|
71
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
72
|
+
|
73
|
+
# Install development dependencies
|
74
|
+
pip install -e ".[dev]"
|
75
|
+
```
|
76
|
+
|
77
|
+
## License
|
78
|
+
|
79
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|