> **Experimental**
>
> `@aws-cdk/aws-bedrock-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# CustomParserProps

Properties for configuring a custom Lambda parser for prompt overrides.

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`bedrock/agents/prompt-override.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/@aws-cdk/aws-bedrock-alpha/bedrock/agents/prompt-override.ts#L185)

## Example

TypeScript:

```ts
const parserFunction = new lambda.Function(this, 'ParserFunction', {
  runtime: lambda.Runtime.PYTHON_3_10,
  handler: 'index.handler',
  code: lambda.Code.fromAsset('lambda'),
});

const agent = new bedrock.Agent(this, 'Agent', {
  foundationModel: bedrock.BedrockFoundationModel.AMAZON_NOVA_LITE_V1,
  instruction: 'You are a helpful assistant.',
  promptOverrideConfiguration: bedrock.PromptOverrideConfiguration.withCustomParser({
    parser: parserFunction,
    preProcessingStep: {
      stepType: bedrock.AgentStepType.PRE_PROCESSING,
      useCustomParser: true
    }
  })
});
```

Python:

```python
parser_function = lambda_.Function(self, "ParserFunction",
    runtime=lambda_.Runtime.PYTHON_3_10,
    handler="index.handler",
    code=lambda_.Code.from_asset("lambda")
)

agent = bedrock.Agent(self, "Agent",
    foundation_model=bedrock.BedrockFoundationModel.AMAZON_NOVA_LITE_V1,
    instruction="You are a helpful assistant.",
    prompt_override_configuration=bedrock.PromptOverrideConfiguration.with_custom_parser(
        parser=parser_function,
        pre_processing_step=bedrock.PromptPreProcessingConfigCustomParser(
            step_type=bedrock.AgentStepType.PRE_PROCESSING,
            use_custom_parser=True
        )
    )
)
```

Java:

```java
Function parserFunction = Function.Builder.create(this, "ParserFunction")
        .runtime(Runtime.PYTHON_3_10)
        .handler("index.handler")
        .code(Code.fromAsset("lambda"))
        .build();

Agent agent = Agent.Builder.create(this, "Agent")
        .foundationModel(BedrockFoundationModel.AMAZON_NOVA_LITE_V1)
        .instruction("You are a helpful assistant.")
        .promptOverrideConfiguration(PromptOverrideConfiguration.withCustomParser(CustomParserProps.builder()
                .parser(parserFunction)
                .preProcessingStep(PromptPreProcessingConfigCustomParser.builder()
                        .stepType(AgentStepType.PRE_PROCESSING)
                        .useCustomParser(true)
                        .build())
                .build()))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Alpha
var parserFunction = new Function(this, "ParserFunction", new FunctionProps {
    Runtime = Runtime.PYTHON_3_10,
    Handler = "index.handler",
    Code = Code.FromAsset("lambda")
});

var agent = new Agent(this, "Agent", new AgentProps {
    FoundationModel = BedrockFoundationModel.AMAZON_NOVA_LITE_V1,
    Instruction = "You are a helpful assistant.",
    PromptOverrideConfiguration = PromptOverrideConfiguration.WithCustomParser(new CustomParserProps {
        Parser = parserFunction,
        PreProcessingStep = new PromptPreProcessingConfigCustomParser {
            StepType = AgentStepType.PRE_PROCESSING,
            UseCustomParser = true
        }
    })
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awsbedrockalpha/v2
parserFunction := lambda.NewFunction(this, jsii.String("ParserFunction"), &FunctionProps{
	Runtime: lambda.Runtime_PYTHON_3_10(),
	Handler: jsii.String("index.handler"),
	Code: lambda.Code_FromAsset(jsii.String("lambda")),
})

agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
	FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
	Instruction: jsii.String("You are a helpful assistant."),
	PromptOverrideConfiguration: bedrock.PromptOverrideConfiguration_WithCustomParser(&CustomParserProps{
		Parser: parserFunction,
		PreProcessingStep: &PromptPreProcessingConfigCustomParser{
			StepType: bedrock.AgentStepType_PRE_PROCESSING,
			UseCustomParser: jsii.Boolean(true),
		},
	}),
})
```

## Properties

- `knowledgeBaseResponseGenerationStep`: [PromptKnowledgeBaseResponseGenerationConfigCustomParser](/cdk/api/v2/docs/@aws-cdk_aws-bedrock-alpha.PromptKnowledgeBaseResponseGenerationConfigCustomParser.html) — Configuration for the knowledge base response generation step.

  **Default:** undefined - No knowledge base response generation configuration

- `memorySummarizationStep`: [PromptMemorySummarizationConfigCustomParser](/cdk/api/v2/docs/@aws-cdk_aws-bedrock-alpha.PromptMemorySummarizationConfigCustomParser.html) — Configuration for the memory summarization step.

  **Default:** undefined - No memory summarization configuration

- `orchestrationStep`: [PromptOrchestrationConfigCustomParser](/cdk/api/v2/docs/@aws-cdk_aws-bedrock-alpha.PromptOrchestrationConfigCustomParser.html) — Configuration for the orchestration step.

  **Default:** undefined - No orchestration configuration

- `parser`: [IFunction](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IFunction.html) — Lambda function to use as custom parser.

  **Default:** undefined - No custom parser is used

- `postProcessingStep`: [PromptPostProcessingConfigCustomParser](/cdk/api/v2/docs/@aws-cdk_aws-bedrock-alpha.PromptPostProcessingConfigCustomParser.html) — Configuration for the post-processing step.

  **Default:** undefined - No post-processing configuration

- `preProcessingStep`: [PromptPreProcessingConfigCustomParser](/cdk/api/v2/docs/@aws-cdk_aws-bedrock-alpha.PromptPreProcessingConfigCustomParser.html) — Configuration for the pre-processing step.

  **Default:** undefined - No pre-processing configuration

- `routingClassifierStep`: [PromptRoutingClassifierConfigCustomParser](/cdk/api/v2/docs/@aws-cdk_aws-bedrock-alpha.PromptRoutingClassifierConfigCustomParser.html) — Configuration for the routing classifier step.

  **Default:** undefined - No routing classifier configuration
