A2A protocol over slimrpc
Project description
SLIMA2A
SLIMA2A is a native integration of A2A built on top of SLIM.
Server usage
import srpc
from a2a.server.request_handlers import DefaultRequestHandler
from slima2a.handler import SRPCHandler
from slima2a.types.a2a_pb2_srpc import add_A2AServiceServicer_to_server
agent_executor = MyAgentExecutor()
request_handler = DefaultRequestHandler(
agent_executor=agent_executor, task_store=InMemoryTaskStore()
)
servicer = SRPCHandler(agent_card, request_handler)
server = srpc.Server(
local="agntcy/demo/server",
slim={
"endpoint": "http://localhost:46357",
"tls": {
"insecure": True,
},
},
shared_secret="secret",
)
a2a_pb2_srpc.add_A2AServiceServicer_to_server(
servicer
server,
)
await server.start()
Client Usage
from srpc import SRPCChannel
from a2a.client import ClientFactory, minimal_agent_card
from slima2a.client_transport import SRPCTransport, ClientConfig
def channel_factory(topic) -> SRPCChannel:
channel = srpc.Channel(
local="agntcy/demo/client",
remote="agntcy/demo/server",
slim={
"endpoint": "http://localhost:46357",
"tls": {
"insecure": True,
},
},
shared_secret="secret",
)
return channel
client_config = ClientConfig(
supported_transports=["JSONRPC", "srpc"],
streaming=args.stream,
httpx_client=httpx_client,
srpc_channel_factory=channel_factory,
)
client_factory = ClientFactory(client_config)
client_factory.register("srpc", SRPCTransport.create)
ac = minimal_agent_card("agntcy/demo/server", ["srpc"])
client = factory.create(ac)
try:
response = client.send_message(...)
except srpc.SRPCResponseError as e:
...
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
slima2a-0.2.1.tar.gz
(10.4 kB
view details)
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 slima2a-0.2.1.tar.gz.
File metadata
- Download URL: slima2a-0.2.1.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c521c83c896dc3d7c2d19827234c4fbda4dedecf9cb981f80aca2e5cc9fc8b7f
|
|
| MD5 |
f85638c3fd5c2ca15ae493cd8e86b8d3
|
|
| BLAKE2b-256 |
d05d1a3a098943a2322c3eab50a4f7f40c47b95a37337026544d2c59547bbab2
|
File details
Details for the file slima2a-0.2.1-py3-none-any.whl.
File metadata
- Download URL: slima2a-0.2.1-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a5267fceed70210d48e3882577e7e418f762620f4d0044c8245655cd4cff832
|
|
| MD5 |
ba4772fa3bd55cd1b02858411db089a7
|
|
| BLAKE2b-256 |
8a4a38f1608f5043df73464fd374506f2a381192efd5d97ebeae0b7e35573ad3
|