Federation envelopes

Copy Markdown View Source

This guide is for implementers that exchange task state through Agent2Agent (A2A) or Model Context Protocol (MCP). You will learn the envelope members, carrier keys, and state codec boundaries.

A Federation TaskEnvelope is a portable record for task identity, commitments, state, and references. A carrier is its transport-specific representation in A2A task metadata or MCP task _meta. The profile defines the carrier and state codecs. It does not define a host's authorization or execution behavior.

The 23 members

The table lists every member in protocol revision 1. Optional members may be absent.

MemberMeaning
task_identityIdentifier for the task.
idempotency_identityIdentifier associated with the task's idempotency context.
parent_execution_referenceOptional identifier for a related parent execution.
initiating_subjectOptional identifier for the initiating subject.
blueprint_digestDigest reference for the Blueprint.
deployment_digestDigest reference for the Deployment Manifest.
input_commitmentDigest commitment for task input.
result_schemaDigest identifying the result schema.
result_classification_ceilingClassification level and markers for a result.
time_policyProtocol-defined task policy data.
resource_policyProtocol-defined resource policy data.
recovery_handleIdentifier used to refer to the task's recovery context.
issuerIssuer identifier.
subjectSubject identifier.
audienceAudience identifier.
identity_mapping_evidenceData describing a correlation between identities.
checkpoint_requestOptional typed checkpoint request and digest.
checkpoint_statusOptional checkpoint state.
checkpoint_commitmentOptional digest associated with checkpoint state.
terminal_stateOptional terminal state.
evidence_receiptOptional result and commitment data for a terminal state.
compatibility_referenceOne or more named compatibility identities.
authority_proof_referencesDigest references carried by the envelope.

The decoder enforces the closed member set and the artifact rules in protocol section 11.

Carriage

The active namespace is io.github.baselabs/federation. Producers use these carrier keys:

CarrierKey
A2A task metadatahttps://baselabs.github.io/agent_blueprint_protocol/extensions/federation
MCP task _metaio.github.baselabs/federation

The deprecated namespace remains recognized for compatibility:

CarrierKey
A2A task metadatahttps://example.com/extensions/federation
MCP task _metacom.example/federation

The carrier codecs combine the extension body with native task identity and state fields. State codecs convert between protocol states and native task states; they return typed errors for states with no defined conversion. The mapping table is data available through AgentBlueprintProtocol.federation_mapping/0 in Elixir and federationMapping() in TypeScript.

Concrete carrier shapes

These reading excerpts show the native fields and active extension key. The extension body is abbreviated to one real member; use the codec to obtain a complete carrier. Formatted excerpts are not canonical artifact bytes.

{
  "id": "task-7f3a2c",
  "status": {"state": "TASK_STATE_COMPLETED"},
  "metadata": {
    "https://baselabs.github.io/agent_blueprint_protocol/extensions/federation": {
      "blueprint_digest": "sha-256:UqU_xO8mUo_SEKFyllPQx5viwqjUU0jymkOUDjoSJVY"
    }
  }
}
{
  "taskId": "task-7f3a2c",
  "status": "completed",
  "_meta": {
    "io.github.baselabs/federation": {
      "blueprint_digest": "sha-256:UqU_xO8mUo_SEKFyllPQx5viwqjUU0jymkOUDjoSJVY"
    }
  }
}

In iex -S mix with the package installed, run:

alias AgentBlueprintProtocol.Federation
{:ok, envelope} = Federation.decode(File.read!(Application.app_dir(:agent_blueprint_protocol, "priv/examples/federation-envelope.json")))
{:ok, a2a} = Federation.to_a2a_carrier(envelope)
{:ok, mcp} = Federation.to_mcp_carrier(envelope)
{:ok, _a2a_round_trip} = Federation.from_a2a_carrier(a2a)
{:ok, _mcp_round_trip} = Federation.from_mcp_carrier(mcp)
{:ok, :canceled} = Federation.from_mcp_state("cancelled")
{:ok, "TASK_STATE_CANCELED"} = Federation.to_a2a_state(:canceled)
{:error, %AgentBlueprintProtocol.Error{code: :federation_state_unmappable}} =
  Federation.from_a2a_state("TASK_STATE_UNSPECIFIED")

The logical and A2A spelling is canceled; MCP uses cancelled. Some native states have no lossless conversion and deny. The extensions and federation notebook prints carrier excerpts, round trips, and a valid commitment fixture.

OperationElixirnpm package root
Envelope decode / canonical bytesFederation.decode/2, canonical_bytes/1decodeFederationEnvelope, canonicalBytes
Mapping rowsfederation_mapping/0federationMapping() returning a Result
State and carrier codecsfrom_a2a_state/1, to_a2a_state/1, MCP equivalents; to_a2a_carrier/1, from_a2a_carrier/1, MCP equivalentsNot exported in 1.1.0
Commitment verification and receiver contextFederation.verify_commitment/2, Federation.ContextNot exported in 1.1.0

Do not deep-import npm implementation modules. Exposing more functions requires a code release; the root reference is the supported surface.

Terminal commitments

The public AgentBlueprintProtocol.Federation.verify_commitment/2 function performs federation commitment verification. The shipped fixtures demonstrate a valid terminal commitment and cases that return federation_terminal_conflict. See the federation commitment cases.

Receiver context and returned facts

Federation.Context supplies receiver facts, not host execution instructions:

FieldContract
keysFlat list of public keys when no issuer-key map is supplied.
issuer_key_setsOptional map from issuer string to public-key list. When present it takes precedence over keys; an absent issuer has no keys.
issuer, subject, audienceOptional exact string comparisons. nil skips that comparison; mismatch returns audience_mismatch with the member path.
created_after, created_beforeOptional inclusive Z-form timestamp bounds on the signed creation time. Malformed or out-of-window values deny.
prior_receiptsPreviously verified facts, each with task_identity, terminal_state, and a Digest in terminal_commitment; conflicting terminal facts deny. Defaults to [].

The notebook loads commitment-valid from the installed priv/conformance/cases/federation-verify_commitment.json, decodes its envelope, converts the fixture's public keys, and calls verify_commitment/2. Success is {:ok, %{task_identity: ..., terminal_state: ..., terminal_commitment: %Digest{}}}. This fact can be retained for subsequent consistency comparisons. It does not authorize execution. The context's public keys are verification inputs; the fixture demonstrates verification only.

Next steps