Skip to content

docs(runtime): show deduplicating trigger redeliveries by delivery ID - #2274

Open
devansh173 wants to merge 4 commits into
google:mainfrom
devansh173:docs/trigger-redelivery-side-effects
Open

devansh173 wants to merge 4 commits into
google:mainfrom
devansh173:docs/trigger-redelivery-side-effects

Conversation

@devansh173

@devansh173 devansh173 commented Sep 28, 2026 •

Copy link
Copy Markdown

Description

Documents the trigger_delivery session state key that google/adk-python#7325 adds to the Pub/Sub and Eventarc trigger endpoints, so tools can deduplicate redelivered events.

This PR builds on #2275, which adds the Redeliveries and side effects section (ack deadline, Cloud Run timeout, dead-letter topic, Eventarc) for current releases. Until #2275 merges, this PR's diff includes its commits too. The change specific to this PR is the last commit, which adds a Deduplicate with the delivery ID subsection to that section:

  • A Python tab listing the trigger_delivery fields (source, id, and subscription / publish_time for Pub/Sub or event_source / type for Eventarc).
  • Why id alone is not enough: it is unique only within its topic or event source, so the key includes subscription or event_source.
  • A tool that passes an idempotency key built from it to the provider. The key is used at the provider, not stored in session state, since state starts empty on every delivery.

Related

Merge timing: google/adk-python#7325 is not released yet, so please hold merging until it ships. I'll add the "Supported in ADK" version for this subsection then, and rebase onto main once #2275 is in.

Testing

A redelivered Pub/Sub or Eventarc event runs the agent again in a new
session, so a tool's side effect from an earlier attempt happens again.
Explain when redelivery happens and how to limit it on current releases:
an ack deadline above the longest run with a matching Cloud Run request
timeout, a dead-letter topic with the Pub/Sub service agent's roles, the
same settings on an Eventarc trigger's subscription, and idempotent tools
that deduplicate outside session state.

Related: google/adk-python#7322
@devansh173
devansh173 force-pushed the docs/trigger-redelivery-side-effects branch from 885decf to b517386 Compare September 28, 2026 11:52
@devansh173 devansh173 changed the title docs(runtime): explain how trigger redeliveries repeat side effects docs(runtime): show deduplicating trigger redeliveries by delivery ID Sep 28, 2026
The dead-letter update, the two add-iam-policy-binding commands and the
Eventarc trigger lookup lost their trailing backslashes, so each rendered
as one long line with runs of spaces. Split them back across lines like
the other multi-line commands on the page.
Python trigger endpoints store the delivery's identity in session state
under trigger_delivery. Document its fields and show a tool that builds
a provider idempotency key from the subscription or event source and
the id, which stays the same across redeliveries.

Related: google/adk-python#7322
@devansh173
devansh173 force-pushed the docs/trigger-redelivery-side-effects branch from b517386 to 0ac06c9 Compare September 28, 2026 12:28
…ivery example

Check, act and record against a store still pays twice after an
ambiguous failure or an overlapping redelivery. Say to prefer the
provider's idempotency key, as the example does; otherwise reserve the
key atomically before the effect and plan for reconciling an ambiguous
attempt. Let a key-in-use error propagate so the message is nacked.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant