Permission required:
workspace_agent:a2aBase URL
POST {baseUrl}/message:send or GET {baseUrl}/tasks/{taskId}.
Protocol Versions
MemoryLake exposes two parallel sets of A2A routes, one per protocol version, and each version is reachable over two transports: REST and JSON-RPC 2.0.
Over JSON-RPC, both versions post to the bare
{baseUrl} and pick the operation with method: v1.0 uses SendMessage, SendStreamingMessage, GetTask, CancelTask, SubscribeToTask; v0.3 uses message/send, message/stream, tasks/get, tasks/cancel, tasks/resubscribe. The protocol version is negotiated from the method name, and v1.0 clients should also send A2A-Version: 1.0.
All four route families accept the same configuration object and the same MemoryLake extension described below. The two protocol versions spell the wait-for-completion switch differently:
Push notifications aren’t supported. The agent card advertises
pushNotifications: false, and no callbacks are sent for pushNotificationConfig (v0.3) or taskPushNotificationConfig (v1.0). To follow a task, stream the response or subscribe to the task.MemoryLake Extension
MemoryLake extends the standard A2A protocol through themetadata.memorylake namespace. Put it in the metadata of the send request (top-level metadata in a REST body, params.metadata in JSON-RPC) on message:send or message:stream. The agent doesn’t read message.metadata for this.
This is the key difference from a vanilla A2A server — these fields connect the agent to workspaces, projects, and actors in MemoryLake. The object carries two kinds of fields:
- Memory and identity:
actorId,readWriteProjectIds,readOnlyProjectIds,fileImportProjectIdandskipMemorydecide whose memory the agent uses, which projects it reads and writes, and where attached files go. - Run configuration:
overridesandruntimeOptionschange how the agent handles this message.
metadata other than memorylake.
metadata.memorylake is required. Without it the request fails with 400 INVALID_ARGUMENT. Send an empty object {} to use the defaults: the agent works with your own actor, and memory is on.Memory and identity
The end user this message comes from, as a MemoryLake actor ID (
actor- followed by 32 hex characters). The agent searches this actor’s memories, and the user’s side of the conversation is recorded under this actor, which gives each end user their own memory.- Default: the authenticated user’s own actor in this workspace. If that user has no actor here, the request fails with
400 STATE_NOT_READY. - Must be an actor bound to this workspace. Any other ID returns
400, and a deleted actor returns400 ACTOR_INACTIVE. - Permissions:
workspace_actor:fact_addandworkspace_actor:fact_searchon the actor. They’re checked when the conversation starts, and again when a later message brings an actor the conversation hasn’t had before.
The projects the agent works in (
proj- followed by 32 hex characters). The first one is the primary project. The agent searches the documents and memories of every one of them, and the conversation is recorded against them, which is where memories extracted from the conversation are kept. Conversation history itself is stored at the workspace level. A single string is accepted in place of an array.- Also accepted as
readWriteProjectId, its former name, with the same string or array value. Send only one of the two names: a request that carries both returns400. A name whose value isnulldoesn’t count. - At most 5 per conversation by default. A project listed more than once counts once and keeps its first position. A blank entry returns
400, and so does a first message that names more projects than the limit. - Fixed for the conversation. The first message of a conversation (
contextId) binds the projects. Later messages can leave the field out and keep using them. A later message that sends it must name the same projects, in any order. Sending a different set, or adding projects to a conversation that started without any, fails with400. - Same workspace only. A project that doesn’t exist, or belongs to another workspace, returns
404. - Permissions:
project:mem_add,project:doc_add,project:mem_searchandproject:doc_searchon every project, checked when the conversation starts. - Default target for file attachments. Library files and inline content in the message are imported into the primary project as documents, unless
fileImportProjectIdnames another project. See Attach files.
More projects the agent can search, both documents and memories, without writing to them. Use it to give the agent a shared knowledge base.
- Applies to this message only. It isn’t stored on the conversation, so send it with every message that should see these projects.
- Same workspace only. An ID that doesn’t match a project returns
404, and so does a project of another workspace. The one exception is a project of this workspace that has been deleted: it’s skipped without an error, so a list your client keeps sending doesn’t start failing when one of its projects is deleted. - Permissions:
project:mem_searchandproject:doc_searchon each project. Missing either returns403.
The project that Library files and inline content attached to this message are imported into. Leave it out to use the conversation’s primary read-write project. See Attach files.
- Must be one of this request’s projects: a read-write project of the conversation, or one of this message’s
readOnlyProjectIds. Any other project returns400, even when the message carries no files. A project that doesn’t exist in this workspace returns404. - Applies to this message only. It isn’t stored on the conversation.
- Permission:
project:doc_addon the project, checked on every message that carries files to import.
true runs this message without memory: the agent doesn’t search memories or project documents, and nothing from this message is written to memory. The conversation is still created, and access to the actor and projects is still checked.Run configuration
Changes the agent’s configuration for this message only. Anything you leave out comes from the agent.
Turn on capabilities per message
overrides.capabilitiesOverride turns on extra capabilities for a single message. It is an object keyed by capability name, and each value is that capability’s configuration. Capability names and their fields are snake_case, unlike the camelCase fields around them (camelCase spellings such as webSearch and openDatasets are also accepted).
Keep in mind:
- It applies to this message only. The next message in the same conversation doesn’t get the capability unless it carries the override too.
- Agents don’t have these capabilities by default. Without the override, an agent searches the web or reads pages only if its own configuration turns that on (see
capabilitiesin Create Agent).piiandvegacan only be turned on here. - What you pass replaces the agent’s own configuration. Send the complete configuration you want for a capability, and don’t count on fields carrying over from the agent. For example, if the agent’s
web_searchsetsopen_datasetsand you pass"web_search": {}, this message searches no Open Data collections. - You can turn capabilities on, not off. Leaving a capability out keeps the agent’s own setting, and
nulldoesn’t turn off a capability the agent has.{"enabled": false}is worse: there is noenabledfield, so it reads as{}and turns the capability on with default settings, even for an agent that didn’t have it. To run without a capability, use an agent that doesn’t have it.
Examples
Sending a message spans three independent choices — protocol version (v1.0 / v0.3) × method (send / stream) × transport (REST / JSON-RPC) — so there are eight valid combinations. All eight are shown below. Paths below are relative to the base URL; JSON-RPC always posts to the bare base URL and selects the operation withmethod.
In the Headers column, SSE means
Accept: text/event-stream and v1.0 means A2A-Version: 1.0. All eight take the same configuration fields (v1.0 waits by default and uses returnImmediately, v0.3 uses blocking) and the same metadata.memorylake extension. The four streaming variants respond with text/event-stream; the four send variants respond with a single JSON body.
Watch the three shape differences between versions and transports: v1.0 uses
parts with role: "ROLE_USER"; v0.3 REST uses content with role: "ROLE_USER"; v0.3 JSON-RPC uses parts where every part carries a kind discriminator, with role: "user" in lowercase.REST transport
JSON-RPC transport
Both versions share the same path —POST {baseUrl} with no suffix. The version comes from the method name; v1.0 clients should also send A2A-Version: 1.0.
Attach files
A message can carry files next to its text, in three ways:- A Library file. Pass the file’s
uri(drive://…), as returned by List Items or Get Item. - Inline content. Pass the file’s bytes, base64-encoded (standard or URL-safe; a
data:<type>;base64,prefix is also accepted). Give the file anamewith its extension, or its MIME type, so MemoryLake can tell what kind of document it is. - A document already in a project. Pass
document://{projectId}/{documentId}, wheredocumentIdis the document’sidas returned by List Documents or Get Document. The agent reads the document where it is, without importing it again. See Reference project documents.
- They need a project to go to. They’re imported into the project named by
fileImportProjectId, or, when you leave it out, into the conversation’s primary read-write project (the first ofreadWriteProjectIds). Later messages in a conversation don’t have to name the read-write projects again: the ones stored on the conversation are used. If there is no project to import into, the request fails with400. - Permission:
project:doc_addon the project the files are imported into, checked on every message that carries such files, not only the first message of a conversation. - Inline files are also saved to your Library, on every send. Each inline file is saved as a new file at the top level of your workspace root (
MY_SPACE), as well as being imported into the project. Sending the same file again saves another copy, and a name that is already taken gets a suffix:report.pdf,report_1.pdf,report_2.pdf, and so on. Copies aren’t deduplicated or cleaned up, so delete the ones you no longer need with Delete Item. Saving them needs thedrive:item_addpermission. To attach a file without making a new copy each time, upload it to the Library once and pass itsuri. - Supported types include PDF, Word, Excel, PowerPoint, CSV and TSV, plain text, Markdown, and images (PNG, JPEG, GIF, BMP, WebP, TIFF). A file of another type is rejected with
400. For an inline file, the type comes from the extension inname, or from the MIME type when the name has no supported extension.
Give each file part exactly one source: a reference or inline content. Over v0.3 REST, a part must also set exactly one of
text, file and data. A part that breaks either rule, such as a file with only name and mimeType, a file with both sources, or an empty part, is rejected with 400 INVALID_ARGUMENT before anything is saved or sent to the agent. The error message names the part, for example message.content[1].file. A reference must be a drive:// or document:// URI; any other scheme is rejected with 400 INVALID_ARGUMENT as well. Over v1.0, a part with neither url nor raw isn’t read as a file.
Reference project documents
Adocument://{projectId}/{documentId} reference points the agent at a document that’s already in a project. Nothing is imported, so the reference needs no project to import into and no project:doc_add. Put it where a Library file’s drive:// URI goes, as shown in the table above. In this v1.0 REST example, the document’s project is passed as a read-only project:
v1.0 REST
- The project must be one of this request’s projects: a read-write project of the conversation, or one of this message’s
readOnlyProjectIds. Otherwise the request fails with400. To reference a document from another project, add that project toreadOnlyProjectIds; keep in mind that the agent can then search the whole project, not only the document you referenced. - No extra permission. What the project already requires as a read-write or read-only project is all a reference needs.
- The document must be a file that can be read.
404when the document isn’t in that project, or when the project is one of this request’s projects but has been deleted.400when the document isn’t a file (itsdocument_typeisn’tdrive_file), or its processing failed (statusiserror).- A document that’s still being processed can already be referenced, and the agent reads what has been processed so far. If it isn’t ready to be read yet, the request fails with
400 STATE_NOT_READY; try again shortly.
- Exact format. Two IDs separated by
/, with nothing else: no further path segments, query string or fragment. Any other form returns400.
Responses
Every combination returns the same task model. Only the envelope and a few spellings change with the protocol version and transport; see v0.3 differences. The examples in this section use v1.0 REST.Send
message:send always returns a task, never a bare message. By default it waits until the task finishes:
The conversation this task belongs to. Send it as
message.contextId to continue the conversation. If your request had none, a new one is generated.The answer: at most one artifact, named
result. It’s missing when the task failed or produced nothing. See The answer.Your message, followed by the agent’s messages in order: text it wrote along the way, its thinking, and its tool calls. Consecutive text is merged into one message.
configuration.historyLength keeps only the last N messages, and 0 leaves history out.returnImmediately: true (v1.0) or blocking: false (v0.3), the response comes back as soon as the task is created. The task is in TASK_STATE_SUBMITTED (or already TASK_STATE_WORKING), history holds only your message, and there are no artifacts. The task keeps running; to get its answer, subscribe to it.
Stream
message:stream responds with text/event-stream. Each data: line is one JSON event, in this order:
task: the task as created, with your message inhistory.statusUpdatewithTASK_STATE_WORKINGas the agent starts.statusUpdatewithTASK_STATE_WORKINGfor each step of progress.status.messageholds a single part:- a chunk of answer text. Chunks are incremental, so append them; each has its own
messageId; - a chunk of thinking text, marked with
metadata.adk_thought: true; - a tool call or tool result;
- a file the agent created, as
{"url": "...", "mediaType": "...", "filename": "..."}.
- a chunk of answer text. Chunks are incremental, so append them; each has its own
artifactUpdatewith the answer. See The answer.statusUpdatewith the final state,TASK_STATE_COMPLETED,TASK_STATE_FAILED(with the error instatus.message) orTASK_STATE_CANCELED. The stream then ends.
: are keep-alive comments; ignore them.
… and repeated fields are elided for readability.
The answer
Theresult artifact holds the answer as a list of parts:
Other
data parts may appear in the artifact and in the stream. Skip any data part whose kind you don’t recognize, or that has no kind. Numbers inside data parts come back as floating point, so 2 arrives as 2.0.
Tool calls
The agent’s tool activity appears asdata parts tagged with metadata.adk_type, the convention used by Google’s Agent Development Kit. You’ll see them in the stream and in history.
A function call may also carry
metadata.adk_thought_signature, an opaque value you can ignore.
Follow a task
GET {baseUrl}/tasks/{taskId} (v0.3: {baseUrl}/v1/tasks/{taskId}) returns only the task’s id, contextId and status, with state and timestamp. It has no answer, no history, and no error text for a failed task.
To get the answer of a task you didn’t wait for, subscribe to it: GET {baseUrl}/tasks/{taskId}:subscribe (v0.3: {baseUrl}/v1/tasks/{taskId}:subscribe) with Accept: text/event-stream. It replays the task’s events from the beginning in the same format as message:stream, without the leading task event, and follows the task live until it finishes. A task that has failed or been canceled can’t be subscribed to.
Errors
The task fails. The request still returns HTTP 200; the task ends inTASK_STATE_FAILED, and status.message.parts[0].text describes the error. For example, an unknown overrides.model fails the task with LLM model config not found: <model>.
MemoryLake rejects the request. Before the agent runs, MemoryLake checks your key, your quota, your permissions and the request itself. A rejection at this point uses an HTTP error status and the standard error body (success, message, error_code) on every transport, JSON-RPC included, and never comes as a stream. For example:
The agent rejects the request. The agent’s own rejections follow the A2A specification and reach you exactly as the agent sent them, status code and body included.
-
REST: an HTTP error status with a
google.rpc.Statusbody:The agent answers like this when another message in the same conversation is still being processed (400INVALID_ARGUMENT), when a task doesn’t exist (404NOT_FOUND), or when you subscribe to a task that failed or was canceled (400INVALID_ARGUMENT; a completed task replays as usual). -
JSON-RPC: HTTP 200 with a JSON-RPC
errorobject; v0.3 methods currently return code-32603for all of them. A v1.0 streaming method that is rejected before it starts answers with that JSON object (Content-Type: application/json) instead of an event stream; a v0.3 stream carries it as an event. Occasionally a JSON-RPC request is rejected with an HTTP error status instead, so check the status first.
TASK_STATE_COMPLETED, TASK_STATE_FAILED, TASK_STATE_CANCELED or TASK_STATE_INPUT_REQUIRED (in v0.3 JSON-RPC, the status update marked "final": true). TASK_STATE_INPUT_REQUIRED means the agent is waiting for your reply: send it as a new message with the same taskId, with no need to subscribe. If a stream ends without a final status, it was cut short; subscribe to the task to pick it up again.
The agent can’t answer. If the agent is unavailable or fails, the request returns 500 with the standard error body and error_code INTERNAL_ERROR. The message may include a trace ID; quote it when you contact support.
v0.3 differences
- JSON-RPC. The result is the task itself, marked
"kind": "task". Stream events are marked"kind": "status-update"or"artifact-update", and the last status update has"final": true. States are lowercase, for examplecompleted,failed,canceled,submittedandworking. Roles areuserandagent. Every part carries akind:{"kind": "text", "text": ...},{"kind": "data", "data": {...}}or{"kind": "file", "file": {...}}. - REST. States use the v1.0 spelling, except that a canceled task is
TASK_STATE_CANCELLED. Message parts are undercontentinstead ofparts, and a data part is{"data": {"data": {...}}}. The task returned byGEThas notimestamp. - REST defaults. If you leave out
blocking,message:sendreturns immediately instead of waiting. If you leave outhistoryLength,historyis left out. Set both explicitly.