A2A Domain API
Explicit agent-to-agent messages use scoped sender/recipient and conversation contracts. Registered metadata or a caller agent ID does not execute a published Agent version or authorize another scope. Ordinary runtime tool/model execution remains in Convex.
Usage boundary
Access the namespace on an explicitly configured root Cortex client. Host JWT and deployment-operator transports are distinct; validate current resource scope and do not infer authority from AuthContext metadata. See administrative operations.
Explicit agent-to-agent records
send requires from/to agent IDs and a nonempty message. Importance defaults to 60 (0–100); conversation tracking defaults to true. Optional user/context/priority/tags metadata describes provenance. It returns A2AMessage with IDs and storage references. request adds a request/response contract and timeout, default 30 seconds. Without configured response/pub-sub infrastructure it can raise A2ATimeoutError after the message was stored; inspect the error's message identity and do not create a duplicate request to recover its response. broadcast records per-recipient results; storage does not certify delivery confirmation without that infrastructure. Conversation queries return the selected A2A records.
import type { Cortex } from '@cortexmemory/sdk';
export async function sendApprovedAgentRecord(cortex: Cortex) {
return cortex.a2a.send({ from: 'dispatch-agent', to: 'routing-agent',
message: 'The delivery window changed to Wednesday.', importance: 70,
metadata: { priority: 'normal', tags: ['delivery'] } });
}
This namespace is an advanced explicit operator communication/record surface. Its local orchestration is not a second ordinary app Agent runtime and does not mint grants for other agents/spaces. Runtime tool/context registries, approved Gateway actions and model policy remain the default for application orchestration. Invalid participants/message/importance are rejected; missing downstream records or failed delivery should be handled according to the returned operation rather than assuming a broadcast is atomic across recipients.
The retained autoEmbed/autoSummarize flags do not provision a hosted embedding or summarization service. Current explicit processing uses supported configured/local callbacks; runtime processing uses backend policy.
Parameter and result contracts
These are reference definitions for the explicit server APIs. Optional fields use ?; timestamps are milliseconds since epoch unless an operation accepts a Date. Resource identifiers and participant metadata do not grant runtime authority.
A2ASendParams
export interface A2ASendParams {
from: string;
to: string;
message: string;
userId?: string;
contextId?: string;
importance?: number;
trackConversation?: boolean;
autoEmbed?: boolean;
metadata?: {
tags?: string[];
priority?: "low" | "normal" | "high" | "urgent";
[key: string]: unknown;
};
}
| Field | Meaning and defaults |
|---|---|
from | Sender agent ID |
to | Receiver agent ID |
message | Message content |
userId | Optional user ID (enables GDPR cascade) |
contextId | Optional context/workflow ID |
importance | Importance level 0-100 (default: 60) |
trackConversation | Store in ACID conversation (default: true) |
autoEmbed | Retained compatibility field; does not enable a cloud embedding service. |
metadata | Optional metadata |
A2AMessage
export interface A2AMessage {
messageId: string;
sentAt: number;
conversationId?: string;
acidMessageId?: string;
senderMemoryId: string;
receiverMemoryId: string;
}
| Field | Meaning and defaults |
|---|---|
messageId | Unique message ID |
sentAt | Timestamp when sent |
conversationId | ACID conversation ID (if trackConversation=true) |
acidMessageId | Message ID in ACID conversation |
senderMemoryId | Memory ID in sender's storage |
receiverMemoryId | Memory ID in receiver's storage |
A2ARequestParams
export interface A2ARequestParams {
from: string;
to: string;
message: string;
timeout?: number;
retries?: number;
userId?: string;
contextId?: string;
importance?: number;
}
| Field | Meaning and defaults |
|---|---|
from | Sender agent ID |
to | Receiver agent ID |
message | Request message |
timeout | Timeout in milliseconds (default: 30000) |
retries | Number of retry attempts (default: 1) |
userId | Optional user ID (enables GDPR cascade) |
contextId | Optional context/workflow ID |
importance | Importance level 0-100 |
A2AResponse
export interface A2AResponse {
response: string;
messageId: string;
responseMessageId: string;
respondedAt: number;
responseTime: number;
}
| Field | Meaning and defaults |
|---|---|
response | Response message content |
messageId | Original request message ID |
responseMessageId | Response message ID |
respondedAt | Timestamp when responded |
responseTime | Response time in milliseconds |
A2ABroadcastParams
export interface A2ABroadcastParams {
from: string;
to: string[];
message: string;
userId?: string;
contextId?: string;
importance?: number;
trackConversation?: boolean;
metadata?: {
tags?: string[];
[key: string]: unknown;
};
}
| Field | Meaning and defaults |
|---|---|
from | Sender agent ID |
to | Array of recipient agent IDs |
message | Message content |
userId | Optional user ID (enables GDPR cascade) |
contextId | Optional context/workflow ID |
importance | Importance level 0-100 (default: 60) |
trackConversation | Store in ACID conversation (default: true) |
metadata | Optional metadata |
A2ABroadcastResult
export interface A2ABroadcastResult {
messageId: string;
sentAt: number;
recipients: string[];
senderMemoryIds: string[];
receiverMemoryIds: string[];
memoriesCreated: number;
conversationIds?: string[];
}
| Field | Meaning and defaults |
|---|---|
messageId | Broadcast message ID |
sentAt | Timestamp when sent |
recipients | Array of recipient agent IDs |
senderMemoryIds | Memory IDs in sender's storage (one per recipient) |
receiverMemoryIds | Memory IDs in receivers' storage (one per recipient) |
memoriesCreated | Total memories created (sender + receiver for each) |
conversationIds | Conversation IDs (if trackConversation=true) |
A2AConversationFilters
export interface A2AConversationFilters {
since?: Date;
until?: Date;
minImportance?: number;
tags?: string[];
userId?: string;
limit?: number;
offset?: number;
format?: "chronological";
}
| Field | Meaning and defaults |
|---|---|
since | Filter by start date |
until | Filter by end date |
minImportance | Minimum importance filter (0-100) |
tags | Filter by tags |
userId | Filter A2A about specific user |
limit | Maximum messages to return (default: 100) |
offset | Pagination offset |
format | Output format |
A2AConversation
export interface A2AConversation {
participants: [string, string];
conversationId?: string;
messageCount: number;
messages: A2AConversationMessage[];
period: {
start: number;
end: number;
};
tags?: string[];
canRetrieveFullHistory: boolean;
}
| Field | Meaning and defaults |
|---|---|
participants | The two participants |
conversationId | ACID conversation ID (if exists) |
messageCount | Total message count (before pagination) |
messages | Conversation messages |
period | Time period covered |
tags | Tags found in messages |
canRetrieveFullHistory | True if ACID conversation exists for full history |
Public methods
The following signatures describe the TypeScript namespace. Parameter and result fields are defined on this page; the installed @cortexmemory/sdk declarations also provide their compile-time types. Signatures are reference notation, not application code to execute.
send
Send a message from one agent to another.
cortex.a2a.send(params: A2ASendParams): Promise<A2AMessage>
request
Send a request and wait for response (synchronous request-response).
cortex.a2a.request(params: A2ARequestParams): Promise<A2AResponse>
broadcast
Broadcast a message to multiple agents.
cortex.a2a.broadcast(params: A2ABroadcastParams): Promise<A2ABroadcastResult>
getConversation
Get conversation between two agents with filtering.
cortex.a2a.getConversation(agent1: string, agent2: string, filters?: A2AConversationFilters): Promise<A2AConversation>
Errors and lifecycle
Validation, missing capability, authorization, stale version and partial/unknown committed outcomes are explicit. Inspect operation/write/deletion receipts before recovery; do not repeat an external effect under a new identity after uncertainty. Close owned clients and graph resources at the end of the server workflow.
See runtime client for ordinary app execution and error handling for recovery boundaries.