DevOpsAgentService / Client / send_message
send_message¶
- DevOpsAgentService.Client.send_message(**kwargs)¶
Sends a chat message and streams the response for the specified agent space execution
See also: AWS API Documentation
Request Syntax
response = client.send_message( agentSpaceId='string', executionId='string', content='string', context={ 'currentPage': 'string', 'lastMessage': 'string', 'userActionResponse': 'string' }, userId='string' )
- Parameters:
agentSpaceId (string) –
[REQUIRED]
The agent space identifier
executionId (string) –
[REQUIRED]
The execution identifier for the chat session
content (string) –
[REQUIRED]
The user message content
context (dict) –
Optional context for the message
currentPage (string) –
The current page or view the user is on
lastMessage (string) –
The ID of the last message in the conversation
userActionResponse (string) –
Response to a UI prompt (not a text conversation message)
userId (string) –
[REQUIRED]
Required user identifier
- Return type:
dict
- Returns:
The response of this operation contains an
EventStreammember. When iterated theEventStreamwill yield events based on the structure below, where only one of the top level keys will be present for any given event.Response Syntax
{ 'events': EventStream({ 'responseCreated': { 'responseId': 'string', 'sequenceNumber': 123 }, 'responseInProgress': { 'responseId': 'string', 'sequenceNumber': 123 }, 'responseCompleted': { 'responseId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123, 'totalTokens': 123 }, 'sequenceNumber': 123 }, 'responseFailed': { 'responseId': 'string', 'errorCode': 'string', 'errorMessage': 'string', 'sequenceNumber': 123 }, 'summary': { 'content': 'string', 'sequenceNumber': 123 }, 'heartbeat': {}, 'contentBlockStart': { 'index': 123, 'type': 'string', 'id': 'string', 'parentId': 'string', 'sequenceNumber': 123 }, 'contentBlockDelta': { 'index': 123, 'delta': { 'textDelta': { 'text': 'string' }, 'jsonDelta': { 'partialJson': 'string' } }, 'sequenceNumber': 123 }, 'contentBlockStop': { 'index': 123, 'type': 'string', 'text': 'string', 'last': True|False, 'sequenceNumber': 123 } }) }
Response Structure
(dict) –
Response structure for sending chat message events
events (
EventStream) –The stream of chat message events
responseCreated (dict) –
Emitted when the response is created
responseId (string) –
The response ID
sequenceNumber (integer) –
Event sequence number
responseInProgress (dict) –
Emitted while the response is being generated
responseId (string) –
The response ID
sequenceNumber (integer) –
Event sequence number
responseCompleted (dict) –
Emitted when the response completes successfully
responseId (string) –
The response ID
usage (dict) –
Token usage information
inputTokens (integer) –
Number of input tokens
outputTokens (integer) –
Number of output tokens
totalTokens (integer) –
Total tokens used
sequenceNumber (integer) –
Event sequence number
responseFailed (dict) –
Emitted when the response fails
responseId (string) –
The response ID
errorCode (string) –
Error code
errorMessage (string) –
Error message
sequenceNumber (integer) –
Event sequence number
summary (dict) –
Emitted to provide a summary of agent actions
content (string) –
Summary content
sequenceNumber (integer) –
Event sequence number
heartbeat (dict) –
Heartbeat event sent periodically to keep the connection alive during idle periods
contentBlockStart (dict) –
Emitted when a new content block starts
index (integer) –
Zero-based index of the content block
type (string) –
The type of content in this block
id (string) –
Block identifier
parentId (string) –
Optional parent block ID for nested content blocks (e.g. subagent tool calls)
sequenceNumber (integer) –
Event sequence number
contentBlockDelta (dict) –
Emitted for each incremental content delta within a content block
index (integer) –
Zero-based index of the content block
delta (dict) –
The incremental content delta
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
textDelta,jsonDelta. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
textDelta (dict) –
Text delta for text-based content blocks
text (string) –
The text fragment
jsonDelta (dict) –
JSON delta for structured content blocks
partialJson (string) –
Partial JSON string
sequenceNumber (integer) –
Event sequence number
contentBlockStop (dict) –
Emitted when a content block is complete
index (integer) –
Zero-based index of the content block
type (string) –
The type of content in this block
text (string) –
The accumulated complete content text
last (boolean) –
Whether this is the final content block in the response
sequenceNumber (integer) –
Event sequence number
Exceptions
DevOpsAgentService.Client.exceptions.ValidationExceptionDevOpsAgentService.Client.exceptions.ContentSizeExceededExceptionDevOpsAgentService.Client.exceptions.ServiceQuotaExceededExceptionDevOpsAgentService.Client.exceptions.ConflictExceptionDevOpsAgentService.Client.exceptions.InternalServerExceptionDevOpsAgentService.Client.exceptions.AccessDeniedExceptionDevOpsAgentService.Client.exceptions.ResourceNotFoundExceptionDevOpsAgentService.Client.exceptions.ThrottlingExceptionDevOpsAgentService.Client.exceptions.InvalidParameterException