createAct method
Creates a new AI task (act) within a session that can interact with tools and perform specific actions.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter sessionId :
The unique identifier of the session to create the act in.
Parameter task :
The task description that defines what the act should accomplish.
Parameter workflowDefinitionName :
The name of the workflow definition containing the session.
Parameter workflowRunId :
The unique identifier of the workflow run containing the session.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure the
idempotency of the request.
Parameter toolSpecs :
A list of tool specifications that the act can invoke to complete its
task.
Implementation
Future<CreateActResponse> createAct({
required String sessionId,
required String task,
required String workflowDefinitionName,
required String workflowRunId,
String? clientToken,
List<ToolSpec>? toolSpecs,
}) async {
final $payload = <String, dynamic>{
'task': task,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (toolSpecs != null) 'toolSpecs': toolSpecs,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri:
'/workflow-definitions/${Uri.encodeComponent(workflowDefinitionName)}/workflow-runs/${Uri.encodeComponent(workflowRunId)}/sessions/${Uri.encodeComponent(sessionId)}/acts',
exceptionFnMap: _exceptionFns,
);
return CreateActResponse.fromJson(response);
}