A2A Long-Running Tasks: Who Holds the Credential When the Agent Walks Away?
6 min read Fullmakt Team
- a2a
- agents
- credentials
- governance
- traceability
- authentication
- mcp
Short answer: an A2A task is a unit of work, and the credential that powers it should live exactly as long as the task does. Most agent deployments do the opposite: they issue a token when the task starts and never tie it to the task’s end, so a cancelled, stalled or forgotten task keeps full authority. Bound authority per call, not per session, and the lifetime problem mostly disappears.
The failure: the task is gone, the key is not
The A2A protocol lets one agent hand work to another. Many tasks finish in seconds. Some do not: a research agent crawling sources, a procurement agent waiting on a supplier, an agent paused for a human decision. The spec models this with task states such as working, input-required and canceled, plus streaming and push notifications for progress.
A typical story. A team lets an orchestrator delegate invoice reconciliation to a finance agent. The orchestrator passes along an API key so the finance agent can read the ledger. Halfway through, the user closes the session and the orchestrator marks the task canceled. Nothing tells the finance agent, and nothing revokes the key. The finance agent retries, the key still works, and the ledger keeps getting queried by a task nobody owns. The first anyone hears of it is an unexplained spike in the audit log, or a bill.
Nothing was hacked. The task state and the credential state simply drifted apart, which is the same shape of failure as forgotten agents holding live credentials, at the granularity of one task instead of one agent.
Why the obvious fixes don’t hold
- Short token TTLs. A 15-minute token helps, but refresh logic quietly extends it for as long as the agent keeps asking. The lifetime follows the agent’s persistence, not the task’s.
- Trusting
canceledto propagate. Cancellation is a message. Messages get lost, ignored or arrive after the work already ran. A control that depends on the worker agent being well-behaved is not a control. - Passing the user’s token down the chain. Every hop inherits the full authority and the full lifetime, and the audit trail cannot say which agent used it. We cover the token-passing trap in audience binding for MCP.
- Push notification callbacks. Long tasks use webhooks to report back, which adds a new inbound surface that needs its own authentication (A2A push notification webhooks).
What a bounded task looks like
The pattern that holds up has four properties.
- The agent never holds a standing upstream secret. It holds a narrow identity, and the real API credential stays server-side and is applied per call, so there is no upstream key to outlive the task. (The agent’s own token to the broker still expires on its own clock.)
- Authority is decided at each call, not at task start. Policy runs on every request. A cancelled, disabled or revoked agent fails the next call, whatever its task thinks.
- Disabling is immediate and central. One switch on the agent principal stops every in-flight task that uses it (kill switches and circuit breakers).
- Every brokered call is recorded, allowed or denied. When a task misbehaves you can replay what it did and what it tried to do (agent incident forensics).
Fullmakt’s choice: synchronous tasks by design
Fullmakt exposes its own management surface as an A2A server (see the A2A handshake walkthrough). It makes a deliberately conservative choice here: skills complete synchronously inside a single message/send call. The agent card advertises streaming: false, message/stream and tasks/resubscribe return a clear “not supported” error, and tasks/cancel answers that tasks complete synchronously and cannot be canceled.
That sounds like a limitation, and for long-running orchestration it is a trade-off. For credential safety it is a feature: there is no half-finished task holding authority in the background, because a task is over by the time the response arrives. tasks/get replays a recent result from a short-lived cache and returns “Task not found” once it expires, and each call is checked against the agent principal, which must exist and not be disabled.
The same single-request discipline shapes the rest of the surface:
- Every skill invocation is audited. The attempt is written to the audit trail whether it succeeded, was denied or failed.
- Credential setup is hard-denied for agents. Vault entries are created, rotated and deleted by a human in the UI. Agents can only reference existing entries.
- Approvals stay human. An agent can ask, but only a person decides (human-in-the-loop approval).
Where a workflow genuinely needs to wait, model the wait outside the credential: park the work, then resume with a fresh, policy-checked call. The wait costs nothing in authority.
The business case: lifetime you can reason about
Fullmakt sits between agents and the APIs they call as a credential broker. For the long-running-task problem that means:
- No upstream secret in the agent’s context. For brokered calls the model sees a reference, never the API key, so abandoned tasks have nothing upstream to leak or reuse.
- Per-call policy. On the brokered execution path, endpoint and method scoping is evaluated on every request, so authority follows current state, not the state at task start.
- Fast revocation. Disable one agent principal and its next call is refused, including on the A2A surface, without waiting for tokens to expire.
- A single audit trail. One append-only record answers the question every incident review starts with: which agent did what, under whose authority, and when.
- Cost containment. Orphaned tasks that retry forever are also a spend problem; pair this with soft caps and hard stops.
FAQ
What is an A2A task? In the Agent2Agent protocol, a task is the unit of work one agent asks another to perform. It carries a state (for example working, input-required, completed, canceled or failed) and returns artifacts when done.
Does cancelling an A2A task revoke the agent’s credentials? No. Cancellation changes the task’s state only. Unless the credential is separately bound to the task or checked per call, the agent can keep using it.
Why not just use short-lived tokens? They narrow the window but refresh logic extends it for as long as the agent keeps asking. Per-call policy plus central disablement bounds authority by decision, not by clock.
Are synchronous A2A tasks a limitation? For long-running orchestration, yes: you give up streaming progress. In exchange there is no background task holding authority. Teams can combine synchronous, credential-bearing calls with their own queue for waiting.
How do I check whether my agents have this problem? Cancel a task mid-run in a test environment and watch whether the downstream agent can still call your APIs a minute later. If it can, the credential outlives the task.
A task is a promise to finish and then stop. The credential behind it should make the same promise, and the safest way to keep it is to never hand the secret to the agent in the first place.