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.2.2.tar.gz (10.6 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.2.2-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for slima2a-0.2.2.tar.gz
Algorithm Hash digest
SHA256 210d9d66f66052ffc6a74e6d39d10d947d6e5c90f75e3cc38a34295dbbbf0552
MD5 88cf1ad71097a7bb289c030bd67455b9
BLAKE2b-256 a6be8c1d3c0d8f097b74a595223f19ae8f3497d1a86eb78c14fbf26b60cbc32c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: slima2a-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 8.1 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.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ac5af2cdf0f51f415fdee110aa54717375340c19c72014f2eee2cdd6d11c862d
MD5 93dd384d1cfe54eb6ac21fdfd15bd6e8
BLAKE2b-256 17a773ccdcdff01f8e8702f25ae3866749e7f2f445dcce6d65ec5a6472139b4f

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