slima2a 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.
@@ -0,0 +1,124 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Virtual Environments
10
+ .venv
11
+
12
+ # Distribution / packaging
13
+ .Python
14
+ build/
15
+ develop-eggs/
16
+ dist/
17
+ downloads/
18
+ eggs/
19
+ .eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ .pytest_cache/
48
+ nosetests.xml
49
+ coverage.xml
50
+ *.cover
51
+ *.py,cover
52
+ .hypothesis/
53
+ .pytest_cache/
54
+ cover/
55
+
56
+ # Translations
57
+ *.mo
58
+ *.pot
59
+
60
+ # Django stuff:
61
+ *.log
62
+ local_settings.py
63
+ db.sqlite3
64
+ db.sqlite3-journal
65
+
66
+ # Flask stuff:
67
+ instance/
68
+ .webassets-cache
69
+
70
+ # Scrapy stuff:
71
+ .scrapy
72
+
73
+ # Sphinx documentation
74
+ docs/_build/
75
+
76
+ # PyBuilder
77
+ target
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ .python-version
88
+
89
+ # mypy
90
+ .mypy_cache/
91
+ .dmypy.json
92
+ dmypy.json
93
+
94
+ # Pyre type checker
95
+ .pyre/
96
+
97
+ # VS Code
98
+ .vscode/
99
+
100
+ # MacOS
101
+ .DS_Store
102
+
103
+ # Ruff
104
+ .ruff_cache
105
+
106
+ # env file
107
+ .env
108
+
109
+ # tools
110
+ .tools
111
+ .tmp
112
+
113
+ # binaris
114
+ .dist
115
+
116
+ # coverage
117
+ *-coverage.out
118
+ coverage.out
119
+
120
+ # pyd files
121
+ .pyd
122
+
123
+ # this schema is copied over from dataplane
124
+ control-plane/common/controller/schema.json
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2025-09-18)
4
+
5
+
6
+ ### Features
7
+
8
+ * rename srpc python import to slimrpc ([#660](https://github.com/agntcy/slim/issues/660)) ([d7ed9b2](https://github.com/agntcy/slim/commit/d7ed9b206c49096628541404766790c6a2406d7e))
9
+ * **slimrpc:** separate Channel and ChannelFactory ([#685](https://github.com/agntcy/slim/issues/685)) ([3dc8a5b](https://github.com/agntcy/slim/commit/3dc8a5b8a434180a275fcbce5f26b62b3739b4c9))
10
+ * **slimrpc:** Support existing slim binding in ChannelFactory ([#690](https://github.com/agntcy/slim/issues/690)) ([d7093b7](https://github.com/agntcy/slim/commit/d7093b7b022e5fc707ecef61953e6016f05e4a73))
11
+ * update version of slima2a and slimrpc wheels ([#637](https://github.com/agntcy/slim/issues/637)) ([e6569cb](https://github.com/agntcy/slim/commit/e6569cba88afff65b7a736f7511d9ea2a57f7dc2))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * **slima2a, slimrpc:** make mypy happy ([#671](https://github.com/agntcy/slim/issues/671)) ([5ab4628](https://github.com/agntcy/slim/commit/5ab462854c57a4788cc5eec8eecc734ab34cb2d5))
slima2a-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.4
2
+ Name: slima2a
3
+ Version: 0.1.0
4
+ Summary: A2A protocol over slimrpc
5
+ Project-URL: Repository, https://github.com/agntcy/slim
6
+ Project-URL: Issues, https://github.com/agntcy/slim/issues
7
+ Project-URL: Changelog, https://github.com/agntcy/slim/blob/main/data-plane/python/integrations/slima2a/CHANGELOG.md
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Topic :: Software Development :: Libraries
15
+ Requires-Python: <4.0,>=3.10
16
+ Requires-Dist: a2a-sdk[telemetry]>=0.3.0
17
+ Requires-Dist: slimrpc==0.1.0
18
+ Description-Content-Type: text/markdown
19
+
20
+ # SLIMA2A
21
+
22
+ SLIMA2A is a native integration of A2A built on top of SLIM.
23
+
24
+ ## Server usage
25
+
26
+ ```python
27
+ import srpc
28
+ from a2a.server.request_handlers import DefaultRequestHandler
29
+ from slima2a.handler import SRPCHandler
30
+ from slima2a.types.a2a_pb2_srpc import add_A2AServiceServicer_to_server
31
+
32
+ agent_executor = MyAgentExecutor()
33
+ request_handler = DefaultRequestHandler(
34
+ agent_executor=agent_executor, task_store=InMemoryTaskStore()
35
+ )
36
+
37
+ servicer = SRPCHandler(agent_card, request_handler)
38
+
39
+ server = srpc.Server(
40
+ local="agntcy/demo/server",
41
+ slim={
42
+ "endpoint": "http://localhost:46357",
43
+ "tls": {
44
+ "insecure": True,
45
+ },
46
+ },
47
+ shared_secret="secret",
48
+ )
49
+
50
+ a2a_pb2_srpc.add_A2AServiceServicer_to_server(
51
+ servicer
52
+ server,
53
+ )
54
+
55
+ await server.start()
56
+ ```
57
+
58
+ ## Client Usage
59
+
60
+ ```python
61
+ from srpc import SRPCChannel
62
+ from a2a.client import ClientFactory, minimal_agent_card
63
+ from slima2a.client_transport import SRPCTransport, ClientConfig
64
+
65
+ def channel_factory(topic) -> SRPCChannel:
66
+ channel = srpc.Channel(
67
+ local="agntcy/demo/client",
68
+ remote="agntcy/demo/server",
69
+ slim={
70
+ "endpoint": "http://localhost:46357",
71
+ "tls": {
72
+ "insecure": True,
73
+ },
74
+ },
75
+ shared_secret="secret",
76
+ )
77
+ return channel
78
+
79
+ client_config = ClientConfig(
80
+ supported_transports=["JSONRPC", "srpc"],
81
+ streaming=args.stream,
82
+ httpx_client=httpx_client,
83
+ srpc_channel_factory=channel_factory,
84
+ )
85
+ client_factory = ClientFactory(client_config)
86
+ client_factory.register("srpc", SRPCTransport.create)
87
+
88
+ ac = minimal_agent_card("agntcy/demo/server", ["srpc"])
89
+ client = factory.create(ac)
90
+
91
+ try:
92
+ response = client.send_message(...)
93
+ except srpc.SRPCResponseError as e:
94
+ ...
95
+ ```
@@ -0,0 +1,190 @@
1
+ # SLIMA2A
2
+
3
+ SLIMA2A is a native integration of A2A built on top of SLIM. It utilizes SLIM
4
+ RPC and the SLIM RPC compiler to compile A2A protobuf file and generate the
5
+ necessary code to enable A2A functionality on SLIM.
6
+
7
+ # What is SLIM RPC and SLIM RCP compiler
8
+
9
+ SLIM RPC (SLIM Remote Procedure Call) is a framework that enables Protocol
10
+ Buffers (protobuf) Remote Procedure Calls (RPC) over SLIM. This is similar to
11
+ gRPC, which uses HTTP/2 as its transport layer for protobuf-based RPC. More
12
+ information can be found [here](../slimrpc/README.md)
13
+
14
+ To compile a protobuf file and generate the clients and service stub you can use
15
+ the [SLIM RPC compiler](../../../srpc-compiler/README.md). This works in a
16
+ similar way to the protoc compiler.
17
+
18
+ For SLIM A2A we compiled the
19
+ [a2a.proto](https://github.com/a2aproject/A2A/blob/main/specification/grpc/a2a.proto)
20
+ file using the SLIM RPC compiler. The generated code is in
21
+ [a2a_pb2_srpc.py](./slima2a/types/a2a_pb2_srpc.py).
22
+
23
+ # How to use SLIM A2A
24
+
25
+ Using SLIM A2A is very similar to using the standard A2A implementation. As a
26
+ reference example here we use the [travel planner
27
+ agent](https://github.com/a2aproject/a2a-samples/tree/main/samples/python/agents/travel_planner_agent)
28
+ available on the A2A samples repo. The version adapted to use SLIM A2A can be
29
+ found in [travel_planner_agent](./examples/travel_planner_agent/) folder. In the
30
+ following section, we highlight and explain the key differences between the
31
+ standard and SLIM A2A implementations.
32
+
33
+ ## Travel Planner: Server
34
+
35
+ In this section we highlight the main differences between the SLIM A2A
36
+ [server](./examples/travel_planner_agent/server.py) implementation with respect
37
+ to the original implementation in the A2A repository.
38
+
39
+ 1. Import the SRPC package
40
+
41
+ ```python
42
+ import srpc
43
+ ```
44
+
45
+ 2. Create the SRPCHandler. Notice that the definitions for `AgentCard` and
46
+ `DefaultRequestHandler` remain unchanged from the original A2A example
47
+
48
+ ```python
49
+ agent_card = AgentCard(
50
+ name="travel planner Agent",
51
+ description="travel planner",
52
+ url="http://localhost:10001/",
53
+ version="1.0.0",
54
+ default_input_modes=["text"],
55
+ default_output_modes=["text"],
56
+ capabilities=AgentCapabilities(streaming=True),
57
+ skills=[skill],
58
+ )
59
+
60
+ request_handler = DefaultRequestHandler(
61
+ agent_executor=TravelPlannerAgentExecutor(),
62
+ task_store=InMemoryTaskStore(),
63
+ )
64
+
65
+ servicer = SRPCHandler(agent_card, request_handler)
66
+ ```
67
+
68
+ 3. Setup the srcp.Server. This is the only place where you need to setup few
69
+ parameters that are specific to SLIM
70
+
71
+ ```python
72
+ server = srpc.Server(
73
+ local="agntcy/demo/travel_planner_agent",
74
+ slim={
75
+ "endpoint": "http://localhost:46357",
76
+ "tls": {
77
+ "insecure": True,
78
+ },
79
+ },
80
+ shared_secret="secret",
81
+ )
82
+ ```
83
+
84
+ • local: Name of the local application.
85
+ • slim: Dictionary specifying how to connect to the SLIM node.
86
+ • shared_secret: Used to set up MLS (Message Layer Security).
87
+
88
+ For more information about these settings, see the SLIM RCP
89
+ [README](../slimrpc/README.md).
90
+
91
+ 4. Register the Service
92
+
93
+ ```python
94
+ add_A2AServiceServicer_to_server(
95
+ servicer,
96
+ server,
97
+ )
98
+ ```
99
+
100
+ Your A2A server is now ready to run on SLIM.
101
+
102
+ ## Travel Planner: Client
103
+
104
+ These are the main differences between the
105
+ [client](./examples/travel_planner_agent/client.py) using SLIM A2A and the
106
+ standard one.
107
+
108
+ 1. Create a channel. This requires a configuration that is similar to the server
109
+
110
+ ```python
111
+ def channel_factory(topic: str) -> srpc.Channel:
112
+ channel = srpc.Channel(
113
+ local="agntcy/demo/client",
114
+ remote=topic,
115
+ slim={
116
+ "endpoint": "http://localhost:46357",
117
+ "tls": {
118
+ "insecure": True,
119
+ },
120
+ },
121
+ shared_secret="secret",
122
+ )
123
+ return channel
124
+ ```
125
+
126
+ 2. Add SLIM RPC in the supported transports.
127
+
128
+ ```python
129
+ client_config = ClientConfig(
130
+ supported_transports=["JSONRPC", "srpc"],
131
+ streaming=True,
132
+ httpx_client=httpx_client,
133
+ srpc_channel_factory=channel_factory,
134
+ )
135
+ client_factory = ClientFactory(client_config)
136
+ client_factory.register("srpc", SRPCTransport.create)
137
+ agent_card = minimal_agent_card("agntcy/demo/travel_planner_agent", ["srpc"])
138
+ client = client_factory.create(card=agent_card)
139
+ ```
140
+
141
+ <!--
142
+ ```
143
+ from a2a.server.request_handlers import DefaultRequestHandler
144
+
145
+ agent_executor = MyAgentExecutor()
146
+ request_handler = DefaultRequestHandler(
147
+ agent_executor=agent_executor, task_store=InMemoryTaskStore()
148
+ )
149
+
150
+ servicer = SRPCHandler(agent_card, request_handler)
151
+
152
+ server = slimrpc.server()
153
+ a2a_pb2_slimrpc.add_A2AServiceServicer_to_server(
154
+ servicer
155
+ server,
156
+ )
157
+
158
+ await server.start()
159
+ ```
160
+
161
+ ## Client Usage
162
+
163
+ ```
164
+ from slimrpc import SRPCChannel
165
+ from a2a.client import ClientFactory, minimal_agent_card
166
+ from slima2a.client_transport import SRPCTransport, ClientConfig
167
+
168
+ def channel_factory(topic) -> SRPCChannel:
169
+ channel = SRPCChannel(
170
+ local=local,
171
+ slim=slim,
172
+ enable_opentelemetry=enable_opentelemetry,
173
+ shared_secret=shared_secret,
174
+ )
175
+ await channel.connect(topic)
176
+ return channel
177
+
178
+ clientConfig = ClientConfig(slimrpc_channel_factor=channel_factor)
179
+
180
+ factory = ClientFactory(clientConfig)
181
+ factory.register('slimrpc', SRPCTransport.create)
182
+ ac = minimal_agent_card(topic, ["slimrpc"])
183
+ client = factory.create(ac)
184
+
185
+ try:
186
+ response = client.send_message(...)
187
+ except slimrpc.SRPCResponseError as e:
188
+ ...
189
+ ```
190
+ --->
@@ -0,0 +1,76 @@
1
+ # SLIMA2A
2
+
3
+ SLIMA2A is a native integration of A2A built on top of SLIM.
4
+
5
+ ## Server usage
6
+
7
+ ```python
8
+ import srpc
9
+ from a2a.server.request_handlers import DefaultRequestHandler
10
+ from slima2a.handler import SRPCHandler
11
+ from slima2a.types.a2a_pb2_srpc import add_A2AServiceServicer_to_server
12
+
13
+ agent_executor = MyAgentExecutor()
14
+ request_handler = DefaultRequestHandler(
15
+ agent_executor=agent_executor, task_store=InMemoryTaskStore()
16
+ )
17
+
18
+ servicer = SRPCHandler(agent_card, request_handler)
19
+
20
+ server = srpc.Server(
21
+ local="agntcy/demo/server",
22
+ slim={
23
+ "endpoint": "http://localhost:46357",
24
+ "tls": {
25
+ "insecure": True,
26
+ },
27
+ },
28
+ shared_secret="secret",
29
+ )
30
+
31
+ a2a_pb2_srpc.add_A2AServiceServicer_to_server(
32
+ servicer
33
+ server,
34
+ )
35
+
36
+ await server.start()
37
+ ```
38
+
39
+ ## Client Usage
40
+
41
+ ```python
42
+ from srpc import SRPCChannel
43
+ from a2a.client import ClientFactory, minimal_agent_card
44
+ from slima2a.client_transport import SRPCTransport, ClientConfig
45
+
46
+ def channel_factory(topic) -> SRPCChannel:
47
+ channel = srpc.Channel(
48
+ local="agntcy/demo/client",
49
+ remote="agntcy/demo/server",
50
+ slim={
51
+ "endpoint": "http://localhost:46357",
52
+ "tls": {
53
+ "insecure": True,
54
+ },
55
+ },
56
+ shared_secret="secret",
57
+ )
58
+ return channel
59
+
60
+ client_config = ClientConfig(
61
+ supported_transports=["JSONRPC", "srpc"],
62
+ streaming=args.stream,
63
+ httpx_client=httpx_client,
64
+ srpc_channel_factory=channel_factory,
65
+ )
66
+ client_factory = ClientFactory(client_config)
67
+ client_factory.register("srpc", SRPCTransport.create)
68
+
69
+ ac = minimal_agent_card("agntcy/demo/server", ["srpc"])
70
+ client = factory.create(ac)
71
+
72
+ try:
73
+ response = client.send_message(...)
74
+ except srpc.SRPCResponseError as e:
75
+ ...
76
+ ```
@@ -0,0 +1,20 @@
1
+ # Copyright AGNTCY Contributors (https://github.com/agntcy)
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ ---
5
+
6
+ version: '3'
7
+
8
+ includes:
9
+ python:
10
+ taskfile: ../../../../tasks/python.yaml
11
+ vars:
12
+ UV_ARGS: '--package slima2a'
13
+
14
+ tasks:
15
+ generate_a2a_types:
16
+ desc: |
17
+ Generate the a2a protobuf lib
18
+ cmds:
19
+ - |
20
+ buf generate
@@ -0,0 +1,24 @@
1
+ ---
2
+ version: v2
3
+ inputs:
4
+ - git_repo: https://github.com/a2aproject/A2A.git
5
+ ref: main
6
+ subdir: specification/grpc
7
+ managed:
8
+ enabled: true
9
+ plugins:
10
+ # Generate python protobuf related code
11
+ # Generates _pb2_slimrpc.py files
12
+
13
+ # TODO: this should be downloaded from a released plugin version
14
+ - local: ../../target/debug/protoc-slimrpc-plugin
15
+ out: slima2a/types
16
+ opt:
17
+ - 'types_import=from a2a.grpc import a2a_pb2 as a2a__pb2'
18
+
19
+ # Generates *_pb2.py files, one for each .proto
20
+ #- remote: buf.build/protocolbuffers/python:v29.3
21
+ # out: slima2a/types
22
+ # Generates *_pb2.pyi files.
23
+ #- remote: buf.build/protocolbuffers/pyi:v31.1
24
+ # out: slima2a/types
@@ -0,0 +1,67 @@
1
+ # Copyright AGNTCY Contributors (https://github.com/agntcy)
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ [project]
5
+ name = "slima2a"
6
+ version = "0.1.0"
7
+ description = "A2A protocol over slimrpc"
8
+ readme = "README_pypi.md"
9
+ requires-python = ">=3.10, <4.0"
10
+ dependencies = ["a2a-sdk[telemetry]>=0.3.0", "slimrpc==0.1.0"]
11
+ classifiers = [
12
+ "Development Status :: 3 - Alpha",
13
+
14
+ # Indicate who your project is intended for
15
+ "Intended Audience :: Developers",
16
+ "Topic :: Software Development :: Libraries",
17
+
18
+ # Specify the Python versions you support here.
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ ]
24
+
25
+ [project.urls]
26
+ Repository = "https://github.com/agntcy/slim"
27
+ Issues = "https://github.com/agntcy/slim/issues"
28
+ Changelog = "https://github.com/agntcy/slim/blob/main/data-plane/python/integrations/slima2a/CHANGELOG.md"
29
+
30
+ [dependency-groups]
31
+ linting = ["ruff>=0.12", "mypy>=1.17.0", "types-protobuf>=6.30.2.20250822"]
32
+ testing = ["pytest>=8.3.4"]
33
+ examples = [
34
+ "langchain-core",
35
+ "langchain-openai",
36
+ "typing-extensions",
37
+ "uvicorn>=0.34.2",
38
+ ]
39
+
40
+ # Default groups to install when running `uv sync`
41
+ [tool.uv]
42
+ default-groups = ["linting", "testing", "examples"]
43
+
44
+ [tool.uv.sources]
45
+ slimrpc = { workspace = true }
46
+
47
+ [tool.ruff.format]
48
+ exclude = ["*_pb2.py", "*_pb2.pyi", "*_pb2_slimrpc.py"]
49
+
50
+ [tool.ruff.lint]
51
+ extend-select = ["I", "ASYNC", "SIM", "B", "ANN"]
52
+ exclude = ["*_pb2.py", "*_pb2.pyi", "*_pb2_slimrpc.py"]
53
+
54
+ [build-system]
55
+ requires = ["hatchling"]
56
+ build-backend = "hatchling.build"
57
+
58
+ [tool.hatch.build.targets.wheel]
59
+ packages = ["slima2a"]
60
+ exclude = ["examples"]
61
+
62
+ [tool.hatch.build.targets.sdist]
63
+ exclude = ["examples"]
64
+
65
+ [[tool.mypy.overrides]]
66
+ module = ["google.rpc.*"]
67
+ follow_untyped_imports = true
File without changes