# BedrockInvokeModelJsonPathProps

Properties for invoking a Bedrock Model.

Extends: [TaskStateJsonPathBaseProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.TaskStateJsonPathBaseProps.html)
Used as argument in: [BedrockInvokeModel.jsonPath](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks.BedrockInvokeModel.html#jsonpath)

- Source: [`aws-stepfunctions-tasks/lib/bedrock/invoke-model.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/bedrock/invoke-model.ts#L145)
- Type last changed: v2.178.0 · 6 Feb 2025

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_bedrock as bedrock } from 'aws-cdk-lib';
import { aws_stepfunctions as stepfunctions } from 'aws-cdk-lib';
import { aws_stepfunctions_tasks as stepfunctions_tasks } from 'aws-cdk-lib';

declare const assign: any;
declare const guardrail: stepfunctions_tasks.Guardrail;
declare const model: bedrock.IModel;
declare const resultSelector: any;
declare const taskInput: stepfunctions.TaskInput;
declare const taskRole: stepfunctions.TaskRole;
declare const timeout: stepfunctions.Timeout;
const bedrockInvokeModelJsonPathProps: stepfunctions_tasks.BedrockInvokeModelJsonPathProps = {
  model: model,

  // the properties below are optional
  accept: 'accept',
  assign: {
    assignKey: assign,
  },
  body: taskInput,
  comment: 'comment',
  contentType: 'contentType',
  credentials: {
    role: taskRole,
  },
  guardrail: guardrail,
  heartbeat: cdk.Duration.minutes(30),
  heartbeatTimeout: timeout,
  input: {
    s3InputUri: 's3InputUri',
    s3Location: {
      bucketName: 'bucketName',
      objectKey: 'objectKey',

      // the properties below are optional
      objectVersion: 'objectVersion',
    },
  },
  inputPath: 'inputPath',
  integrationPattern: stepfunctions.IntegrationPattern.REQUEST_RESPONSE,
  output: {
    s3Location: {
      bucketName: 'bucketName',
      objectKey: 'objectKey',

      // the properties below are optional
      objectVersion: 'objectVersion',
    },
    s3OutputUri: 's3OutputUri',
  },
  outputPath: 'outputPath',
  queryLanguage: stepfunctions.QueryLanguage.JSON_PATH,
  resultPath: 'resultPath',
  resultSelector: {
    resultSelectorKey: resultSelector,
  },
  stateName: 'stateName',
  taskTimeout: timeout,
  timeout: cdk.Duration.minutes(30),
  traceEnabled: false,
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_bedrock as bedrock
from aws_cdk import aws_stepfunctions as stepfunctions
from aws_cdk import aws_stepfunctions_tasks as stepfunctions_tasks

# assign: Any
# guardrail: stepfunctions_tasks.Guardrail
# model: bedrock.IModel
# result_selector: Any
# task_input: stepfunctions.TaskInput
# task_role: stepfunctions.TaskRole
# timeout: stepfunctions.Timeout

bedrock_invoke_model_json_path_props = stepfunctions_tasks.BedrockInvokeModelJsonPathProps(
    model=model,

    # the properties below are optional
    accept="accept",
    assign={
        "assign_key": assign
    },
    body=task_input,
    comment="comment",
    content_type="contentType",
    credentials=stepfunctions.Credentials(
        role=task_role
    ),
    guardrail=guardrail,
    heartbeat=cdk.Duration.minutes(30),
    heartbeat_timeout=timeout,
    input=stepfunctions_tasks.BedrockInvokeModelInputProps(
        s3_input_uri="s3InputUri",
        s3_location=cdk.aws_s3.Location(
            bucket_name="bucketName",
            object_key="objectKey",

            # the properties below are optional
            object_version="objectVersion"
        )
    ),
    input_path="inputPath",
    integration_pattern=stepfunctions.IntegrationPattern.REQUEST_RESPONSE,
    output=stepfunctions_tasks.BedrockInvokeModelOutputProps(
        s3_location=cdk.aws_s3.Location(
            bucket_name="bucketName",
            object_key="objectKey",

            # the properties below are optional
            object_version="objectVersion"
        ),
        s3_output_uri="s3OutputUri"
    ),
    output_path="outputPath",
    query_language=stepfunctions.QueryLanguage.JSON_PATH,
    result_path="resultPath",
    result_selector={
        "result_selector_key": result_selector
    },
    state_name="stateName",
    task_timeout=timeout,
    timeout=cdk.Duration.minutes(30),
    trace_enabled=False
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.bedrock.*;
import software.amazon.awscdk.services.stepfunctions.*;
import software.amazon.awscdk.services.stepfunctions.tasks.*;

Object assign;
Guardrail guardrail;
IModel model;
Object resultSelector;
TaskInput taskInput;
TaskRole taskRole;
Timeout timeout;

BedrockInvokeModelJsonPathProps bedrockInvokeModelJsonPathProps = BedrockInvokeModelJsonPathProps.builder()
        .model(model)

        // the properties below are optional
        .accept("accept")
        .assign(Map.of(
                "assignKey", assign))
        .body(taskInput)
        .comment("comment")
        .contentType("contentType")
        .credentials(Credentials.builder()
                .role(taskRole)
                .build())
        .guardrail(guardrail)
        .heartbeat(Duration.minutes(30))
        .heartbeatTimeout(timeout)
        .input(BedrockInvokeModelInputProps.builder()
                .s3InputUri("s3InputUri")
                .s3Location(Location.builder()
                        .bucketName("bucketName")
                        .objectKey("objectKey")

                        // the properties below are optional
                        .objectVersion("objectVersion")
                        .build())
                .build())
        .inputPath("inputPath")
        .integrationPattern(IntegrationPattern.REQUEST_RESPONSE)
        .output(BedrockInvokeModelOutputProps.builder()
                .s3Location(Location.builder()
                        .bucketName("bucketName")
                        .objectKey("objectKey")

                        // the properties below are optional
                        .objectVersion("objectVersion")
                        .build())
                .s3OutputUri("s3OutputUri")
                .build())
        .outputPath("outputPath")
        .queryLanguage(QueryLanguage.JSON_PATH)
        .resultPath("resultPath")
        .resultSelector(Map.of(
                "resultSelectorKey", resultSelector))
        .stateName("stateName")
        .taskTimeout(timeout)
        .timeout(Duration.minutes(30))
        .traceEnabled(false)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.Bedrock;
using Amazon.CDK.AWS.StepFunctions;
using Amazon.CDK.AWS.StepFunctions.Tasks;

var assign;
Guardrail guardrail;
IModel model;
var resultSelector;
TaskInput taskInput;
TaskRole taskRole;
Timeout timeout;

var bedrockInvokeModelJsonPathProps = new BedrockInvokeModelJsonPathProps {
    Model = model,

    // the properties below are optional
    Accept = "accept",
    Assign = new Dictionary<string, object> {
        { "assignKey", assign }
    },
    Body = taskInput,
    Comment = "comment",
    ContentType = "contentType",
    Credentials = new Credentials {
        Role = taskRole
    },
    Guardrail = guardrail,
    Heartbeat = Duration.Minutes(30),
    HeartbeatTimeout = timeout,
    Input = new BedrockInvokeModelInputProps {
        S3InputUri = "s3InputUri",
        S3Location = new Location {
            BucketName = "bucketName",
            ObjectKey = "objectKey",

            // the properties below are optional
            ObjectVersion = "objectVersion"
        }
    },
    InputPath = "inputPath",
    IntegrationPattern = IntegrationPattern.REQUEST_RESPONSE,
    Output = new BedrockInvokeModelOutputProps {
        S3Location = new Location {
            BucketName = "bucketName",
            ObjectKey = "objectKey",

            // the properties below are optional
            ObjectVersion = "objectVersion"
        },
        S3OutputUri = "s3OutputUri"
    },
    OutputPath = "outputPath",
    QueryLanguage = QueryLanguage.JSON_PATH,
    ResultPath = "resultPath",
    ResultSelector = new Dictionary<string, object> {
        { "resultSelectorKey", resultSelector }
    },
    StateName = "stateName",
    TaskTimeout = timeout,
    Timeout = Duration.Minutes(30),
    TraceEnabled = false
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var assign interface{}
var guardrail Guardrail
var model IModel
var resultSelector interface{}
var taskInput TaskInput
var taskRole TaskRole
var timeout Timeout

bedrockInvokeModelJsonPathProps := &BedrockInvokeModelJsonPathProps{
	Model: model,

	// the properties below are optional
	Accept: jsii.String("accept"),
	Assign: map[string]interface{}{
		"assignKey": assign,
	},
	Body: taskInput,
	Comment: jsii.String("comment"),
	ContentType: jsii.String("contentType"),
	Credentials: &Credentials{
		Role: taskRole,
	},
	Guardrail: guardrail,
	Heartbeat: cdk.Duration_Minutes(jsii.Number(30)),
	HeartbeatTimeout: timeout,
	Input: &BedrockInvokeModelInputProps{
		S3InputUri: jsii.String("s3InputUri"),
		S3Location: &Location{
			BucketName: jsii.String("bucketName"),
			ObjectKey: jsii.String("objectKey"),

			// the properties below are optional
			ObjectVersion: jsii.String("objectVersion"),
		},
	},
	InputPath: jsii.String("inputPath"),
	IntegrationPattern: awscdk.Aws_stepfunctions.IntegrationPattern_REQUEST_RESPONSE,
	Output: &BedrockInvokeModelOutputProps{
		S3Location: &Location{
			BucketName: jsii.String("bucketName"),
			ObjectKey: jsii.String("objectKey"),

			// the properties below are optional
			ObjectVersion: jsii.String("objectVersion"),
		},
		S3OutputUri: jsii.String("s3OutputUri"),
	},
	OutputPath: jsii.String("outputPath"),
	QueryLanguage: awscdk.*Aws_stepfunctions.QueryLanguage_JSON_PATH,
	ResultPath: jsii.String("resultPath"),
	ResultSelector: map[string]interface{}{
		"resultSelectorKey": resultSelector,
	},
	StateName: jsii.String("stateName"),
	TaskTimeout: timeout,
	Timeout: cdk.Duration_*Minutes(jsii.Number(30)),
	TraceEnabled: jsii.Boolean(false),
}
```

## Properties

- `accept`: string = 'application/json' — The desired MIME type of the inference body in the response.

- `assign`: { [key: string]: any } — Workflow variables to store in this step.

  **Default:** Not assign variables

  Using workflow variables, you can store data in a step and retrieve that data in future steps.

- `body`: [TaskInput](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.TaskInput.html) — The input data for the Bedrock model invocation.

  **Default:** Input data is retrieved from the location specified in the `input` field

  The inference parameters contained in the body depend on the Bedrock model being used.

  The body must be in the format specified in the `contentType` field.
  For example, if the content type is `application/json`, the body must be
  JSON formatted.

  The body must be up to 256 KB in size. For input data that exceeds 256 KB,
  use `input` instead to retrieve the input data from S3.

  You must specify either the `body` or the `input` field, but not both.

- `comment`: string — A comment describing this state.

  **Default:** No comment

- `contentType`: string = 'application/json' — This property does not require configuration because the only acceptable value is 'application/json'.

- `credentials`: [Credentials](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.Credentials.html) — Credentials for an IAM Role that the State Machine assumes for executing the task.

  **Default:** None (Task is executed using the State Machine's execution role)

  This enables cross-account resource invocations.

- `guardrail`: [Guardrail](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks.Guardrail.html) — The guardrail is applied to the invocation.

  **Default:** No guardrail is applied to the invocation.

- `heartbeat`: [Duration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = None — use `heartbeatTimeout`

- `heartbeatTimeout`: [Timeout](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.Timeout.html) = None — Timeout for the heartbeat.

  [disable-awslint:duration-prop-type] is needed because all props interface in
  aws-stepfunctions-tasks extend this interface

- `input`: [BedrockInvokeModelInputProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks.BedrockInvokeModelInputProps.html) — The source location to retrieve the input data from.

  **Default:** Input data is retrieved from the `body` field

- `inputPath`: string = $ — JSONPath expression to select part of the state to be the input to this state.

  May also be the special value JsonPath.DISCARD, which will cause the effective
  input to be the empty object {}.

- `integrationPattern`: [IntegrationPattern](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.IntegrationPattern.html) — AWS Step Functions integrates with services directly in the Amazon States Language.

  **Default:** `IntegrationPattern.REQUEST_RESPONSE` for most tasks. `IntegrationPattern.RUN_JOB` for the following exceptions: `BatchSubmitJob`, `EmrAddStep`, `EmrCreateCluster`, `EmrTerminationCluster`, and `EmrContainersStartJobRun`.

  You can control these AWS services using service integration patterns.

  Depending on the AWS Service, the Service Integration Pattern availability will vary.

- `model`: [IModel](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrock.IModel.html) (required) — The Bedrock model that the task will invoke.

- `output`: [BedrockInvokeModelOutputProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks.BedrockInvokeModelOutputProps.html) — The destination location where the API response is written.

  **Default:** The API response body is returned in the result.

  If you specify this field, the API response body is replaced with a reference to the
  output location.

- `outputPath`: string = $ — JSONPath expression to select part of the state to be the output to this state.

  May also be the special value JsonPath.DISCARD, which will cause the effective
  output to be the empty object {}.

- `queryLanguage`: [QueryLanguage](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.QueryLanguage.html) = JSONPath — The name of the query language used by the state.

  If the state does not contain a `queryLanguage` field,
  then it will use the query language specified in the top-level `queryLanguage` field.

- `resultPath`: string = $ — JSONPath expression to indicate where to inject the state's output.

  May also be the special value JsonPath.DISCARD, which will cause the state's
  input to become its output.

- `resultSelector`: { [key: string]: any } = None — The JSON that will replace the state's raw result and become the effective result before ResultPath is applied.

  You can use ResultSelector to create a payload with values that are static
  or selected from the state's raw result.

- `stateName`: string — Optional name for this state.

  **Default:** The construct ID will be used as state name

- `taskTimeout`: [Timeout](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.Timeout.html) = None — Timeout for the task.

  [disable-awslint:duration-prop-type] is needed because all props interface in
  aws-stepfunctions-tasks extend this interface

- `timeout`: [Duration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = None — use `taskTimeout`

- `traceEnabled`: boolean — Specifies whether to enable or disable the Bedrock trace.

  **Default:** Trace is not enabled for the invocation.
