Skip to content

feat: add task get --wait to poll an async task to completion #30

Description

@msampathkumar

Goal: Let a caller follow an already-started task to completion with one command.
User story: As a CI author who started a task with --async, I want task get --wait to block until it finishes, so that a later step can wait for the result without a hand-written poll loop.

Priority: P1 · Area: CLI code

Problem

a2a task get is one-shot only. After starting a task with a2a send --async, there is no built-in way to block until it finishes — the caller must hand-roll a poll loop.

$ a2a task get sometask --wait ...
Error: unknown flag: --wait
$ a2a task get sometask --poll-interval 2s ...
Error: unknown flag: --poll-interval

Proposed behavior

Add a --wait flag to task get, with polling controls:

a2a task get <taskId> --wait --poll-interval 2s --timeout 60s
  • Polls until the task reaches a terminal state (COMPLETED/FAILED/CANCELED/REJECTED).
  • Stops immediately on an interrupted state (INPUT_REQUIRED/AUTH_REQUIRED) so the caller can act.
  • --poll-interval (suggested default 2s) and --timeout; on timeout, exit non-zero with a timeout error.
  • Bounded backoff, no busy-loop; interruptible without losing the already-printed identifiers.
  • Where the agent supports streaming, a wait MAY prefer streaming and fall back to polling.

Who benefits

  • CI/CD jobs that fire a2a send --async and later block on the result.
  • AI coding agents that start long tasks and wait for completion without ad-hoc sleep loops.

Acceptance criteria

  • task get --wait polls to a terminal state and returns the final task.
  • It returns promptly on INPUT_REQUIRED and AUTH_REQUIRED.
  • --poll-interval and --timeout are honored; timeout exits non-zero.
  • The flag name is consistent with the existing send polling flag (see note).

Environment

  • CLI version: a2a version v0.0.0-…1e29dfe94f95+dirty
  • OS: Linux x86_64

Notes

send currently exposes --polling-interval (default 5s); please converge on a single flag spelling across send and task get. Before implementing, check whether a polling helper is already provided by the underlying a2a-go/v2 SDK so it isn't re-implemented.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Priority 1 — missing capability that limits real useenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions