Expand description
A lease on a delegated task: the child stops when its parent stops renewing it (ADR 0020).
§The gap this closes
A parent that cancels or drops its delegation cancels the child
(a2a_protocol_client::delegation). A parent that crashes cannot: the
handle dies with it, and the child runs on until it finishes. A lease
turns silence into a stop. The parent grants the child a time to live
when it sends the task and renews it while it is alive. A child whose
lease lapses is stopped by its own server.
§Wire shape
Not part of A2A v1.0. It ships as the declared extension
https://a2a-rust.com/extensions/lease/v1, in the same style as
approval:
- The grant rides on the message that starts or continues the task:
{"ttlMs": <milliseconds>}inMessage.metadataundera2a-rust.com/lease, and the URI inMessage.extensions. - A renewal is a
GetTaskof the task whose request activates the extension (theA2A-Extensionsheader, spec §3.2.6). It pushes the deadline out by the granted time to live. - A renewal that also activates
LEASE_RENEWAL_ONLY_URIasks for the lease alone: the server renews and answers with the task’s id, context and status, and no history, artifacts or metadata, so a renewal costs neither the serialization nor (with a content signer, ADR 0027) the signature of every artifact (audit NEW-h-designs-3, ADR 0044). A server that does not know the URI ignores it and answers the whole task, as before, so a client may always send it.
use std::time::Duration;
use a2a_protocol_types::lease::Lease;
use a2a_protocol_types::message::Message;
let mut message = Message::user_text("m1", "summarise these");
Lease::new(Duration::from_secs(30)).attach(&mut message);
assert_eq!(Lease::read(&message).unwrap(), Some(Lease::new(Duration::from_secs(30))));Structs§
- Lease
- A grant: how long the child may go unrenewed before it is stopped.
Constants§
- LEASE_
EXTENSION_ URI - The extension URI a card declares, a message names in
extensions, and a renewingGetTaskactivates. - LEASE_
METADATA_ KEY - The
Message.metadatakey a grant travels under. - LEASE_
RENEWAL_ ONLY_ URI - Activated beside
LEASE_EXTENSION_URIon a renewingGetTask: answer with the task’s status alone (ADR 0044).