Skip to content

Commit 588de8b

Browse files
committed
feat: add Import from Bedrock Agents to add agent and create flows
Adds a third option in the "add agent" flow that fetches a Bedrock Agent's configuration via AWS SDK and translates it into runnable Strands or LangChain/LangGraph Python code, wired into the standard AgentCore project structure. Supports action groups, knowledge bases, multi-agent collaboration, code interpreter, guardrails, prompt overrides, and memory configuration. Both interactive TUI and non-interactive CLI paths are implemented.
1 parent 5c8d1b4 commit 588de8b

29 files changed

Lines changed: 3260 additions & 557 deletions

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Note: CDK L3 constructs are in a separate package `@aws/agentcore-cdk`.
4040
- **Template agents**: Created from framework templates (Strands, LangChain_LangGraph, CrewAI, GoogleADK, OpenAIAgents,
4141
AutoGen)
4242
- **BYO agents**: Bring your own code with `agentcore add agent --type byo`
43+
- **Imported agents**: Import from Bedrock Agents with `agentcore add agent --type import`
4344

4445
### Build Types
4546

docs/commands.md

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,38 @@ agentcore create --name MyProject --no-agent
2828

2929
# Preview without creating
3030
agentcore create --name MyProject --defaults --dry-run
31+
32+
# Import from Bedrock Agents
33+
agentcore create \
34+
--name MyImportedAgent \
35+
--type import \
36+
--agent-id AGENT123 \
37+
--agent-alias-id ALIAS456 \
38+
--region us-east-1 \
39+
--framework Strands \
40+
--memory none
3141
```
3242

3343
| Flag | Description |
3444
| ---------------------- | -------------------------------------------------------------------------------- |
35-
| `--name <name>` | Project name (alphanumeric, max 23 chars) |
36-
| `--defaults` | Use defaults (Python, Strands, Bedrock, no memory) |
37-
| `--no-agent` | Skip agent creation |
38-
| `--language <lang>` | `Python` or `TypeScript` |
39-
| `--framework <fw>` | `Strands`, `LangChain_LangGraph`, `GoogleADK`, `OpenAIAgents` |
40-
| `--model-provider <p>` | `Bedrock`, `Anthropic`, `OpenAI`, `Gemini` |
41-
| `--build <type>` | `CodeZip` (default) or `Container` (see [Container Builds](container-builds.md)) |
42-
| `--api-key <key>` | API key for non-Bedrock providers |
43-
| `--memory <opt>` | `none`, `shortTerm`, `longAndShortTerm` |
44-
| `--output-dir <dir>` | Output directory |
45-
| `--skip-git` | Skip git initialization |
46-
| `--skip-python-setup` | Skip venv setup |
47-
| `--dry-run` | Preview without creating |
48-
| `--json` | JSON output |
45+
| `--name <name>` | Project name (alphanumeric, max 23 chars) |
46+
| `--defaults` | Use defaults (Python, Strands, Bedrock, no memory) |
47+
| `--no-agent` | Skip agent creation |
48+
| `--type <type>` | `create` (default) or `import` |
49+
| `--language <lang>` | `Python` or `TypeScript` |
50+
| `--framework <fw>` | `Strands`, `LangChain_LangGraph`, `GoogleADK`, `OpenAIAgents` |
51+
| `--model-provider <p>` | `Bedrock`, `Anthropic`, `OpenAI`, `Gemini` |
52+
| `--build <type>` | `CodeZip` (default) or `Container` (see [Container Builds](container-builds.md)) |
53+
| `--api-key <key>` | API key for non-Bedrock providers |
54+
| `--memory <opt>` | `none`, `shortTerm`, `longAndShortTerm` |
55+
| `--agent-id <id>` | Bedrock Agent ID (import only) |
56+
| `--agent-alias-id <id>` | Bedrock Agent Alias ID (import only) |
57+
| `--region <region>` | AWS region for Bedrock Agent (import only) |
58+
| `--output-dir <dir>` | Output directory |
59+
| `--skip-git` | Skip git initialization |
60+
| `--skip-python-setup` | Skip venv setup |
61+
| `--dry-run` | Preview without creating |
62+
| `--json` | JSON output |
4963

5064
### deploy
5165

@@ -116,18 +130,31 @@ agentcore add agent \
116130
--language Python \
117131
--framework Strands \
118132
--model-provider Bedrock
133+
134+
# Import from Bedrock Agents
135+
agentcore add agent \
136+
--name MyAgent \
137+
--type import \
138+
--agent-id AGENT123 \
139+
--agent-alias-id ALIAS456 \
140+
--region us-east-1 \
141+
--framework Strands \
142+
--memory none
119143
```
120144

121145
| Flag | Description |
122146
| ------------------------ | -------------------------------------------------------------------------------- |
123147
| `--name <name>` | Agent name |
124-
| `--type <type>` | `create` (default) or `byo` |
148+
| `--type <type>` | `create` (default), `byo`, or `import` |
125149
| `--build <type>` | `CodeZip` (default) or `Container` (see [Container Builds](container-builds.md)) |
126150
| `--language <lang>` | `Python`, `TypeScript`, `Other` (BYO) |
127151
| `--framework <fw>` | Agent framework |
128152
| `--model-provider <p>` | Model provider |
129153
| `--api-key <key>` | API key for non-Bedrock |
130-
| `--memory <opt>` | Memory option (create only) |
154+
| `--memory <opt>` | Memory option (create and import) |
155+
| `--agent-id <id>` | Bedrock Agent ID (import only) |
156+
| `--agent-alias-id <id>` | Bedrock Agent Alias ID (import only) |
157+
| `--region <region>` | AWS region for Bedrock Agent (import only) |
131158
| `--code-location <path>` | Code path (BYO only) |
132159
| `--entrypoint <file>` | Entry file (BYO only) |
133160
| `--json` | JSON output |

docs/frameworks.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,51 @@ OpenAI's native agent framework.
7676
agentcore create --framework OpenAIAgents --model-provider OpenAI --api-key sk-...
7777
```
7878

79+
## Import from Bedrock Agents
80+
81+
If you have an existing Bedrock Agent, you can import its configuration and translate it into runnable Strands or
82+
LangChain/LangGraph code. The imported agent preserves your Bedrock Agent's action groups, knowledge bases, multi-agent
83+
collaboration, guardrails, prompts, and memory configuration.
84+
85+
```bash
86+
# Interactive (select "Import from Bedrock Agents" in the wizard)
87+
agentcore add agent
88+
89+
# Non-interactive
90+
agentcore add agent \
91+
--name MyAgent \
92+
--type import \
93+
--agent-id AGENT123 \
94+
--agent-alias-id ALIAS456 \
95+
--region us-east-1 \
96+
--framework Strands \
97+
--memory none
98+
```
99+
100+
### What gets imported
101+
102+
The import process fetches your Bedrock Agent's full configuration and translates it into framework-specific Python
103+
code that runs on AgentCore:
104+
105+
- **Action groups** (function-schema and built-in) become `@tool` decorated functions
106+
- **Knowledge bases** become retrieval tool integrations
107+
- **Multi-agent collaboration** produces separate collaborator files with recursive translation
108+
- **Code interpreter** wires to AgentCore's `code_interpreter_client`
109+
- **Guardrails** are configured in the model initialization
110+
- **Prompt overrides** are preserved as template variables
111+
- **Memory** integrates with AgentCore's memory service when enabled
112+
113+
### Import options
114+
115+
| Flag | Description |
116+
| ----------------------- | ----------------------------------------- |
117+
| `--type import` | Use import mode (required) |
118+
| `--agent-id <id>` | Bedrock Agent ID |
119+
| `--agent-alias-id <id>` | Bedrock Agent Alias ID |
120+
| `--region <region>` | AWS region where the Bedrock Agent exists |
121+
| `--framework <fw>` | `Strands` or `LangChain_LangGraph` |
122+
| `--memory <opt>` | `none`, `shortTerm`, `longAndShortTerm` |
123+
79124
## Bring Your Own (BYO) Agent
80125

81126
For existing agent code or frameworks not listed above, use the BYO option:

0 commit comments

Comments
 (0)