Skip to content

Invoke Harness

bedrockagentcore_invoke_harness R Documentation

Operation to invoke a Harness

Description

Operation to invoke a Harness.

Usage

bedrockagentcore_invoke_harness(harnessArn, runtimeSessionId, messages,
  model, systemPrompt, tools, skills, allowedTools, maxIterations,
  maxTokens, timeoutSeconds, actorId)

Arguments

harnessArn

[required] The ARN of the harness to invoke.

runtimeSessionId

[required] The session ID for the invocation. Use the same session ID across requests to continue a conversation.

messages

[required] The messages to send to the agent.

model

The model configuration to use for this invocation. If specified, overrides the harness default.

systemPrompt

The system prompt to use for this invocation. If specified, overrides the harness default.

tools

The tools available to the agent for this invocation. If specified, overrides the harness default.

skills

The skills available to the agent for this invocation. If specified, overrides the harness default.

allowedTools

The tools that the agent is allowed to use for this invocation. If specified, overrides the harness default.

maxIterations

The maximum number of iterations the agent loop can execute. If specified, overrides the harness default.

maxTokens

The maximum number of tokens the agent can generate per iteration. If specified, overrides the harness default.

timeoutSeconds

The maximum duration in seconds for the agent loop execution. If specified, overrides the harness default.

actorId

The actor ID for memory operations. Overrides the actor ID configured on the harness.

Value

A list with the following syntax:

list(
  stream = list(
    messageStart = list(
      role = "user"|"assistant"
    ),
    contentBlockStart = list(
      contentBlockIndex = 123,
      start = list(
        toolUse = list(
          toolUseId = "string",
          name = "string",
          type = "tool_use"|"server_tool_use"|"mcp_tool_use",
          serverName = "string"
        ),
        toolResult = list(
          toolUseId = "string",
          status = "success"|"error"
        )
      )
    ),
    contentBlockDelta = list(
      contentBlockIndex = 123,
      delta = list(
        text = "string",
        toolUse = list(
          input = "string"
        ),
        toolResult = list(
          list(
            text = "string",
            json = list()
          )
        ),
        reasoningContent = list(
          text = "string",
          redactedContent = raw,
          signature = "string"
        )
      )
    ),
    contentBlockStop = list(
      contentBlockIndex = 123
    ),
    messageStop = list(
      stopReason = "end_turn"|"tool_use"|"tool_result"|"max_tokens"|"stop_sequence"|"content_filtered"|"malformed_model_output"|"malformed_tool_use"|"interrupted"|"partial_turn"|"model_context_window_exceeded"|"max_iterations_exceeded"|"max_output_tokens_exceeded"|"timeout_exceeded"
    ),
    metadata = list(
      usage = list(
        inputTokens = 123,
        outputTokens = 123,
        totalTokens = 123,
        cacheReadInputTokens = 123,
        cacheWriteInputTokens = 123
      ),
      metrics = list(
        latencyMs = 123
      )
    ),
    internalServerException = list(
      message = "string"
    ),
    validationException = list(
      message = "string",
      reason = "CannotParse"|"FieldValidationFailed"|"IdempotentParameterMismatchException"|"EventInOtherSession"|"ResourceConflict",
      fieldList = list(
        list(
          name = "string",
          message = "string"
        )
      )
    ),
    runtimeClientError = list(
      message = "string"
    )
  )
)

Request syntax

svc$invoke_harness(
  harnessArn = "string",
  runtimeSessionId = "string",
  messages = list(
    list(
      role = "user"|"assistant",
      content = list(
        list(
          text = "string",
          toolUse = list(
            name = "string",
            toolUseId = "string",
            input = list(),
            type = "tool_use"|"server_tool_use"|"mcp_tool_use",
            serverName = "string"
          ),
          toolResult = list(
            toolUseId = "string",
            content = list(
              list(
                text = "string",
                json = list()
              )
            ),
            status = "success"|"error",
            type = "tool_use"|"server_tool_use"|"mcp_tool_use"
          ),
          reasoningContent = list(
            reasoningText = list(
              text = "string",
              signature = "string"
            ),
            redactedContent = raw
          )
        )
      )
    )
  ),
  model = list(
    bedrockModelConfig = list(
      modelId = "string",
      maxTokens = 123,
      temperature = 123.0,
      topP = 123.0
    ),
    openAiModelConfig = list(
      modelId = "string",
      apiKeyArn = "string",
      maxTokens = 123,
      temperature = 123.0,
      topP = 123.0
    ),
    geminiModelConfig = list(
      modelId = "string",
      apiKeyArn = "string",
      maxTokens = 123,
      temperature = 123.0,
      topP = 123.0,
      topK = 123
    )
  ),
  systemPrompt = list(
    list(
      text = "string"
    )
  ),
  tools = list(
    list(
      type = "remote_mcp"|"agentcore_browser"|"agentcore_gateway"|"inline_function"|"agentcore_code_interpreter",
      name = "string",
      config = list(
        remoteMcp = list(
          url = "string",
          headers = list(
            "string"
          )
        ),
        agentCoreBrowser = list(
          browserArn = "string"
        ),
        agentCoreGateway = list(
          gatewayArn = "string",
          outboundAuth = list(
            awsIam = list(),
            none = list(),
            oauth = list(
              providerArn = "string",
              scopes = list(
                "string"
              ),
              customParameters = list(
                "string"
              ),
              grantType = "CLIENT_CREDENTIALS"|"AUTHORIZATION_CODE"|"TOKEN_EXCHANGE",
              defaultReturnUrl = "string"
            )
          )
        ),
        inlineFunction = list(
          description = "string",
          inputSchema = list()
        ),
        agentCoreCodeInterpreter = list(
          codeInterpreterArn = "string"
        )
      )
    )
  ),
  skills = list(
    list(
      path = "string"
    )
  ),
  allowedTools = list(
    "string"
  ),
  maxIterations = 123,
  maxTokens = 123,
  timeoutSeconds = 123,
  actorId = "string"
)