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

Defines how fulfillment of the action group is handled after the necessary information has been elicited from the user.

Valid executors are:
- Lambda function
- Return Control

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`bedrock/agents/api-executor.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0-alpha.0/packages/@aws-cdk/aws-bedrock-alpha/bedrock/agents/api-executor.ts#L27)

## Example

```ts
const bucket = s3.Bucket.fromBucketName(this, 'ExistingBucket', 'my-schema-bucket');
const s3Schema = bedrock.ApiSchema.fromS3File(bucket, 'schemas/action-group.yaml');

const actionGroupFunction = new lambda.Function(this, 'ActionGroupFunction', {
  runtime: lambda.Runtime.PYTHON_3_12,
  handler: 'index.handler',
  code: lambda.Code.fromAsset(path.join(__dirname, '../lambda/action-group')),
});

const actionGroup = new bedrock.AgentActionGroup({
  name: 'query-library',
  description: 'Use these functions to get information about the books in the library.',
  executor: bedrock.ActionGroupExecutor.fromLambda(actionGroupFunction),
  enabled: true,
  apiSchema: s3Schema,
});

const agent = new bedrock.Agent(this, 'Agent', {
  foundationModel: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_HAIKU_V1_0,
  instruction: 'You are a helpful and friendly agent that answers questions about literature.',
});

agent.addActionGroup(actionGroup);
```

## Properties

- `customControl`: [CustomControl](/cdk/api/v2/docs/@aws-cdk_aws-bedrock-alpha.CustomControl.html) — The custom control type for the action group executor.

  Currently only supports 'RETURN_CONTROL' which returns results directly in the InvokeAgent response.

- `lambdaFunction`: [IFunction](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IFunction.html) — The Lambda function that will be called by the action group.

  Contains the business logic for handling the action group's invocation.

- `RETURN_CONTROL`: [ActionGroupExecutor](/cdk/api/v2/docs/@aws-cdk_aws-bedrock-alpha.ActionGroupExecutor.html) (static) — Returns the action group invocation results directly in the InvokeAgent response.

  The information and parameters can be sent to your own systems to yield results.

## Methods

- `fromLambda(lambdaFunction: IFunction): ActionGroupExecutor // chainable` (static) — Defines an action group with a Lambda function containing the business logic.

  **Parameters**

  - `lambdaFunction` — - Lambda function to be called by the action group.
