Skip to content

aws-bedrockagentcore: CfnHarness HarnessBedrockModelConfigProperty is missing AdditionalParams (present in CloudFormation schema) #38800

Description

@hspoon-aws

Describe the bug

CfnHarness.HarnessBedrockModelConfigProperty (module aws-bedrockagentcore) is missing the AdditionalParams property that the live CloudFormation registry schema for AWS::BedrockAgentCore::Harness already exposes on HarnessBedrockModelConfig.

AdditionalParams is the documented mechanism for attaching Amazon Bedrock Guardrails (and other provider-specific Converse parameters) to a harness: https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/harness-models.html ("Apply Amazon Bedrock Guardrails" — "add a guardrailConfig object to bedrockModelConfig.additionalParams"). Without it there is no typed way to configure guardrails on a harness at deploy time.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Library Version

No response

Expected Behavior

HarnessBedrockModelConfigProperty exposes additionalParams?: any so this compiles:

new agentcore.CfnHarness(this, 'Harness', {
  harnessName: 'planner',
  executionRoleArn: role.roleArn,
  model: {
    bedrockModelConfig: {
      modelId: 'us.anthropic.claude-sonnet-5',
      additionalParams: {
        guardrailConfig: {
          guardrailIdentifier: guardrailArn,
          guardrailVersion: '1',
          trace: 'enabled',
        },
      },
    },
  },
});

Current Behavior

TypeScript rejects the property:

Object literal may only specify known properties, and 'additionalParams' does not exist in type 'HarnessBedrockModelConfigProperty'.

In aws-cdk-lib 2.266.0 and the latest 2.268.0, aws-bedrockagentcore/lib/bedrockagentcore.generated.d.ts defines the property with only:

interface HarnessBedrockModelConfigProperty {
  readonly apiFormat?: string;
  readonly maxTokens?: number;
  readonly modelId: string;
  readonly temperature?: number;
  readonly topP?: number;
}

The Python API reference shows the same shape (model_id, api_format, max_tokens, temperature, top_p), so all jsii languages are affected.

The CloudFormation registry schema does have the property:

$ aws cloudformation describe-type --type RESOURCE --type-name AWS::BedrockAgentCore::Harness \
    --query Schema --output text | jq '.definitions.HarnessBedrockModelConfig.properties | keys'
[
  "AdditionalParams",
  "ApiFormat",
  "MaxTokens",
  "ModelId",
  "Temperature",
  "TopP"
]

The latest published @aws-cdk/aws-service-spec (0.1.210) db.json contains zero occurrences of AdditionalParams, so the gap appears to be in the service-spec snapshot rather than in CloudFormation.

Reproduction Steps

  1. npm i aws-cdk-lib@2.268.0
  2. Add additionalParams to model.bedrockModelConfig in a CfnHarness as shown under Expected Behavior.
  3. tsc / cdk synth fails with the type error above.
  4. Compare with aws cloudformation describe-type --type RESOURCE --type-name AWS::BedrockAgentCore::Harness (us-west-2), which lists AdditionalParams under HarnessBedrockModelConfig.

Possible Solution

Refresh the AWS::BedrockAgentCore::Harness schema in @aws-cdk/aws-service-spec so the L1 generator emits additionalParams on HarnessBedrockModelConfigProperty (type any / JSON document, matching the data-plane SDK's HarnessBedrockModelConfig.additionalParams?: DocumentType).

Workaround in the meantime:

harness.addPropertyOverride('Model.BedrockModelConfig.AdditionalParams', {
  guardrailConfig: { guardrailIdentifier: guardrailArn, guardrailVersion: '1', trace: 'enabled' },
});

Additional Information/Context

The data-plane SDK already models the field: @aws-sdk/client-bedrock-agentcore 3.1119.0 HarnessBedrockModelConfig.additionalParams?: __DocumentType, and a per-invocation InvokeHarness override with additionalParams.guardrailConfig was verified live to return stopReason: guardrail_intervened when the guardrail triggers. The deploy-time CDK path is the only piece missing.

AWS CDK Library version (aws-cdk-lib)

2.266.0 (also reproduced against the 2.268.0 generated typings)

AWS CDK CLI version

2.1139.0

Node.js Version

v24.11.1

OS

macOS 26.6.2

Language

TypeScript

Language Version

TypeScript 5.6

Other information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions