Files
Kristopher Overholt 58f3aaebca Replace documentation URLs and paths for adk.dev migration (#1536)
* Replace google.github.io/adk-docs URLs and /adk-docs/ paths with adk.dev

Migrate all hardcoded documentation references to use the new custom
domain. Update root-relative links to remove the /adk-docs/ subpath
prefix since the site will be served from the root of adk.dev.

* Additional fixes
2026-04-01 12:48:27 -05:00

3.7 KiB

catalog_title, catalog_description, catalog_icon, catalog_tags
catalog_title catalog_description catalog_icon catalog_tags
Pub/Sub Tools Publish, pull, and acknowledge messages from Google Cloud Pub/Sub /integrations/assets/pubsub.png
google

Google Cloud Pub/Sub tool for ADK

Supported in ADKPython v1.22.0

The PubSubToolset allows agents to interact with Google Cloud Pub/Sub service to publish, pull, and acknowledge messages.

Prerequisites

Before using the PubSubToolset, you need to:

  1. Enable the Pub/Sub API in your Google Cloud project.
  2. Authenticate and authorize: Ensure that the principal (e.g., user, service account) running the agent has the necessary IAM permissions to perform Pub/Sub operations. For more information on Pub/Sub roles, see the Pub/Sub access control documentation.
  3. Create a topic or subscription: Create a topic to publish messages and create a subscription to receive them.

Usage

--8<-- "examples/python/snippets/tools/built-in-tools/pubsub.py"

Tools

The PubSubToolset includes the following tools:

publish_message

Publishes a message to a Pub/Sub topic.

Parameter Type Description
topic_name str The name of the Pub/Sub topic (e.g., projects/my-project/topics/my-topic).
message str The message content to publish.
attributes dict[str, str] (Optional) Attributes to attach to the message.
ordering_key str (Optional) The ordering key for the message. If you set this parameter, messages are published in order.

pull_messages

Pulls messages from a Pub/Sub subscription.

Parameter Type Description
subscription_name str The name of the Pub/Sub subscription (e.g., projects/my-project/subscriptions/my-sub).
max_messages int (Optional) The maximum number of messages to pull. Defaults to 1.
auto_ack bool (Optional) Whether to automatically acknowledge the messages. Defaults to False.

acknowledge_messages

Acknowledges one or more messages on a Pub/Sub subscription.

Parameter Type Description
subscription_name str The name of the Pub/Sub subscription (e.g., projects/my-project/subscriptions/my-sub).
ack_ids list[str] A list of acknowledgment IDs to acknowledge.