Skip to main content

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.1.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slima2a-0.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file slima2a-0.1.0.tar.gz.

File metadata

  • Download URL: slima2a-0.1.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for slima2a-0.1.0.tar.gz
Algorithm Hash digest
SHA256 173e6302d86d8b2f25825f710ee1c38178897324498c6bac0f028f155d79192e
MD5 c67258b276347433ac9a1d078e3a83ce
BLAKE2b-256 13ed39c831ff31efa3f9d596560790c12f23c2036befeaa87fbddd3d0d782235

See more details on using hashes here.

File details

Details for the file slima2a-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: slima2a-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for slima2a-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee6bd120f490345d45c38f1159d65ad65409a59d1710ba45838d2f634e8b3245
MD5 e39b935069207528d479fc37f981cd16
BLAKE2b-256 ac1c6d5d8cd3ade035f9123733799489e853316c127201e973dce5d388dbf59b

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