Sending a response

Stream text, status updates, prompts, attachments, and errors back to the platform
View as Markdown

Every reply your agent sends is an AgentResponse carrying exactly one payload variant.

AgentResponse

FieldTypeRequiredNotes
conversationIdstringyesMust match the inbound Message.conversationId.
responseIdstringnoStable ID for this response. Used by feedback events.
traceContextTraceContextnoW3C trace context for this assistant response. See Trace context.
one variantyesOne of the fields below; @grpc/proto-loader flattens the oneof.

AgentResponse payload variants

VariantTypeNotes
incomingMessageMessageServer → agent only. The inbound message itself.
statusStatusUpdatePre-content typing indicator.
contentContentChunkActual message text, streamed.
promptsSuggestedPromptsQuick-reply suggestions.
threadMetadataThreadMetadataOpen a thread or update its title.
transcriptTranscriptSTT result back to the platform (audio flow).
errorErrorResponseSurface an error to the user.
contextRequestThreadHistoryRequestAsk the sidecar to hydrate thread history.
audioConfigAudioStreamConfigServer → agent only. Audio session start.
audioChunkAudioChunkServer → agent only. Audio bytes.
feedbackPlatformFeedbackServer → agent only. User feedback event.

Streaming text content

ContentChunk

FieldTypeRequiredNotes
typestringyesSTART | DELTA | END | REPLACE (see lifecycle).
contentstringnoSemantics depend on type.
attachmentsResponseAttachment[]noShip with END chunks (or standalone).
platformMessageIdstringnoReturned by the adapter after START; pass on later chunks to update it.
optionsMessageOptionsnoCreation flags.

ContentChunk.type lifecycle

ValueUse
STARTCreate the platform message. May be empty (immediate presence) or include initial content.
DELTAAppend the next token(s). Stream as many as you want.
ENDFinalize. Last content (optional) and any attachments ship here.
REPLACEOverwrite the full message content, for post-stream edits.

MessageOptions

FieldTypeRequiredNotes
ephemeralbooleannoOnly visible to the recipient user.
createThreadbooleannoStart a new thread under the user’s message.
replyToMessageIdstringnoReply to a specific message.
silentbooleannoSuppress notification.

ResponseAttachment (set exactly one variant)

VariantTypeFields
imageImageAttachmenturl, altText?, title?, width?, height?
fileFileAttachmenturl?, filename, mimeType?, sizeBytes?. For a filesystem output, write filename inside AGENT_FILES_DIR before sending END and leave url empty.
cardCardAttachmentplatformCardJson — Slack Block Kit, Discord Embeds, Teams cards.
linkLinkPreviewurl, title?, description?, imageUrl?
conversation.sendContentChunk(cid, { type: 'START', content: '' });
for await (const token of llm.stream(prompt)) {
conversation.sendContentChunk(cid, { type: 'DELTA', content: token });
}
conversation.sendContentChunk(cid, { type: 'END', content: '' });

Status updates

StatusUpdate

FieldTypeRequiredNotes
statusstringyesOne of the enum values below.
customMessagestringnoRequired with CUSTOM; otherwise overrides the default phrasing.
emojistringnoPlatform emoji, e.g. :mag:.

StatusUpdate.status values: THINKING, SEARCHING, GENERATING, PROCESSING, ANALYZING, CUSTOM.

conversation.sendStatusUpdate(cid, { status: 'SEARCHING' });
conversation.sendStatusUpdate(cid, {
status: 'CUSTOM',
customMessage: 'Querying the knowledge base…',
emoji: ':mag:',
});

Suggested prompts

SuggestedPrompts

FieldTypeRequiredNotes
promptsPrompt[]yesMax 4–6 depending on platform.

Prompt

FieldTypeRequiredNotes
idstringyesUnique ID. Echoed back in PlatformFeedback.promptSelection.
titlestringyesButton/chip label.
messagestringyesFull message sent on click.
descriptionstringnoTooltip/help text.

Errors

ErrorResponse

FieldTypeRequiredNotes
codestringyesOne of the enum values below.
messagestringyesUser-facing error message.
detailsstringnoTechnical details. Logged, not shown to the user.
retryablebooleannoWhether the platform should offer a retry affordance.

ErrorResponse.code values: RATE_LIMIT, CONTEXT_TOO_LONG, INVALID_REQUEST, AGENT_ERROR, TOOL_ERROR, PLATFORM_ERROR.

Thread metadata

ThreadMetadata

FieldTypeRequiredNotes
threadIdstringnoPlatform thread ID. Set to update an existing thread.
titlestringnoThread title/subject.
createNewbooleannoCreate a new thread.

Transcript

Sent after STT to replace the “[audio]” placeholder on the platform.

Transcript

FieldTypeRequiredNotes
textstringyesTranscribed text.
messageIdstringnoPlaceholder message ID to update.
languagestringnoBCP-47 detected language (e.g. en-US).

Next steps