> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.astropods.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.astropods.com/_mcp/server.

# Schemas

The [specification](/amp/specification) defines the protocol. These schemas define every frame and object on the wire. Where the specification and the JSON Schema disagree, the JSON Schema wins.

## JSON Schema

Every frame validates against `#/$defs/Frame`. Objects such as `Task` validate against their own definition under `$defs`. The schema uses [JSON Schema 2020-12](https://json-schema.org/draft/2020-12/schema).

**`amp.schema.json`**

```json title="amp.schema.json"
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:amp:schema:v0.1",
  "title": "Agent Mesh Protocol (AMP) v0.1",
  "description": "Normative schema for AMP frames and objects. A frame on the wire validates against #/$defs/Frame.",
  "$ref": "#/$defs/Frame",
  "$defs": {
    "Timestamp": { "type": "string", "format": "date-time" },
    "Name": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]{0,127}$" },
    "Namespace": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,62}$" },
    "Address": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9-]{0,62}/[a-z0-9][a-z0-9._-]{0,127}$"
    },
    "Target": {
      "type": "string",
      "pattern": "^(([a-z0-9][a-z0-9-]{0,62}/[a-z0-9][a-z0-9._-]{0,127})|((job|topic):([a-z0-9][a-z0-9-]{0,62}/)?[a-z0-9][a-z0-9._-]{0,127}))$"
    },
    "Metadata": { "type": "object" },
    "Scope": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]{0,127}$" },
    "Grant": { "type": "string", "pattern": "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$" },
    "TaskState": {
      "enum": ["submitted", "working", "input-required", "completed", "failed", "canceled", "rejected"]
    },
    "TextPart": {
      "type": "object",
      "required": ["type", "text"],
      "properties": {
        "type": { "const": "text" },
        "text": { "type": "string" },
        "media_type": { "type": "string", "default": "text/plain" }
      }
    },
    "FilePart": {
      "type": "object",
      "required": ["type", "uri"],
      "properties": {
        "type": { "const": "file" },
        "uri": { "type": "string", "format": "uri" },
        "name": { "type": "string" },
        "media_type": { "type": "string" },
        "size_bytes": { "type": "integer", "minimum": 0 },
        "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
      }
    },
    "DataPart": {
      "type": "object",
      "required": ["type", "data"],
      "properties": {
        "type": { "const": "data" },
        "data": { "type": "object" },
        "schema": { "type": "string", "format": "uri" }
      }
    },
    "Part": {
      "oneOf": [
        { "$ref": "#/$defs/TextPart" },
        { "$ref": "#/$defs/FilePart" },
        { "$ref": "#/$defs/DataPart" }
      ]
    },
    "Job": {
      "type": "object",
      "required": ["name"],
      "properties": {
        "name": { "$ref": "#/$defs/Name" },
        "description": { "type": "string" },
        "input_schema": { "type": "object" },
        "output_schema": { "type": "object" },
        "examples": { "type": "array", "items": { "type": "string" } }
      }
    },
    "Card": {
      "type": "object",
      "required": ["name", "kind"],
      "properties": {
        "name": { "type": "string", "minLength": 1 },
        "description": { "type": "string" },
        "kind": { "enum": ["agent", "human", "gateway"] },
        "jobs": { "type": "array", "items": { "$ref": "#/$defs/Job" } },
        "accepts": {
          "type": "array",
          "items": { "enum": ["text", "file", "data"] },
          "default": ["text"]
        },
        "max_concurrent": { "type": "integer", "minimum": 1, "default": 1 },
        "subscriptions": { "type": "array", "items": { "type": "string" } },
        "metadata": { "$ref": "#/$defs/Metadata" }
      }
    },
    "ArtifactRef": {
      "type": "object",
      "required": ["artifact_id"],
      "properties": {
        "artifact_id": { "type": "string" },
        "name": { "type": "string" },
        "final": { "type": "boolean", "default": true }
      }
    },
    "Trace": {
      "type": "object",
      "required": ["traceparent"],
      "properties": {
        "traceparent": { "type": "string" },
        "tracestate": { "type": "string" }
      }
    },
    "Envelope": {
      "type": "object",
      "required": ["id", "to", "kind"],
      "properties": {
        "id": { "type": "string", "minLength": 1, "maxLength": 128 },
        "from": { "$ref": "#/$defs/Address" },
        "to": { "$ref": "#/$defs/Target" },
        "kind": { "enum": ["message", "task", "status", "event"] },
        "task_id": { "type": "string" },
        "reply_to": { "type": "string" },
        "state": { "$ref": "#/$defs/TaskState" },
        "artifact": { "$ref": "#/$defs/ArtifactRef" },
        "ttl_s": { "type": "integer", "minimum": 1, "maximum": 604800, "default": 3600 },
        "sent_at": { "$ref": "#/$defs/Timestamp" },
        "parts": { "type": "array", "items": { "$ref": "#/$defs/Part" } },
        "trace": { "$ref": "#/$defs/Trace" },
        "scope": { "$ref": "#/$defs/Scope" },
        "metadata": { "$ref": "#/$defs/Metadata" }
      },
      "allOf": [
        {
          "if": { "properties": { "kind": { "const": "status" } } },
          "then": { "required": ["task_id", "state"] },
          "else": { "required": ["parts"], "properties": { "parts": { "minItems": 1 } } }
        },
        {
          "if": { "properties": { "kind": { "const": "event" } } },
          "then": { "properties": { "to": { "pattern": "^topic:" } } }
        }
      ]
    },
    "Status": {
      "type": "object",
      "required": ["state", "at"],
      "properties": {
        "state": { "$ref": "#/$defs/TaskState" },
        "at": { "$ref": "#/$defs/Timestamp" },
        "by": { "$ref": "#/$defs/Address" },
        "message": { "type": "array", "items": { "$ref": "#/$defs/Part" } }
      }
    },
    "Artifact": {
      "type": "object",
      "required": ["artifact_id", "parts"],
      "properties": {
        "artifact_id": { "type": "string" },
        "name": { "type": "string" },
        "parts": { "type": "array", "items": { "$ref": "#/$defs/Part" } },
        "final": { "type": "boolean" }
      }
    },
    "Task": {
      "type": "object",
      "required": ["task_id", "namespace", "requester", "target", "state", "attempt", "max_attempts", "created_at", "updated_at", "expires_at", "history", "artifacts"],
      "properties": {
        "task_id": { "type": "string" },
        "namespace": { "$ref": "#/$defs/Namespace" },
        "requester": { "$ref": "#/$defs/Address" },
        "target": { "$ref": "#/$defs/Target" },
        "scope": { "$ref": "#/$defs/Scope" },
        "assignee": { "oneOf": [{ "$ref": "#/$defs/Address" }, { "type": "null" }] },
        "state": { "$ref": "#/$defs/TaskState" },
        "attempt": { "type": "integer", "minimum": 0 },
        "max_attempts": { "type": "integer", "minimum": 1, "default": 3 },
        "created_at": { "$ref": "#/$defs/Timestamp" },
        "updated_at": { "$ref": "#/$defs/Timestamp" },
        "expires_at": { "$ref": "#/$defs/Timestamp" },
        "history": { "type": "array", "items": { "$ref": "#/$defs/Status" } },
        "artifacts": { "type": "array", "items": { "$ref": "#/$defs/Artifact" } }
      }
    },
    "ErrorCode": {
      "enum": [
        "invalid_frame", "invalid_envelope", "unsupported_version", "unauthenticated", "forbidden",
        "unknown_target", "unsupported_part", "too_large", "rate_limited", "budget_exhausted",
        "task_not_found", "task_final", "lease_lost", "concurrency_limit", "unavailable"
      ]
    },
    "Error": {
      "type": "object",
      "required": ["code", "message", "retryable"],
      "properties": {
        "code": { "$ref": "#/$defs/ErrorCode" },
        "message": { "type": "string" },
        "retryable": { "type": "boolean" },
        "retry_after_s": { "type": "integer", "minimum": 0 }
      }
    },
    "Credential": {
      "type": "object",
      "required": ["kind"],
      "properties": {
        "kind": { "type": "string" },
        "token": { "type": "string" }
      },
      "if": { "properties": { "kind": { "const": "bearer" } } },
      "then": { "required": ["token"] }
    },
    "FrameBase": {
      "type": "object",
      "required": ["type", "seq"],
      "properties": {
        "type": { "type": "string" },
        "seq": { "type": "integer", "minimum": 1 },
        "re": { "type": "integer", "minimum": 1 }
      }
    },
    "Hello": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "required": ["versions", "credential", "card"],
      "properties": {
        "type": { "const": "hello" },
        "versions": { "type": "array", "minItems": 1, "items": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+$" } },
        "credential": { "$ref": "#/$defs/Credential" },
        "card": { "$ref": "#/$defs/Card" }
      }
    },
    "Welcome": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "required": ["re", "version", "session_id", "address", "heartbeat_interval_s", "limits"],
      "properties": {
        "type": { "const": "welcome" },
        "version": { "type": "string" },
        "session_id": { "type": "string" },
        "address": { "$ref": "#/$defs/Address" },
        "scopes": { "type": "array", "items": { "$ref": "#/$defs/Scope" } },
        "heartbeat_interval_s": { "type": "integer", "minimum": 1 },
        "limits": {
          "type": "object",
          "properties": {
            "max_envelope_bytes": { "type": "integer", "minimum": 1 },
            "max_concurrent_leases": { "type": "integer", "minimum": 1 },
            "lease_s": { "type": "integer", "minimum": 1 },
            "ack_wait_s": { "type": "integer", "minimum": 1 },
            "grant_s": { "type": "integer", "minimum": 1 }
          }
        }
      }
    },
    "Send": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "required": ["envelope"],
      "properties": { "type": { "const": "send" }, "envelope": { "$ref": "#/$defs/Envelope" } }
    },
    "Accepted": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "required": ["re", "id"],
      "properties": { "type": { "const": "accepted" }, "id": { "type": "string" }, "task_id": { "type": "string" } }
    },
    "Deliver": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "required": ["delivery_id", "envelope"],
      "properties": {
        "type": { "const": "deliver" },
        "delivery_id": { "type": "string" },
        "envelope": { "$ref": "#/$defs/Envelope" },
        "offer": { "type": "boolean", "description": "True when the envelope is a task offered for claiming" },
        "grant": { "$ref": "#/$defs/Grant" }
      }
    },
    "Ack": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "required": ["delivery_id"],
      "properties": { "type": { "const": "ack" }, "delivery_id": { "type": "string" } }
    },
    "Nack": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "required": ["delivery_id"],
      "properties": {
        "type": { "const": "nack" },
        "delivery_id": { "type": "string" },
        "delay_s": { "type": "integer", "minimum": 0 }
      }
    },
    "Claim": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "required": ["task_id"],
      "properties": { "type": { "const": "claim" }, "task_id": { "type": "string" } }
    },
    "Granted": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "required": ["task_id", "lease_id", "expires_at"],
      "properties": {
        "type": { "const": "granted" },
        "task_id": { "type": "string" },
        "lease_id": { "type": "string" },
        "expires_at": { "$ref": "#/$defs/Timestamp" },
        "grant": { "$ref": "#/$defs/Grant" }
      }
    },
    "Heartbeat": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "properties": { "type": { "const": "heartbeat" } }
    },
    "Release": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "required": ["task_id"],
      "properties": { "type": { "const": "release" }, "task_id": { "type": "string" } }
    },
    "Subscribe": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "required": ["topic"],
      "properties": {
        "type": { "const": "subscribe" },
        "topic": { "$ref": "#/$defs/Target" },
        "from": { "type": "string", "description": "Replay start: a timestamp or a stream sequence" }
      }
    },
    "Unsubscribe": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "required": ["topic"],
      "properties": { "type": { "const": "unsubscribe" }, "topic": { "$ref": "#/$defs/Target" } }
    },
    "Query": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "properties": {
        "type": { "const": "query" },
        "task": { "type": "string" },
        "job": { "$ref": "#/$defs/Name" },
        "participant": { "$ref": "#/$defs/Address" }
      },
      "oneOf": [{ "required": ["task"] }, { "required": ["job"] }, { "required": ["participant"] }]
    },
    "Result": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "required": ["re"],
      "properties": {
        "type": { "const": "result" },
        "task": { "$ref": "#/$defs/Task" },
        "participants": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["address", "card"],
            "properties": { "address": { "$ref": "#/$defs/Address" }, "card": { "$ref": "#/$defs/Card" } }
          }
        }
      }
    },
    "ErrorFrame": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "required": ["error"],
      "properties": { "type": { "const": "error" }, "error": { "$ref": "#/$defs/Error" } }
    },
    "Goodbye": {
      "allOf": [{ "$ref": "#/$defs/FrameBase" }],
      "properties": { "type": { "const": "goodbye" }, "reason": { "type": "string" } }
    },
    "Frame": {
      "oneOf": [
        { "$ref": "#/$defs/Hello" }, { "$ref": "#/$defs/Welcome" }, { "$ref": "#/$defs/Send" },
        { "$ref": "#/$defs/Accepted" }, { "$ref": "#/$defs/Deliver" }, { "$ref": "#/$defs/Ack" },
        { "$ref": "#/$defs/Nack" }, { "$ref": "#/$defs/Claim" }, { "$ref": "#/$defs/Granted" },
        { "$ref": "#/$defs/Heartbeat" }, { "$ref": "#/$defs/Release" }, { "$ref": "#/$defs/Subscribe" },
        { "$ref": "#/$defs/Unsubscribe" }, { "$ref": "#/$defs/Query" }, { "$ref": "#/$defs/Result" },
        { "$ref": "#/$defs/ErrorFrame" }, { "$ref": "#/$defs/Goodbye" }
      ]
    }
  }
}
```

## Protocol Buffers

The gRPC binding uses one bidirectional stream, `amp.v1alpha1.BrokerService/Session`. Each stream message wraps one frame.

**`amp.proto`**

```protobuf title="amp.proto"
syntax = "proto3";

package amp.v1alpha1;

import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";

option go_package = "ampv1alpha1";

service BrokerService {
  rpc Session(stream SessionRequest) returns (stream SessionResponse);
}

message SessionRequest {
  Frame frame = 1;
}

message SessionResponse {
  Frame frame = 1;
}

message Frame {
  uint64 seq = 1;
  uint64 re = 2;
  oneof body {
    Hello hello = 10;
    Welcome welcome = 11;
    Send send = 12;
    Accepted accepted = 13;
    Deliver deliver = 14;
    Ack ack = 15;
    Nack nack = 16;
    Claim claim = 17;
    Granted granted = 18;
    Heartbeat heartbeat = 19;
    Release release = 20;
    Subscribe subscribe = 21;
    Unsubscribe unsubscribe = 22;
    Query query = 23;
    Result result = 24;
    Error error = 25;
    Goodbye goodbye = 26;
  }
}

message Hello {
  repeated string versions = 1;
  Credential credential = 2;
  Card card = 3;
}

message Credential {
  string kind = 1;
  string token = 2;
}

message Welcome {
  string version = 1;
  string session_id = 2;
  string address = 3;
  uint32 heartbeat_interval_s = 4;
  Limits limits = 5;
}

message Limits {
  uint64 max_envelope_bytes = 1;
  uint32 max_concurrent_leases = 2;
  uint32 lease_s = 3;
  uint32 ack_wait_s = 4;
}

message Send {
  Envelope envelope = 1;
}

message Accepted {
  string id = 1;
  string task_id = 2;
}

message Deliver {
  string delivery_id = 1;
  Envelope envelope = 2;
  bool offer = 3;
}

message Ack {
  string delivery_id = 1;
}

message Nack {
  string delivery_id = 1;
  uint32 delay_s = 2;
}

message Claim {
  string task_id = 1;
}

message Granted {
  string task_id = 1;
  string lease_id = 2;
  google.protobuf.Timestamp expires_at = 3;
}

message Heartbeat {}

message Release {
  string task_id = 1;
}

message Subscribe {
  string topic = 1;
  string from = 2;
}

message Unsubscribe {
  string topic = 1;
}

message Query {
  oneof target {
    string task = 1;
    string job = 2;
    string participant = 3;
  }
}

message Result {
  Task task = 1;
  repeated Registration participants = 2;
}

message Registration {
  string address = 1;
  Card card = 2;
}

message Goodbye {
  string reason = 1;
}

enum Kind {
  KIND_UNSPECIFIED = 0;
  KIND_MESSAGE = 1;
  KIND_TASK = 2;
  KIND_STATUS = 3;
  KIND_EVENT = 4;
}

enum TaskState {
  TASK_STATE_UNSPECIFIED = 0;
  TASK_STATE_SUBMITTED = 1;
  TASK_STATE_WORKING = 2;
  TASK_STATE_INPUT_REQUIRED = 3;
  TASK_STATE_COMPLETED = 4;
  TASK_STATE_FAILED = 5;
  TASK_STATE_CANCELED = 6;
  TASK_STATE_REJECTED = 7;
}

message Envelope {
  string id = 1;
  string from = 2;
  string to = 3;
  Kind kind = 4;
  string task_id = 5;
  string reply_to = 6;
  TaskState state = 7;
  ArtifactRef artifact = 8;
  uint32 ttl_s = 9;
  google.protobuf.Timestamp sent_at = 10;
  repeated Part parts = 11;
  Trace trace = 12;
  google.protobuf.Struct metadata = 13;
}

message ArtifactRef {
  string artifact_id = 1;
  string name = 2;
  bool final = 3;
}

message Trace {
  string traceparent = 1;
  string tracestate = 2;
}

message Part {
  oneof part {
    TextPart text = 1;
    FilePart file = 2;
    DataPart data = 3;
  }
}

message TextPart {
  string text = 1;
  string media_type = 2;
}

message FilePart {
  string uri = 1;
  string name = 2;
  string media_type = 3;
  uint64 size_bytes = 4;
  string sha256 = 5;
}

message DataPart {
  google.protobuf.Struct data = 1;
  string schema = 2;
}

message Card {
  string name = 1;
  string description = 2;
  string kind = 3;
  repeated Job jobs = 4;
  repeated string accepts = 5;
  uint32 max_concurrent = 6;
  repeated string subscriptions = 7;
  google.protobuf.Struct metadata = 8;
}

message Job {
  string name = 1;
  string description = 2;
  google.protobuf.Struct input_schema = 3;
  google.protobuf.Struct output_schema = 4;
  repeated string examples = 5;
}

message Status {
  TaskState state = 1;
  google.protobuf.Timestamp at = 2;
  string by = 3;
  repeated Part message = 4;
}

message Artifact {
  string artifact_id = 1;
  string name = 2;
  repeated Part parts = 3;
  bool final = 4;
}

message Task {
  string task_id = 1;
  string namespace = 2;
  string requester = 3;
  string target = 4;
  string assignee = 5;
  TaskState state = 6;
  uint32 attempt = 7;
  uint32 max_attempts = 8;
  google.protobuf.Timestamp created_at = 9;
  google.protobuf.Timestamp updated_at = 10;
  google.protobuf.Timestamp expires_at = 11;
  repeated Status history = 12;
  repeated Artifact artifacts = 13;
}

message Error {
  string code = 1;
  string message = 2;
  bool retryable = 3;
  uint32 retry_after_s = 4;
}
```

## Examples

Each example validates against the JSON Schema.

**`hello.json`**

```json title="hello.json"
{
  "type": "hello",
  "seq": 1,
  "versions": ["0.1"],
  "credential": { "kind": "bearer", "token": "eyJhbGciOi..." },
  "card": {
    "name": "Writer",
    "kind": "agent",
    "description": "Writes summaries and briefs",
    "jobs": [
      {
        "name": "summarize",
        "description": "Summarize documents into a short brief",
        "input_schema": { "type": "object", "properties": { "max_words": { "type": "integer" } } }
      }
    ],
    "accepts": ["text", "file", "data"],
    "max_concurrent": 2,
    "subscriptions": ["topic:documents"]
  }
}
```

**`welcome.json`**

```json title="welcome.json"
{
  "type": "welcome",
  "seq": 1,
  "re": 1,
  "version": "0.1",
  "session_id": "s_7h2k",
  "address": "acme/writer",
  "heartbeat_interval_s": 10,
  "limits": { "max_envelope_bytes": 1048576, "max_concurrent_leases": 2, "lease_s": 60, "ack_wait_s": 30 }
}
```

**`send-task.json`**

```json title="send-task.json"
{
  "type": "send",
  "seq": 2,
  "envelope": {
    "id": "01J9Z6QK3X8M2V4N5P6R7S8T9U",
    "to": "job:summarize",
    "kind": "task",
    "ttl_s": 3600,
    "parts": [
      { "type": "text", "text": "Summarize the Q3 customer interviews for the board" },
      { "type": "file", "uri": "https://files.example.com/q3-interviews.pdf", "name": "q3-interviews.pdf", "media_type": "application/pdf" },
      { "type": "data", "data": { "max_words": 300 } }
    ],
    "trace": { "traceparent": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01" }
  }
}
```

**`deliver-offer.json`**

```json title="deliver-offer.json"
{
  "type": "deliver",
  "seq": 5,
  "delivery_id": "d_19",
  "offer": true,
  "envelope": {
    "id": "01J9Z6QK3X8M2V4N5P6R7S8T9U",
    "from": "acme/analyst",
    "to": "job:summarize",
    "kind": "task",
    "task_id": "t_41",
    "sent_at": "2026-10-02T10:00:00Z",
    "parts": [{ "type": "text", "text": "Summarize the Q3 customer interviews for the board" }]
  }
}
```

**`status-completed.json`**

```json title="status-completed.json"
{
  "type": "send",
  "seq": 9,
  "envelope": {
    "id": "01J9Z6S2B5C7D9F1G3H5J7K9L1",
    "to": "acme/analyst",
    "kind": "status",
    "task_id": "t_41",
    "state": "completed",
    "artifact": { "artifact_id": "a_1", "name": "board-brief.md", "final": true },
    "parts": [{ "type": "text", "text": "## Q3 interviews\n\nCustomers asked for...", "media_type": "text/markdown" }]
  }
}
```

**`error-rate-limited.json`**

```json title="error-rate-limited.json"
{
  "type": "error",
  "seq": 4,
  "re": 3,
  "error": { "code": "rate_limited", "message": "60 tasks per minute exceeded", "retryable": true, "retry_after_s": 12 }
}
```

**`task.json`**

```json title="task.json"
{
  "task_id": "t_41",
  "namespace": "acme",
  "requester": "acme/analyst",
  "target": "job:summarize",
  "assignee": "acme/writer",
  "state": "completed",
  "attempt": 1,
  "max_attempts": 3,
  "created_at": "2026-10-02T10:00:00Z",
  "updated_at": "2026-10-02T10:02:10Z",
  "expires_at": "2026-10-02T11:00:00Z",
  "history": [
    { "state": "submitted", "at": "2026-10-02T10:00:00Z", "by": "acme/analyst" },
    { "state": "working", "at": "2026-10-02T10:00:01Z", "by": "acme/writer" },
    { "state": "completed", "at": "2026-10-02T10:02:10Z", "by": "acme/writer" }
  ],
  "artifacts": [
    { "artifact_id": "a_1", "name": "board-brief.md", "final": true, "parts": [{ "type": "text", "text": "## Q3 interviews", "media_type": "text/markdown" }] }
  ]
}
```

### Scopes and grants

These frames come from a broker that partitions namespaces into scopes. Each grant is a placeholder: its signature is not valid.

**`welcome-scoped.json`**

```json title="welcome-scoped.json"
{
  "type": "welcome",
  "seq": 1,
  "re": 1,
  "version": "0.1",
  "session_id": "s_9m3p",
  "address": "acme/analyst",
  "scopes": [
    "research",
    "sales"
  ],
  "heartbeat_interval_s": 10,
  "limits": {
    "max_envelope_bytes": 1048576,
    "max_concurrent_leases": 4,
    "lease_s": 60,
    "ack_wait_s": 30,
    "grant_s": 300
  }
}
```

**`send-task-scoped.json`**

```json title="send-task-scoped.json"
{
  "type": "send",
  "seq": 3,
  "envelope": {
    "id": "01J9Z6R2B7C4D5E6F7G8H9J0KM",
    "to": "acme/writer",
    "kind": "task",
    "scope": "research",
    "parts": [
      {
        "type": "text",
        "text": "Draft the Q3 research summary"
      }
    ]
  }
}
```

**`granted-with-grant.json`**

```json title="granted-with-grant.json"
{
  "type": "granted",
  "seq": 9,
  "re": 4,
  "task_id": "t_3f9a1c22b8d47e5a6b10",
  "lease_id": "l_7c1",
  "expires_at": "2026-10-05T10:01:00Z",
  "grant": "eyJhbGciOiJFZERTQSIsInR5cCI6ImFtcC1ncmFudCtqd3QiLCJraWQiOiJrMSJ9.eyJpc3MiOiJodHRwczovL21lc2guZXhhbXBsZS5jb20iLCJhdWQiOiJodHRwczovL2RvY3MuZXhhbXBsZS5jb20iLCJzdWIiOiJhY21lL3dyaXRlciIsInNjb3BlIjoicmVzZWFyY2giLCJpYXQiOjE3OTE1NDAwMDAsImV4cCI6MTc5MTU0MDMwMCwidGFza19pZCI6InRfM2Y5YTFjMjJiOGQ0N2U1YTZiMTAifQ.AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0-Pw"
}
```

**`deliver-message-scoped.json`**

```json title="deliver-message-scoped.json"
{
  "type": "deliver",
  "seq": 11,
  "delivery_id": "d_42",
  "envelope": {
    "id": "01J9Z6T7E2G3H4J5K6L7M8N9PQ",
    "from": "acme/analyst",
    "to": "acme/writer",
    "kind": "message",
    "scope": "research",
    "sent_at": "2026-10-05T10:00:05Z",
    "parts": [
      {
        "type": "text",
        "text": "Which interview had the pricing complaint?"
      }
    ]
  },
  "grant": "eyJhbGciOiJFZERTQSIsInR5cCI6ImFtcC1ncmFudCtqd3QiLCJraWQiOiJrMSJ9.eyJpc3MiOiJodHRwczovL21lc2guZXhhbXBsZS5jb20iLCJhdWQiOiJodHRwczovL2RvY3MuZXhhbXBsZS5jb20iLCJzdWIiOiJhY21lL3dyaXRlciIsInNjb3BlIjoicmVzZWFyY2giLCJpYXQiOjE3OTE1NDAwMDAsImV4cCI6MTc5MTU0MDMwMCwibWVzc2FnZV9pZCI6IjAxSjlaNlQ3RTJHM0g0SjVLNkw3TThOOVBRIn0.AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0-Pw"
}
```

## Next steps

* [Specification](/amp/specification): the rules these schemas encode
* [NATS JetStream binding](/amp/nats-jetstream): build a broker on NATS