Skip to main content

Extensions

PAP extensions add optional wire capabilities. Reactor extensions add or replace SDK implementation components. They complement one another but are not the same abstraction.

Negotiate a PAP extensionโ€‹

A company advertises support in its discovery document:

{
"extensions": {
"operations": [
{
"version": "2"
}
]
}
}

A personal agent declares the extensions it uses, per request, in Poppy-Extensions. Protocol-defined extensions use plain names. Third-party names begin with a domain controlled by their author, such as example.com/gift-wrap. Both sides ignore unknown extensions and unknown fields.

Negotiate in codeโ€‹

A company lists each extension with an entry per major version it supports (ยง3.3), and a personal agent declares the extensions it uses with that company, one version each, in the Poppy-Extensions header on every request with the Session header, the same throughout a Session (ยง3.4): nothing of them is in its client metadata any more. Both SDKs negotiate the same way: for each extension the company lists, the version this SDK implements when the company lists it (SUPPORTED_EXTENSIONS: Operations version 3, Mediated Sign-In version 1, Links and Disclosures version 1); the result is the Session's extensions (SessionClient.start(..., company=company) negotiates it, or pass extensions for a host that implements fewer). An extension the company recognizes from the request itself, such as Mediated Sign-In with its grant type, is used without being declared, and a company can't refuse it with extension_required. The header is an RFC 9651 List of Strings (format_extensions_header, formatExtensionsHeader); a company reads it per request (parse_extensions_header, parseExtensionsHeader), and one that fails to parse declares nothing.

from personal_agent_protocol.extensions import format_extensions_header, negotiate_extensions
from personal_agent_protocol.models import ExtensionDescriptor

company = {
"operations": [ExtensionDescriptor(version="3"), ExtensionDescriptor(version="2")],
"example.com/gift-wrap": [ExtensionDescriptor(version="2")],
}
negotiated = negotiate_extensions(company)
assert negotiated == {"operations": "3"}
assert format_extensions_header(negotiated) == '"operations";v="3"'
# Version 2 is another major version: a company that lists only it gets no declaration.
assert negotiate_extensions({"operations": [ExtensionDescriptor(version="2")]}) == {}
import { formatExtensionsHeader, negotiateExtensions } from '@datalayer/personal-agent-protocol';

const negotiated = negotiateExtensions({
operations: [{ version: '3' }, { version: '2' }],
'example.com/gift-wrap': [{ version: '2' }],
});
console.log(negotiated); // { operations: '3' }
console.log(formatExtensionsHeader(negotiated)); // "operations";v="3"

The Operations behavior itself lives in OperationsClient (Python and TypeScript), negotiated with operations_negotiated() / operationsNegotiated(); see the Operations guide. The SDK has no contribution point for other extensions' behavior yet: a third-party extension is used by the host's own code once negotiation says both sides list it.

Extensions cannot weaken mandatory protocol checks such as issuer binding, secret redaction, Session JWT verification, replay protection, or exact operation revision approval.