Skip to content

Add an optional A2A client for messages and tasks - #6123

Merged
markstuart-oai merged 8 commits into
feat/simple-codexfrom
feat/remote-agent-tools
Nov 24, 2026
Merged

markstuart-oai merged 8 commits into
feat/simple-codexfrom
feat/remote-agent-tools

Conversation

@markstuart-oai

@markstuart-oai markstuart-oai commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An A2A service can reply immediately or return a task to check later. The optional A2AClient supports both replies. Install the a2a extra and import the client from agents.extensions.a2a.

from uuid import uuid4

from a2a.types import Message, Task

from agents.extensions.a2a import A2AClient

async def ask(client: A2AClient, question: str) -> Message | Task:
    return await client.send_message(question, message_id=uuid4().hex)
  • send_message sends once. It returns a standard A2A 1.0 Message or Task. A direct reply needs no follow-up request.
  • refresh_task(task) reads a task once. With saved IDs, use get_task(task_id=..., context_id=...). Both methods check that the returned IDs match.
  • The client checks the approved RPC URL against a stored or fetched Agent Card. Separate token providers authorize card and RPC requests. A2AError.reason identifies the failure. A timeout or cancellation can leave the remote outcome unknown. The client never retries, polls or cancels remote work on its own.

The guide shows how to handle both replies. Its optional manager uses ordinary function tools. For recovery after a lost reply, the manager requires a task, a trusted receipt, a cooperating service and a current grant. It returns only an authorized yes/no verdict. A message ID alone cannot prevent duplicate work.

Test plan

  • Exercised 28 A2A tests and 11 cases from the guide against local peers, including both reply types, mismatched IDs, cancellation and recovery without resending.
  • Checked the public return type with mypy and Pyright. Compared a direct reply with the official client using the same local peer.
  • Ran the repository verification script and checked the prospective release contract. No live service calls.

Checks

  • Added regression tests and updated the example
  • Completed two independent reviews
  • Passed formatting, lint, type checks and repository tests

Add an optional Python extra for A2A with no changes to existing dependency versions or the native bridge.
@markstuart-oai
markstuart-oai requested review from a team, rm-openai and seratch as code owners November 21, 2026 05:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T20:52:02.293389Z b4b4648 New commits
🔒 Security Review ✅ Completed 2026-11-24T20:53:06.578378Z b4b4648 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jbeckwith-oai jbeckwith-oai left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved after comprehensive static review and an independent second review. Reviewed the optional A2A adapter, A2A 1.0 JSON-RPC wire shapes, fixed endpoint/card matching, separate credential suppliers and clients, bounded request/response handling, cancellation and timeout behavior, dependency integration, and manager recovery example. Durable reservations prevent automatic resend; recovery checks owner, endpoint, message, digest, task/context and trusted verdict before returning a result. No actionable findings.

Static review only; no candidate code or local tests executed.

Hosted check snapshot: {"SUCCESS": 18, "IN_PROGRESS": 6}. Unfinished checks remain pending.

Hosted CI completion: 33 checks passed, 2 skipped; no pending or failed checks.

Refresh follow-up (2026-11-22 21:45 UTC): rechecked current commit fd2935decbc31c83a92bdd4bf97c7deccdeeca30 against the prior reviewed patch and new base. Added/deleted patch lines are unchanged; surrounding integration context was reviewed with no actionable regression found. GitHub already associates this approval with the current commit; no duplicate review submitted. Earlier CI results above describe the prior commit. Current hosted CI: 5 in_progress, 19 success. Unfinished checks remain pending follow-up. Static review only; no candidate code or local tests executed.

Hosted CI follow-up (2026-11-22 22:10 UTC): current commit fd2935decbc31c83a92bdd4bf97c7deccdeeca30 completed with 33 successful checks and 2 skipped checks. No failures. Static review only; no local tests executed.

@markstuart-oai markstuart-oai changed the title feat: add an optional A2A adapter for remote specialist tools feat: add an optional A2A task client Nov 23, 2026

@jbeckwith-oai jbeckwith-oai left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved after static re-review of e2a3461 and an independent review. The new A2ATaskClient, send_message and get_task names are consistent across exports, implementation, manager example, documentation and tests. The underlying endpoint/card binding, credential separation, bounded I/O, task/context validation and reservation-before-send behavior are unchanged. Reviewed the refreshed base integration; no actionable findings.

Hosted CI at publication: 21 checks passed, 3 running. Unfinished checks remain tracked. Static review only; no candidate code or local tests executed.

CI follow-up (November 23): all hosted checks at this reviewed commit have completed: 33 passed and 2 skipped, including all eight wheel verifiers. The pending CI follow-up above is resolved. No candidate code or local tests executed.

Update feat/remote-agent-tools against feat/simple-codex.

@jbeckwith-oai jbeckwith-oai left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved after static re-review and an independent second review. refresh_task copies the task/context identifiers, drops the peer task before awaiting, and delegates one read to get_task with both identity checks preserved. Reviewed the full adapter's endpoint/card binding, credential separation, bounded exchange, cancellation, and payload-free error handling. The README checks pending state before refreshing and does not imply polling, replay safety, or authorization from the task alone. Regression tests cover one read, unchanged input, and mismatched task/context IDs. No actionable findings.

Hosted CI at review: 17 checks passed and 7 running, with no failures. Remaining checks require follow-up. Static review only; no candidate code or local tests executed.

Hosted CI follow-up (2026-11-24 03:32 UTC): all checks at this reviewed commit are complete: 33 passed and 2 skipped, with no failures. The pending CI follow-up is resolved. Static review only; no candidate code or local tests executed.

@jbeckwith-oai jbeckwith-oai left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved after static re-review and an independent second review. reserved_calls limits the query to the authenticated owner and run, then checks the current specialist grant and exact saved endpoint before returning call/name pairs. It makes no network requests or new reservations, and recover independently rechecks grants and receipt identity. Tests cover revoked grants, changed endpoints, owner/run isolation, and authorized subsets. Documentation correctly distinguishes reservations from verified outcomes. No actionable findings.

Hosted CI at review: 17 passed and 7 running, with no failures. Remaining checks require follow-up. Static review only; no candidate code or local tests executed.

Hosted CI follow-up (2026-11-24 06:27 UTC): all checks at this reviewed commit are complete: 33 passed and 2 skipped, with no failures. The pending CI follow-up is resolved. Static review only; no candidate code or local tests executed.

Update feat/remote-agent-tools against feat/simple-codex.

@jbeckwith-oai jbeckwith-oai left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the refreshed A2A documentation against the existing adapter and manager, including independent review. The direct-call example uses a caller-owned message ID, sends once, checks progress at most once and validates completed verdict output. It clearly distinguishes direct calls from reservation-based recovery and preserves authorization and uncertain-delivery/no-resend guidance. No actionable findings. Hosted CI inspected: 5 passed, 19 running.

Other refresh changes incorporate the previously reviewed merged RunBudget base. Hosted checks remain tracked. Static review only; no candidate code or local tests executed.

Hosted CI update (2026-11-24 07:47 UTC): 33 passed, 2 skipped; no checks remain pending in the current rollup. Approval is unchanged. No local tests were run.

Update feat/remote-agent-tools against feat/simple-codex.
@markstuart-oai markstuart-oai changed the title feat: add an optional A2A task client Add an optional A2A client for messages and tasks Nov 24, 2026

@jbeckwith-oai jbeckwith-oai left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved after comprehensive static re-review and an independent second review. Reviewed both direct Message and Task reply paths, protobuf type compatibility, response correlation and malformed-envelope checks, endpoint/card binding, separate credential providers, bounded I/O and cancellation, and AgentsException integration. The receipt manager preserves its pre-send reservation after a direct Message and recovers tasks through verified receipts without a second send. Documentation and regression cases match these boundaries. No actionable findings.

Hosted checks at publication: {"in_progress": 15, "success": 9}. Unfinished checks remain tracked. Static review only; no candidate code or local tests executed.

Hosted CI completion (2026-11-24 21:16 UTC): all current checks completed with 33 passed and 2 skipped, no failures. This CI follow-up is resolved. No local tests ran.

@markstuart-oai
markstuart-oai merged commit 568bf14 into feat/simple-codex Nov 24, 2026
37 checks passed
@markstuart-oai
markstuart-oai deleted the feat/remote-agent-tools branch November 24, 2026 23:02
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.

2 participants