aws-bedrockagentcore: CfnHarness HarnessBedrockModelConfigProperty is missing AdditionalParams (present in CloudFormation schema)
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### 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:
```ts
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:
```ts
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:
```ts
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_
Contributor guide
Research direction
Inspect the AWS::BedrockAgentCore::Harness entry in @aws-cdk/aws-service-spec's db.json and compare it with the live CloudFormation schema using the describe-type command shown. Refresh the schema so HarnessBedrockModelConfig includes AdditionalParams, then verify that bedrockagentcore.generated.d.ts exposes additionalParams and that the TypeScript example compiles or synthesizes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100