Skip to content

Operation to invoke a Harness

Description

Operation to invoke a Harness.

Usage

bedrockagentcore_invoke_harness(harnessArn, qualifier, runtimeSessionId,
  runtimeUserId, traceParent, traceState, traceId, baggage, messages,
  model, systemPrompt, tools, skills, allowedTools, maxIterations,
  maxTokens, timeoutSeconds, actorId)

Arguments

  • harnessArn

    [required] The ARN of the harness to invoke.

  • qualifier

    The endpoint name to invoke. If omitted, the DEFAULT endpoint is used.

  • runtimeSessionId

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

  • runtimeUserId

    An identifier for the end user making the request. This value is passed through to the runtime container.

  • traceParent

    W3C trace context parent header containing version, trace ID, parent span ID, and trace flags.

  • traceState

    W3C trace context state header for vendor-specific trace information.

  • traceId

    Trace ID for maintaining observability through the operation.

  • baggage

    W3C Baggage header for user-defined context propagation. Format: key1=value1,key2=value2

  • 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"
        ),
        toolResultMetadata = list(
          metadata = "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"|"hook_stopped"
    ),
    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"
    ),
    hookEvent = list(
      hookEventId = "string",
      name = "string",
      type = "before_tool_call"|"after_tool_call"|"before_invocation"|"after_invocation",
      decision = "allow"|"deny",
      reason = "string"
    )
  )
)

Request syntax

svc$invoke_harness(
  harnessArn = "string",
  qualifier = "string",
  runtimeSessionId = "string",
  runtimeUserId = "string",
  traceParent = "string",
  traceState = "string",
  traceId = "string",
  baggage = "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,
      apiFormat = "converse_stream"|"responses"|"chat_completions",
      additionalParams = list()
    ),
    openAiModelConfig = list(
      modelId = "string",
      apiKeyArn = "string",
      apiBase = "string",
      maxTokens = 123,
      temperature = 123.0,
      topP = 123.0,
      apiFormat = "chat_completions"|"responses",
      additionalParams = list()
    ),
    geminiModelConfig = list(
      modelId = "string",
      apiKeyArn = "string",
      maxTokens = 123,
      temperature = 123.0,
      topP = 123.0,
      topK = 123,
      additionalParams = list()
    ),
    liteLlmModelConfig = list(
      modelId = "string",
      apiKeyArn = "string",
      apiBase = "string",
      maxTokens = 123,
      temperature = 123.0,
      topP = 123.0,
      additionalParams = list()
    )
  ),
  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",
      s3 = list(
        uri = "string"
      ),
      git = list(
        url = "string",
        path = "string",
        auth = list(
          credentialArn = "string",
          username = "string"
        )
      ),
      awsSkills = list(
        paths = list(
          "string"
        )
      )
    )
  ),
  allowedTools = list(
    "string"
  ),
  maxIterations = 123,
  maxTokens = 123,
  timeoutSeconds = 123,
  actorId = "string"
)