Skip to main content

Module lease

Module lease 

Source
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>} in Message.metadata under a2a-rust.com/lease, and the URI in Message.extensions.
  • A renewal is a GetTask of the task whose request activates the extension (the A2A-Extensions header, spec §3.2.6). It pushes the deadline out by the granted time to live.
  • A renewal that also activates LEASE_RENEWAL_ONLY_URI asks 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 renewing GetTask activates.
LEASE_METADATA_KEY
The Message.metadata key a grant travels under.
LEASE_RENEWAL_ONLY_URI
Activated beside LEASE_EXTENSION_URI on a renewing GetTask: answer with the task’s status alone (ADR 0044).