Skip to content

feat(import): extract and pass through executionRoleArn from starter toolkit YAML#729

Merged
jesseturner21 merged 1 commit intoaws:mainfrom
jesseturner21:feat/import-execution-role
Mar 30, 2026
Merged

feat(import): extract and pass through executionRoleArn from starter toolkit YAML#729
jesseturner21 merged 1 commit intoaws:mainfrom
jesseturner21:feat/import-execution-role

Conversation

@jesseturner21
Copy link
Copy Markdown
Contributor

Summary

  • Parse the aws.execution_role field from .bedrock_agentcore.yaml and propagate it through the import pipeline into agentcore.json
  • Adds optional executionRoleArn to AgentEnvSpecSchema, ParsedStarterToolkitAgent, YAML parser, and toAgentEnvSpec()
  • When present, CDK uses the existing IAM role instead of creating a new one

User Experience

Before

$ agentcore import --source .bedrock_agentcore.yaml -y
# execution_role from YAML is ignored
# agentcore.json has no executionRoleArn
# CDK creates a brand new IAM role, discarding the original

After

$ cat .bedrock_agentcore.yaml
agents:
  my_agent:
    aws:
      execution_role: arn:aws:iam::123456789012:role/StarterToolkitRole
      ...

$ agentcore import --source .bedrock_agentcore.yaml -y
# CLI extracts execution_role from YAML

$ cat agentcore/agentcore.json
{
  "agents": [{
    "name": "my_agent",
    "executionRoleArn": "arn:aws:iam::123456789012:role/StarterToolkitRole",
    ...
  }]
}
# executionRoleArn written to agentcore.json
# CDK uses this role instead of creating a new one

Reverting to a CDK-managed role

Remove executionRoleArn from agentcore.json and run agentcore deploy.

Test plan

  • 4 new unit tests: YAML parsing with/without execution_role, spec generation with/without executionRoleArn
  • npm run typecheck passes
  • npm run lint passes (via pre-commit hook)

🤖 Generated with Claude Code

@jesseturner21 jesseturner21 requested a review from a team March 30, 2026 14:02
@github-actions github-actions bot added the size/s PR size: S label Mar 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.4.0.tgz

How to install

npm install https://github.com/aws/agentcore-cli/releases/download/pr-729-tarball/aws-agentcore-0.4.0.tgz

…toolkit YAML

Parse the `aws.execution_role` field from `.bedrock_agentcore.yaml` and
propagate it through the import pipeline into `agentcore.json`. When
present, CDK uses the existing IAM role instead of creating a new one.

- Add optional `executionRoleArn` to AgentEnvSpecSchema
- Add `executionRoleArn` to ParsedStarterToolkitAgent type
- Extract `execution_role` from YAML aws config in parser
- Pass through to AgentEnvSpec in toAgentEnvSpec()
@jesseturner21 jesseturner21 force-pushed the feat/import-execution-role branch from 5843cf5 to be2c8e9 Compare March 30, 2026 14:55
@github-actions github-actions bot added size/s PR size: S and removed size/s PR size: S labels Mar 30, 2026
@jesseturner21 jesseturner21 merged commit 60b5946 into aws:main Mar 30, 2026
20 checks passed
jesseturner21 added a commit that referenced this pull request Mar 30, 2026
The executionRoleArn field was added to the Zod schema in #729 but the
JSON schema was not updated to match.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants