Skip to content

Conversation

@mrorigo
Copy link

@mrorigo mrorigo commented Jan 7, 2026

Summary

This PR introduces an extension proposal + runnable demo for A2A-SAGA, an A2A extension that standardizes:

  • reliable multi-step execution
  • durable orchestration
  • compensation / rollback contracts for multi-agent workflows

The change adds:

  1. A complete RFC describing the extension semantics and negotiation.
  2. A minimal Python orchestrator demo showing how a Saga orchestrator can coordinate A2A agents with compensations.

This is being submitted after two weeks of no feedback on the corresponding A2A Discussions proposal (#1324). The intent is to make it easy for reviewers to evaluate both the spec and the behavior concretely.

Why this is needed

Multi-agent workflows are increasingly used for distributed, heterogeneous systems, but reliability is still implemented ad-hoc:

  • partial failures are hard to recover from
  • long-running tasks need resumability
  • compensation requires explicit contracts

A2A’s extension mechanism explicitly supports introducing new interaction patterns and method/state-machine overlays without changing core types. A2A-SAGA uses this mechanism to define a strict reliability contract and negotiation flow.

What’s included

New files

  • extensions/saga/a2a-saga-extension-rfc.md
    RFC describing:

    • extension URI + negotiation
    • participant vs orchestrator capabilities
    • required/optional semantics
    • saga.step.* verbs + rollback contracts
    • example flows and states
  • extensions/saga/saga_orchestrator_demo.py
    Minimal orchestrator demo showing:

    • saga step execution
    • compensation handling on failure
    • status reporting + recovery behavior
    • extension negotiation via headers

Design notes / alignment with A2A

  • Follows the A2A extension model: explicit extension URI, negotiation, and structured behaviors rather than modifying core protocol types.
  • Adds reliability semantics via extension-level methods and orchestrator logic.
  • Intended as a reference design to encourage interoperable implementations across agent runtimes.

How to test

Run the demo orchestrator:

python extensions/saga/saga_orchestrator_demo.py

Related discussion

Reviewer notes

Feedback requested on:

  • whether the extension boundaries are appropriate (methods vs metadata)
  • naming and surface area (saga.step.* verbs, rollback method structure)
  • interoperability concerns with other extensions
  • whether the orchestrator demo should be migrated into a dedicated sample folder structure (instead of extensions/)

Thank you for the review — happy to iterate based on maintainer guidance.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @mrorigo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request proposes and demonstrates the A2A-SAGA extension, which aims to enhance the A2A protocol with robust mechanisms for managing complex, distributed multi-agent workflows. By defining explicit interaction patterns for execution, verification, and compensation, A2A-SAGA addresses critical reliability concerns such as partial failures and the need for durable, reversible operations. The inclusion of both a detailed specification and a functional demo provides a comprehensive view of the proposed solution.

Highlights

  • A2A-SAGA Extension Proposal: Introduces A2A-SAGA, an extension for the A2A protocol, standardizing reliable multi-step execution, durable orchestration, and compensation/rollback for multi-agent workflows.
  • Comprehensive RFC: A new RFC document (a2a-saga-extension-rfc.md) is added, detailing the extension's semantics, negotiation, JSON-RPC verbs (saga.step.execute, saga.step.verify, saga.step.compensate), error handling, parallel group semantics, idempotency, and normative JSON schemas and test vectors.
  • Runnable Orchestrator Demo: A minimal Python orchestrator demo (saga_orchestrator_demo.py) is included, showcasing how a Saga orchestrator can coordinate A2A agents, handle compensation on failure, manage status reporting, and perform extension negotiation via headers, based on the RFC's test vectors.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a well-defined RFC for A2A-SAGA and a clear Python demo orchestrator. The proposal is comprehensive and addresses an important need for reliable multi-agent workflows. My review includes a few suggestions for the RFC to improve schema consistency and validation. For the Python demo, I've provided some feedback to enhance code quality and robustness, such as removing unused code, improving type hints, and using more specific exception handling. Overall, this is a great contribution.

- Added 'steps' to `saga.start.params` as required
- Added conditional requirements to `saga.step.compensate.result`
- Removed unused `history` member in `SagaContext`
- Fixed type hint for `applied_steps_by_group`
- Introduced a `SagaFailedException`
- Q000: Replaced all double quotes with single quotes
- UP035: Replaced typing.List, typing.Dict with built-in list, dict
- D101: Added docstrings to ActionSpec, ExecuteSpec, CompensateSpec, StepDefinition, SagaDefinition, SagaContext, StepResult, SagaOrchestrator, and main()
- I001: Sorted imports alphabetically
- UP045: Replaced Optional[X] with X | None syntax throughout
- G004: f-string logging → % formatting
- N818: SagaFailedException → SagaFailedError
- INP001: Added extensions/saga/__init__.py
- SLF001: Added # noqa: SLF001 for intentional private access
- PLR0912: Refactored call_method using lookup table pattern
- TRY300/TRY301: Refactored run_saga - extracted _handle_group_failure helper and restructured try/except flow
- MD025 (Multiple H1): Removed duplicate top-level heading since the title is already defined in the YAML front matter.
- MD007 (Unordered list indentation):
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