Skip to main content

a2a-robots-ros2

An allowlisted ROS 2 bridge for a2a-robots: it exposes the ROS 2 actions, services and topics you list as A2A skills, for robot bring-up and debugging.

Install from PyPI: pip install a2a-robots-ros2.

This is not the typed robot skill agent. a2a_robots.RobotAdapter gives planners one contract (move_to, stop, the busy rule, safety limits, one result shape) on any robot; this bridge passes configured ROS calls through and adds no safety limits of its own. Anything physical, such as joint limits or an emergency stop, stays in the robot's ROS stack.

The bridge talks to ROS only through the RosGateway interface. RclpyGateway implements it for a live ROS 2 graph.

Allowlist

Each entry maps one skill to one ROS interface. Nothing else can be reached through the bridge.

from a2a_robots_ros2 import Ros2BridgeAdapter, serve_bridge
from a2a_robots_ros2.rclpy_gateway import RclpyGateway

skills = [
    {
        "id": "rotate",
        "kind": "action",
        "ros_name": "/turtle1/rotate_absolute",
        "type": "turtlesim/action/RotateAbsolute",
        "description": "Turn the turtle to an absolute heading in radians.",
    },
    {"id": "spawn", "kind": "service", "ros_name": "/spawn", "type": "turtlesim/srv/Spawn"},
    {"id": "pose", "kind": "topic", "ros_name": "/turtle1/pose", "type": "turtlesim/msg/Pose"},
]
serve_bridge(Ros2BridgeAdapter(skills, RclpyGateway()))  # http://127.0.0.1:9200/
Field Meaning
id Skill name callers use.
kind action, service, or topic (returns the latest message).
ros_name Absolute ROS name.
type Interface type, such as turtlesim/action/RotateAbsolute.
description Optional. Shown in the Agent Card.
timeout_s Optional. Bounds the whole call, including waiting for the server. Defaults: 60 s for actions, 10 s otherwise.
exclusive Optional. Refuse a new call to this skill while one is still running.

The allowlist is checked when the adapter is built, and the gateway loads every interface type then, so a typo or a missing message package fails at startup.

Requests and results

Requests are JSON, sent as a text part or a data part. args holds the goal or request fields, with nested messages as nested objects; a topic skill takes none.

{"skill": "rotate", "args": {"theta": 1.57}}
Kind Result
action {"skill": "rotate", "status": "succeeded", "result": {...}}, where status is succeeded, aborted or canceled
service {"skill": "spawn", "response": {...}}
topic {"skill": "pose", "message": {...}, "age_s": 0.04}, where age_s is the time since the message arrived

A goal that ran but did not succeed is a completed A2A task with its status, like a skill result with success: false. A malformed request, a rejected goal, a missing server or a timeout fails the task with the reason.

Feedback is streamed by default. The reply is then newline-delimited JSON in the response artifact: for an action an accepted line, then feedback lines (at most 2 per second; set max_feedback_hz; feedback that arrives before acceptance is held until the accepted line), then the result as the last line. Feedback appears in the response artifact, not as task status messages. With stream_feedback=False the reply is just the result, as JSON text and as an application/json data part.

Cancel and timeouts

  • tasks/cancel cancels the goal and waits for the action server's answer before the task is reported cancelled. A cancel that arrives while the goal is still being sent cancels it as soon as it is accepted. A timeout or shutdown cancels the goal too.
  • If the server does not confirm the cancel within cancel_timeout_s (5 s by default), or the cancel fails, the bridge logs that the goal may still be running and tries again when the call stops and on shutdown. The call then waits for the goal to end, even past the skill's timeout_s and when the stream is closed. If the goal has not ended within a2a-adapter's cancel wait (10 s), tasks/cancel returns the task failed with that message instead of cancelled.
  • ROS 2 services cannot be cancelled. Cancelling a service task, or its timeout, stops the wait, but the call may still complete on the robot.
  • serve_bridge() binds 127.0.0.1 by default, because anyone who can reach the server can move the robot.

ROS 2

rclpy is not on PyPI. It comes with a ROS 2 install and is built for that distribution's Python, so it is not a dependency of this package. ROS 2 Jazzy (Python 3.12) and newer are supported; Humble (Python 3.10) is below the Python 3.11 minimum.

To use RclpyGateway, source ROS 2 and use a virtual environment on the ROS Python that can see its packages:

source /opt/ros/jazzy/setup.bash
uv venv --system-site-packages --python /usr/bin/python3
uv pip install ./packages/a2a-robots-ros2  # from a checkout of this repository

RclpyGateway(node_name="a2a_ros2_bridge") creates one node in its own rclpy context and spins it on a background thread, so ROS callbacks never block the A2A server. The interface packages named in the allowlist (for example turtlesim) must be installed and sourced.

  • Topics are read with the sensor-data QoS (best effort, keep last 5), which matches both reliable and best-effort publishers. A read returns the latest message, or waits for the first one.
  • Args are set with rosidl_runtime_py.set_message_fields; a field that does not fit the message fails the task without calling ROS.
  • The bridge waits for an action or service server within the skill's timeout_s.

Try it with turtlesim

examples/turtlesim_bridge.py allowlists turtlesim's rotate_absolute action, the teleport_absolute and spawn services and the pose topic. With ROS 2 Jazzy, ros-jazzy-turtlesim installed and the virtual environment from ROS 2, run each in its own shell with ROS 2 sourced:

ros2 run turtlesim turtlesim_node
python packages/a2a-robots-ros2/examples/turtlesim_bridge.py  # http://127.0.0.1:9200/

The Agent Card at http://127.0.0.1:9200/.well-known/agent-card.json lists the four skills. Turn the turtle:

curl -s http://127.0.0.1:9200/ -H 'Content-Type: application/json' -d '{
  "jsonrpc": "2.0", "id": 1, "method": "message/send",
  "params": {"message": {"role": "user", "messageId": "m1", "parts": [
    {"kind": "text", "text": "{\"skill\": \"rotate\", \"args\": {\"theta\": 1.57}}"}]}}}' \
  | jq -j '.result.artifacts[0].parts[].text'
{"skill": "rotate", "status": "accepted"}
{"skill": "rotate", "feedback": {"remaining": 1.5700000524520874}}
{"skill": "rotate", "feedback": {"remaining": 1.058000087738037}}
{"skill": "rotate", "feedback": {"remaining": 0.5460000038146973}}
{"skill": "rotate", "feedback": {"remaining": 0.03400003910064697}}
{"skill": "rotate", "status": "succeeded", "result": {"delta": -1.5520000457763672}}

Use a new messageId for each request. Other requests: {"skill": "pose"}, {"skill": "teleport", "args": {"x": 2.0, "y": 3.0, "theta": 0.0}} and {"skill": "spawn", "args": {"x": 8.0, "y": 8.0, "theta": 0.0}}. Stopping the server shuts the ROS node down.

Tests

The bridge tests use a fake RosGateway, so they need no ROS install:

uv run --directory packages/a2a-robots-ros2 --extra dev pytest

The RclpyGateway tests run against a live graph and are skipped without rclpy. The turtlesim example test starts a headless turtlesim_node (QT_QPA_PLATFORM=offscreen) and drives it over JSON-RPC. CI runs both in the ros:jazzy-ros-base image with ros-jazzy-example-interfaces and ros-jazzy-turtlesim installed:

source /opt/ros/jazzy/setup.bash
export UV_PROJECT_ENVIRONMENT=/opt/a2a-venv
uv venv --system-site-packages --python /usr/bin/python3 "$UV_PROJECT_ENVIRONMENT"
uv sync --locked --project packages/a2a-robots-ros2 --extra dev
A2A_ROBOTS_REQUIRE_ROS=1 uv run --no-sync --project packages/a2a-robots-ros2 pytest packages/a2a-robots-ros2

Metadata

Release files for a2a-robots-ros2 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for a2a-robots-ros2 0.1.2
File Size Uploaded Provenance Actions
a2a_robots_ros2-0.1.2.tar.gz 86.5 kB With provenance Details for a2a_robots_ros2-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for a2a-robots-ros2 0.1.2
File Interpreter ABI Platform Actions
a2a_robots_ros2-0.1.2-py3-none-any.whl Python 3 none any Details for a2a_robots_ros2-0.1.2-py3-none-any.whl

Total release size: 102.0 kB

Release files / a2a_robots_ros2-0.1.2.tar.gz

Download URL a2a_robots_ros2-0.1.2.tar.gz
Size 86.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7f12f26ac83db74861ff84bd3816f09acb21c82b76414fce71b9aff5ee1abe04
BLAKE2b-256 checksum
How to use checksums
097910d139ea592fb882bf5e43f05a5318487ff75a90f074ee50b204d6935c33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / a2a_robots_ros2-0.1.2-py3-none-any.whl

Download URL a2a_robots_ros2-0.1.2-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f69fc8e676ff99aefffbefd179500b7798d674889a0698f494bdce3f0e08c5e
BLAKE2b-256 checksum
How to use checksums
23bf25b0945cd7014a47bbe25da1c5bb1251b5fddbccf983cfc27fce161adad5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for a2a-robots-ros2 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for a2a_robots_ros2-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page