{
"id": "com.atiproto.actions",
"defs": {
"error": {
"type": "object",
"required": [
"action",
"message"
],
"properties": {
"code": {
"type": "string",
"maxLength": 64
},
"name": {
"type": "string",
"maxLength": 64
},
"action": {
"type": "string",
"maxLength": 32,
"description": "The verb of the action that failed (create/update/delete)."
},
"message": {
"type": "string",
"maxLength": 1024
}
},
"description": "Populated by the agent when an action fails. The server's error branch uses this to construct compensating actions and a final raise."
},
"raise": {
"type": "object",
"required": [
"message"
],
"properties": {
"code": {
"type": "string",
"maxLength": 64
},
"message": {
"type": "string",
"maxLength": 1024
}
},
"description": "Terminal action: the agent throws a WorkflowRaisedError carrying message and code. Subsequent actions in the same batch are not executed."
},
"create": {
"type": "object",
"required": [
"repo",
"name",
"collection",
"record"
],
"properties": {
"name": {
"type": "string",
"maxLength": 64,
"description": "Server-assigned name for this action; echoed back on the corresponding response so the server can correlate."
},
"repo": {
"type": "string",
"format": "did",
"description": "DID of the repo to write to. The PDS auth check is the source of truth for whether the write is allowed."
},
"rkey": {
"type": "string",
"maxLength": 128,
"description": "Optional. When omitted (the default), the PDS generates the rkey and returns the resulting URI on the response. Server-assigned rkeys are reserved for fixed-rkey records like com.atiproto.profile/self."
},
"record": {
"type": "unknown"
},
"collection": {
"type": "string",
"format": "nsid"
}
},
"description": "Instructs the agent to call com.atproto.repo.createRecord on the user's PDS."
},
"delete": {
"type": "object",
"required": [
"repo",
"name",
"collection",
"rkey"
],
"properties": {
"name": {
"type": "string",
"maxLength": 64
},
"repo": {
"type": "string",
"format": "did"
},
"rkey": {
"type": "string",
"maxLength": 128
},
"collection": {
"type": "string",
"format": "nsid"
},
"swapCommit": {
"type": "string",
"format": "cid"
}
},
"description": "Instructs the agent to call com.atproto.repo.deleteRecord on the user's PDS."
},
"update": {
"type": "object",
"required": [
"repo",
"name",
"collection",
"rkey",
"record"
],
"properties": {
"name": {
"type": "string",
"maxLength": 64
},
"repo": {
"type": "string",
"format": "did"
},
"rkey": {
"type": "string",
"maxLength": 128
},
"record": {
"type": "unknown"
},
"collection": {
"type": "string",
"format": "nsid"
},
"swapCommit": {
"type": "string",
"format": "cid"
}
},
"description": "Instructs the agent to call com.atproto.repo.putRecord on the user's PDS."
},
"response": {
"type": "object",
"required": [
"action",
"name",
"result"
],
"properties": {
"name": {
"type": "string",
"maxLength": 64
},
"action": {
"type": "string",
"maxLength": 32,
"knownValues": [
"create",
"update",
"delete"
]
},
"result": {
"ref": "#recordResult",
"type": "ref"
}
},
"description": "Result of executing one action. Carries the verb (so the server can branch without inspecting result shape) plus the action name and the resulting record reference."
},
"recordResult": {
"type": "object",
"required": [
"uri"
],
"properties": {
"cid": {
"type": "string",
"format": "cid",
"description": "Present on create/update responses; absent on delete (the record is gone)."
},
"uri": {
"type": "string",
"format": "at-uri"
}
}
},
"inboundWorkflow": {
"type": "object",
"required": [
"intent",
"responses"
],
"properties": {
"error": {
"ref": "#error",
"type": "ref"
},
"intent": {
"type": "string",
"maxLength": 64
},
"responses": {
"type": "array",
"items": {
"ref": "#response",
"type": "ref"
}
}
},
"description": "Agent → server callback envelope. Echoes the server's intent verbatim, except when the agent overrides to \"error\" after an action failure."
},
"outboundWorkflow": {
"type": "object",
"required": [
"intent",
"actions"
],
"properties": {
"intent": {
"type": "string",
"maxLength": 64
},
"actions": {
"type": "array",
"items": {
"refs": [
"#create",
"#update",
"#delete",
"#raise"
],
"type": "union"
}
}
},
"description": "Server → agent envelope. Server-defined intent string acts as a phase marker; the agent treats it as opaque. Each item in `actions` is discriminated by `$type` against `#create` / `#update` / `#delete` / `#raise`."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1,
"description": "Workflow envelope shared between atiproto XRPC endpoints and the agent interpreter. The server emits an outboundWorkflow when it needs the agent to execute repo writes against the user's PDS; the agent runs the actions and calls back with an inboundWorkflow."
}