Skip to content

feat(memory): add agentcore memory l2 construct#35757

Merged
mergify[bot] merged 26 commits intoaws:mainfrom
krokoko:agentcore-memory
Oct 29, 2025
Merged

feat(memory): add agentcore memory l2 construct#35757
mergify[bot] merged 26 commits intoaws:mainfrom
krokoko:agentcore-memory

Conversation

@krokoko
Copy link
Copy Markdown
Contributor

@krokoko krokoko commented Oct 15, 2025

Issue # (if applicable)

Related to aws/aws-cdk-rfcs#825

Reason for this change

Adding a new alpha package for Amazon Bedrock AgentCore and add support for memory.

Description of changes

  • Create a new alpha package
  • Add L2 constructs for memory
  • Add documentation
  • Add tests

Describe any new or updated permissions being added

Using permissions for agent core defined in https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonbedrockagentcore.html

Description of how you validated changes

Unit tests, integration tests, manual tests

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team October 15, 2025 17:45
@github-actions github-actions bot added p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Oct 15, 2025
Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@aws-cdk-automation aws-cdk-automation dismissed their stale review October 15, 2025 17:49

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@mergify mergify bot dismissed Abogical’s stale review October 23, 2025 19:10

Pull request has been modified.

@krokoko krokoko marked this pull request as ready for review October 24, 2025 16:30
@krokoko
Copy link
Copy Markdown
Contributor Author

krokoko commented Oct 24, 2025

tagging the PR as "ready for review" since the RFC was approved

@aws-cdk-automation aws-cdk-automation added the pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. label Oct 25, 2025
throw new ValidationError(errors.join('\n'));
}
return param;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validation errors should be scoped to the resource it emits. (This should've been specified in the design guidelines, not sure why it isn't), see here.

Also, the entire validation helper file seem to be very general functions that can be used elsewhere, and is quite similar to the ones added by runtime. To avoid duplication, use what is available in core/lib. If it's not available
in core, you can add it there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we use the same validation methods in every part of agentcore alpha package. Is this a blocker for you now ? I can create a follow up PR to harmonize these across the three primitives (memory, 1p tools, runtime)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a strong blocker, but I'd prefer the validation errors be scoped to the resource at least so the users can know where the error is coming from.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scoped in ddae010
as discussed will open a PR later to harmonize across the different pieces of the alpha package

@mergify mergify bot dismissed Abogical’s stale review October 27, 2025 15:32

Pull request has been modified.

@Abogical Abogical self-assigned this Oct 27, 2025

export const FULL_ACCESS_PERMS = [
...new Set([...STM.WRITE_PERMS, ...READ_PERMS, ...DELETE_PERMS, ...ADMIN_PERMS]),
];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be misunderstanding something here, but shouldn't these permissions be used in the grant methods?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are in the grantFullAccess method:

grantFullAccess(grantee: iam.IGrantable): iam.Grant {
    return this.grant(grantee, ...MemoryPerms.FULL_ACCESS_PERMS);
  }

Is that what you are referring to ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find this grant method in the PR. Is it pushed to this PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes in memory.ts, line 326

/**
   * Grant the given principal identity permissions to do every action on this memory.
   *
   * @param grantee - The IAM principal to grant full access permissions to
   * @default - Default grant configuration:
   * - actions: ['bedrock-agentcore:CreateEvent',
      'bedrock-agentcore:GetEvent',
      'bedrock-agentcore:DeleteEvent',
      'bedrock-agentcore:GetMemoryRecord',
      'bedrock-agentcore:RetrieveMemoryRecords',
      'bedrock-agentcore:ListMemoryRecords',
      'bedrock-agentcore:ListActors',
      'bedrock-agentcore:ListSessions',
      'bedrock-agentcore:CreateMemory',
      'bedrock-agentcore:GetMemory',
      'bedrock-agentcore:DeleteMemory',
      'bedrock-agentcore:UpdateMemory'] on this.memoryArn
   * @returns An IAM Grant object representing the granted permissions
   */
  grantFullAccess(grantee: iam.IGrantable): iam.Grant {
    return this.grant(grantee, ...MemoryPerms.FULL_ACCESS_PERMS);
  }

@mergify mergify bot dismissed Abogical’s stale review October 28, 2025 14:05

Pull request has been modified.

grantAdmin(grantee: iam.IGrantable): iam.Grant {
return this.grant(grantee, ...MemoryPerms.ADMIN_PERMS);
}
/**
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Abogical FYI

@krokoko krokoko requested a review from Abogical October 28, 2025 18:53
Copy link
Copy Markdown
Member

@Abogical Abogical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks!

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Oct 29, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Oct 29, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 6a2e17e into aws:main Oct 29, 2025
18 of 20 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2 pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants