bedrock-agentcore-starter-toolkit 0.1.3__py3-none-any.whl → 0.1.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bedrock-agentcore-starter-toolkit might be problematic. Click here for more details.
- bedrock_agentcore_starter_toolkit/cli/__init__.py +1 -0
- bedrock_agentcore_starter_toolkit/cli/cli.py +2 -0
- bedrock_agentcore_starter_toolkit/cli/import_agent/README.md +35 -0
- bedrock_agentcore_starter_toolkit/cli/import_agent/__init__.py +1 -0
- bedrock_agentcore_starter_toolkit/cli/import_agent/agent_info.py +230 -0
- bedrock_agentcore_starter_toolkit/cli/import_agent/commands.py +518 -0
- bedrock_agentcore_starter_toolkit/operations/gateway/client.py +2 -2
- bedrock_agentcore_starter_toolkit/services/__init__.py +1 -0
- bedrock_agentcore_starter_toolkit/services/import_agent/__init__.py +1 -0
- bedrock_agentcore_starter_toolkit/services/import_agent/assets/memory_manager_template.py +207 -0
- bedrock_agentcore_starter_toolkit/services/import_agent/assets/requirements_langchain.j2 +9 -0
- bedrock_agentcore_starter_toolkit/services/import_agent/assets/requirements_strands.j2 +5 -0
- bedrock_agentcore_starter_toolkit/services/import_agent/assets/template_fixtures_merged.json +1102 -0
- bedrock_agentcore_starter_toolkit/services/import_agent/scripts/__init__.py +1 -0
- bedrock_agentcore_starter_toolkit/services/import_agent/scripts/base_bedrock_translate.py +1668 -0
- bedrock_agentcore_starter_toolkit/services/import_agent/scripts/bedrock_to_langchain.py +382 -0
- bedrock_agentcore_starter_toolkit/services/import_agent/scripts/bedrock_to_strands.py +374 -0
- bedrock_agentcore_starter_toolkit/services/import_agent/utils.py +417 -0
- bedrock_agentcore_starter_toolkit/utils/runtime/templates/execution_role_policy.json.j2 +2 -1
- {bedrock_agentcore_starter_toolkit-0.1.3.dist-info → bedrock_agentcore_starter_toolkit-0.1.4.dist-info}/METADATA +22 -2
- {bedrock_agentcore_starter_toolkit-0.1.3.dist-info → bedrock_agentcore_starter_toolkit-0.1.4.dist-info}/RECORD +25 -9
- {bedrock_agentcore_starter_toolkit-0.1.3.dist-info → bedrock_agentcore_starter_toolkit-0.1.4.dist-info}/WHEEL +0 -0
- {bedrock_agentcore_starter_toolkit-0.1.3.dist-info → bedrock_agentcore_starter_toolkit-0.1.4.dist-info}/entry_points.txt +0 -0
- {bedrock_agentcore_starter_toolkit-0.1.3.dist-info → bedrock_agentcore_starter_toolkit-0.1.4.dist-info}/licenses/LICENSE.txt +0 -0
- {bedrock_agentcore_starter_toolkit-0.1.3.dist-info → bedrock_agentcore_starter_toolkit-0.1.4.dist-info}/licenses/NOTICE.txt +0 -0
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
"""Utility functions for Bedrock Agent import service."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
import re
|
|
6
|
+
import secrets
|
|
7
|
+
import textwrap
|
|
8
|
+
from typing import Any, Dict, List, Union
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def json_to_obj_fixed(json_string: str):
|
|
12
|
+
"""Convert a JSON string to a Python object, handling common formatting issues."""
|
|
13
|
+
json_string = json_string.strip()
|
|
14
|
+
json_string = " ".join(json_string.split())
|
|
15
|
+
|
|
16
|
+
try:
|
|
17
|
+
output = json.loads(json_string)
|
|
18
|
+
except json.JSONDecodeError:
|
|
19
|
+
output = json_string
|
|
20
|
+
|
|
21
|
+
return output
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def fix_field(obj, field=None):
|
|
25
|
+
"""Fixes the field in the object by converting it to a JSON object if it's a string."""
|
|
26
|
+
if field is None:
|
|
27
|
+
return json_to_obj_fixed(obj)
|
|
28
|
+
else:
|
|
29
|
+
# Create a new dict to avoid modifying the original
|
|
30
|
+
new_obj = obj.copy()
|
|
31
|
+
new_obj[field] = json_to_obj_fixed(obj[field])
|
|
32
|
+
|
|
33
|
+
return new_obj
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def clean_variable_name(text):
|
|
37
|
+
"""Clean a string to create a valid Python variable name. Useful for cleaning Bedrock Agents fields."""
|
|
38
|
+
text = str(text)
|
|
39
|
+
cleaned = re.sub(r"[^a-zA-Z0-9\s]", " ", text)
|
|
40
|
+
cleaned = cleaned.lower()
|
|
41
|
+
cleaned = re.sub(r"\s+", " ", cleaned)
|
|
42
|
+
cleaned = cleaned.strip()
|
|
43
|
+
cleaned = cleaned.replace(" ", "_")
|
|
44
|
+
if cleaned and cleaned[0].isdigit():
|
|
45
|
+
cleaned = f"_{cleaned}"
|
|
46
|
+
|
|
47
|
+
if not cleaned:
|
|
48
|
+
cleaned = "variable"
|
|
49
|
+
|
|
50
|
+
return cleaned
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def unindent_by_one(input_code, spaces_per_indent=4):
|
|
54
|
+
"""Unindents the input code by one level of indentation.
|
|
55
|
+
|
|
56
|
+
Note: text dedent does not work as expected in this context, so we implement our own logic.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
input_code (str): The code to unindent.
|
|
60
|
+
spaces_per_indent (int): The number of spaces per indentation level (default is 4).
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
str: The unindented code.
|
|
64
|
+
"""
|
|
65
|
+
lines = input_code.splitlines(True) # Keep the line endings
|
|
66
|
+
# Process each line
|
|
67
|
+
unindented = []
|
|
68
|
+
for line in lines:
|
|
69
|
+
if line.strip(): # If line is not empty
|
|
70
|
+
current_indent = len(line) - len(line.lstrip())
|
|
71
|
+
# Remove one level of indentation if possible
|
|
72
|
+
if current_indent >= spaces_per_indent:
|
|
73
|
+
line = line[spaces_per_indent:]
|
|
74
|
+
unindented.append(line)
|
|
75
|
+
|
|
76
|
+
return "".join(unindented)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def generate_pydantic_models(
|
|
80
|
+
schema_input: Union[Dict[str, Any], List[Dict[str, Any]], str],
|
|
81
|
+
root_model_name: str = "RequestModel",
|
|
82
|
+
content_type_annotation: str = "",
|
|
83
|
+
) -> str:
|
|
84
|
+
"""Generate Pydantic models from OpenAPI schema objects. Works recursively for nested objects.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
schema_input: The OpenAPI schema, parameter object or parameter array as dictionary/list or JSON string
|
|
88
|
+
root_model_name: Name for the root model
|
|
89
|
+
content_type_annotation: Optional content type annotation for the root model
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
String containing Python code for the Pydantic models
|
|
93
|
+
"""
|
|
94
|
+
# Convert JSON string to dictionary/list if needed
|
|
95
|
+
if isinstance(schema_input, str):
|
|
96
|
+
try:
|
|
97
|
+
schema_input = json.loads(schema_input)
|
|
98
|
+
except json.JSONDecodeError as e:
|
|
99
|
+
raise ValueError(f"Invalid JSON input: {e}") from e
|
|
100
|
+
|
|
101
|
+
# Start with the imports
|
|
102
|
+
code = "\n"
|
|
103
|
+
|
|
104
|
+
# Dictionary to keep track of models we've created
|
|
105
|
+
models = {}
|
|
106
|
+
|
|
107
|
+
def clean_class_name(name: str) -> str:
|
|
108
|
+
"""Create a valid Python class name."""
|
|
109
|
+
# Replace non-alphanumeric characters with underscores
|
|
110
|
+
cleaned = re.sub(r"[^a-zA-Z0-9]", "_", name)
|
|
111
|
+
# Ensure it starts with a letter
|
|
112
|
+
if cleaned and not cleaned[0].isalpha():
|
|
113
|
+
cleaned = "Model_" + cleaned
|
|
114
|
+
# Convert to CamelCase
|
|
115
|
+
return "".join(word.capitalize() for word in cleaned.split("_"))
|
|
116
|
+
|
|
117
|
+
def process_schema(schema_obj: Dict[str, Any], name: str) -> str:
|
|
118
|
+
"""Process a schema object and return the model class name."""
|
|
119
|
+
# Handle schema wrapper
|
|
120
|
+
if "schema" in schema_obj:
|
|
121
|
+
schema_obj = schema_obj["schema"]
|
|
122
|
+
|
|
123
|
+
# Handle $ref
|
|
124
|
+
if "$ref" in schema_obj:
|
|
125
|
+
ref_name = schema_obj["$ref"].split("/")[-1]
|
|
126
|
+
return clean_class_name(ref_name)
|
|
127
|
+
|
|
128
|
+
obj_type = schema_obj.get("type")
|
|
129
|
+
|
|
130
|
+
# Default to object type if not specified
|
|
131
|
+
if obj_type is None:
|
|
132
|
+
obj_type = "object"
|
|
133
|
+
|
|
134
|
+
if obj_type == "object":
|
|
135
|
+
# Generate a valid Python class name
|
|
136
|
+
class_name = clean_class_name(name)
|
|
137
|
+
|
|
138
|
+
# Avoid duplicate model names
|
|
139
|
+
if class_name in models:
|
|
140
|
+
return class_name
|
|
141
|
+
|
|
142
|
+
properties = schema_obj.get("properties", {})
|
|
143
|
+
required = schema_obj.get("required", [])
|
|
144
|
+
|
|
145
|
+
class_def = f"class {class_name}(BaseModel):\n"
|
|
146
|
+
|
|
147
|
+
# Add content type annotation if provided
|
|
148
|
+
if content_type_annotation:
|
|
149
|
+
class_def += f' content_type_annotation: Literal["{content_type_annotation}"]\n'
|
|
150
|
+
|
|
151
|
+
if "description" in schema_obj:
|
|
152
|
+
class_def += f' """{schema_obj["description"]}"""\n'
|
|
153
|
+
|
|
154
|
+
if not properties:
|
|
155
|
+
class_def += " pass\n"
|
|
156
|
+
models[class_name] = class_def
|
|
157
|
+
return class_name
|
|
158
|
+
|
|
159
|
+
for prop_name, prop_schema in properties.items():
|
|
160
|
+
field_type = get_type_hint(prop_schema, f"{name}_{prop_name}")
|
|
161
|
+
|
|
162
|
+
# Check if required
|
|
163
|
+
is_required = prop_name in required
|
|
164
|
+
|
|
165
|
+
# Build the field definition
|
|
166
|
+
if is_required:
|
|
167
|
+
if "description" in prop_schema:
|
|
168
|
+
field_def = f' = Field(description="{prop_schema["description"]}")'
|
|
169
|
+
else:
|
|
170
|
+
field_def = ""
|
|
171
|
+
else:
|
|
172
|
+
field_type = f"Optional[{field_type}]"
|
|
173
|
+
if "description" in prop_schema:
|
|
174
|
+
field_def = f' = Field(None, description="{prop_schema["description"]}")'
|
|
175
|
+
else:
|
|
176
|
+
field_def = " = None"
|
|
177
|
+
|
|
178
|
+
class_def += f" {prop_name}: {field_type}{field_def}\n"
|
|
179
|
+
|
|
180
|
+
models[class_name] = class_def
|
|
181
|
+
return class_name
|
|
182
|
+
elif obj_type == "array":
|
|
183
|
+
items = schema_obj.get("items", {})
|
|
184
|
+
item_type = get_type_hint(items, f"{name}_item")
|
|
185
|
+
return f"List[{item_type}]"
|
|
186
|
+
else:
|
|
187
|
+
return get_python_type(obj_type)
|
|
188
|
+
|
|
189
|
+
def get_type_hint(prop_schema: Dict[str, Any], name: str) -> str:
|
|
190
|
+
"""Get the Python type hint for a property schema."""
|
|
191
|
+
if "$ref" in prop_schema:
|
|
192
|
+
ref_name = prop_schema["$ref"].split("/")[-1]
|
|
193
|
+
return clean_class_name(ref_name)
|
|
194
|
+
|
|
195
|
+
prop_type = prop_schema.get("type")
|
|
196
|
+
|
|
197
|
+
# Default to Any if type is not specified
|
|
198
|
+
if prop_type is None:
|
|
199
|
+
return "Any"
|
|
200
|
+
|
|
201
|
+
if prop_type == "object":
|
|
202
|
+
# This is a nested object, create a new model for it
|
|
203
|
+
return process_schema(prop_schema, name)
|
|
204
|
+
elif prop_type == "array":
|
|
205
|
+
items = prop_schema.get("items", {})
|
|
206
|
+
item_type = get_type_hint(items, name)
|
|
207
|
+
return f"List[{item_type}]"
|
|
208
|
+
else:
|
|
209
|
+
return get_python_type(prop_type)
|
|
210
|
+
|
|
211
|
+
def get_python_type(openapi_type: str) -> str:
|
|
212
|
+
"""Convert OpenAPI type to Python type."""
|
|
213
|
+
type_mapping = {
|
|
214
|
+
"string": "str",
|
|
215
|
+
"integer": "int",
|
|
216
|
+
"number": "float",
|
|
217
|
+
"boolean": "bool",
|
|
218
|
+
"null": "None",
|
|
219
|
+
"object": "Dict[str, Any]",
|
|
220
|
+
}
|
|
221
|
+
return type_mapping.get(openapi_type, "Any")
|
|
222
|
+
|
|
223
|
+
def process_parameter_list(params: List[Dict[str, Any]], name: str) -> str:
|
|
224
|
+
"""Process OpenAPI parameter array and create a model."""
|
|
225
|
+
class_name = clean_class_name(name)
|
|
226
|
+
if class_name in models:
|
|
227
|
+
return class_name
|
|
228
|
+
|
|
229
|
+
class_def = f"class {class_name}(BaseModel):\n"
|
|
230
|
+
|
|
231
|
+
if not params:
|
|
232
|
+
class_def += " pass\n"
|
|
233
|
+
models[class_name] = class_def
|
|
234
|
+
return class_name
|
|
235
|
+
|
|
236
|
+
# Group parameters by 'in' value to potentially create separate models
|
|
237
|
+
param_groups = {}
|
|
238
|
+
for param in params:
|
|
239
|
+
param_in = param.get("in", "query") # Default to query if not specified
|
|
240
|
+
if param_in not in param_groups:
|
|
241
|
+
param_groups[param_in] = []
|
|
242
|
+
param_groups[param_in].append(param)
|
|
243
|
+
|
|
244
|
+
# If only one type or specifically requested, create a single model
|
|
245
|
+
if len(param_groups) == 1 or name != "RequestModel":
|
|
246
|
+
for param in params:
|
|
247
|
+
param_name = param.get("name", "")
|
|
248
|
+
if not param_name:
|
|
249
|
+
continue
|
|
250
|
+
|
|
251
|
+
# Get the parameter type
|
|
252
|
+
if "schema" in param:
|
|
253
|
+
# OpenAPI 3.0 style
|
|
254
|
+
field_type = get_type_hint(param["schema"], f"{name}_{param_name}")
|
|
255
|
+
else:
|
|
256
|
+
# OpenAPI 2.0 style
|
|
257
|
+
field_type = get_python_type(param.get("type", "string"))
|
|
258
|
+
|
|
259
|
+
# Check if required
|
|
260
|
+
is_required = param.get("required", False)
|
|
261
|
+
|
|
262
|
+
# Build the field definition
|
|
263
|
+
if is_required:
|
|
264
|
+
if "description" in param:
|
|
265
|
+
field_def = f' = Field(description="{param["description"]}")'
|
|
266
|
+
else:
|
|
267
|
+
field_def = ""
|
|
268
|
+
else:
|
|
269
|
+
field_type = f"Optional[{field_type}]"
|
|
270
|
+
if "description" in param:
|
|
271
|
+
field_def = f' = Field(None, description="{param["description"]}")'
|
|
272
|
+
else:
|
|
273
|
+
field_def = " = None"
|
|
274
|
+
|
|
275
|
+
class_def += f" {param_name}: {field_type}{field_def}\n"
|
|
276
|
+
else:
|
|
277
|
+
# Create separate models for each parameter type
|
|
278
|
+
for param_in, param_list in param_groups.items():
|
|
279
|
+
in_type_name = f"{name}_{param_in.capitalize()}Params"
|
|
280
|
+
in_class_name = process_parameter_list(param_list, in_type_name)
|
|
281
|
+
class_def += f" {param_in}_params: {in_class_name}\n"
|
|
282
|
+
|
|
283
|
+
models[class_name] = class_def
|
|
284
|
+
return class_name
|
|
285
|
+
|
|
286
|
+
def process_parameter_dict(params: Dict[str, Dict[str, Any]], name: str) -> str:
|
|
287
|
+
"""Process a dictionary of named parameters."""
|
|
288
|
+
class_name = clean_class_name(name)
|
|
289
|
+
if class_name in models:
|
|
290
|
+
return class_name
|
|
291
|
+
|
|
292
|
+
class_def = f"class {class_name}(BaseModel):\n"
|
|
293
|
+
|
|
294
|
+
if not params:
|
|
295
|
+
class_def += " pass\n"
|
|
296
|
+
models[class_name] = class_def
|
|
297
|
+
return class_name
|
|
298
|
+
|
|
299
|
+
for param_name, param_def in params.items():
|
|
300
|
+
# Get the parameter type
|
|
301
|
+
if "schema" in param_def:
|
|
302
|
+
# OpenAPI 3.0 style
|
|
303
|
+
field_type = get_type_hint(param_def["schema"], f"{name}_{param_name}")
|
|
304
|
+
else:
|
|
305
|
+
# OpenAPI 2.0 style or simplified parameter
|
|
306
|
+
field_type = get_python_type(param_def.get("type", "string"))
|
|
307
|
+
|
|
308
|
+
# Check if required
|
|
309
|
+
is_required = param_def.get("required", False)
|
|
310
|
+
|
|
311
|
+
# Build the field definition
|
|
312
|
+
if is_required:
|
|
313
|
+
if "description" in param_def:
|
|
314
|
+
field_def = f' = Field(description="{param_def["description"]}")'
|
|
315
|
+
else:
|
|
316
|
+
field_def = ""
|
|
317
|
+
else:
|
|
318
|
+
field_type = f"Optional[{field_type}]"
|
|
319
|
+
if "description" in param_def:
|
|
320
|
+
field_def = f' = Field(None, description="{param_def["description"]}")'
|
|
321
|
+
else:
|
|
322
|
+
field_def = " = None"
|
|
323
|
+
|
|
324
|
+
class_def += f" {param_name}: {field_type}{field_def}\n"
|
|
325
|
+
|
|
326
|
+
models[class_name] = class_def
|
|
327
|
+
return class_name
|
|
328
|
+
|
|
329
|
+
# Determine the type of input and process accordingly
|
|
330
|
+
if isinstance(schema_input, list):
|
|
331
|
+
# This is likely a parameter array
|
|
332
|
+
process_parameter_list(schema_input, root_model_name)
|
|
333
|
+
elif isinstance(schema_input, dict):
|
|
334
|
+
if "schema" in schema_input:
|
|
335
|
+
# This is likely a request body schema
|
|
336
|
+
process_schema(schema_input, root_model_name)
|
|
337
|
+
elif "parameters" in schema_input:
|
|
338
|
+
# This is an operation object with parameters
|
|
339
|
+
process_parameter_list(schema_input["parameters"], root_model_name)
|
|
340
|
+
elif all(isinstance(value, dict) and ("name" in value and "in" in value) for value in schema_input.values()):
|
|
341
|
+
# This appears to be a parameter dict with name/in properties
|
|
342
|
+
process_parameter_list(list(schema_input.values()), root_model_name)
|
|
343
|
+
elif all(isinstance(value, dict) for value in schema_input.values()):
|
|
344
|
+
# This appears to be a dictionary of named parameters
|
|
345
|
+
process_parameter_dict(schema_input, root_model_name)
|
|
346
|
+
else:
|
|
347
|
+
# Try to process as a schema object
|
|
348
|
+
process_schema({"type": "object", "properties": schema_input}, root_model_name)
|
|
349
|
+
|
|
350
|
+
# Add all models to the code
|
|
351
|
+
for model_code in models.values():
|
|
352
|
+
code += model_code + "\n\n"
|
|
353
|
+
|
|
354
|
+
code = code.rstrip() + "\n"
|
|
355
|
+
return textwrap.indent(code, " "), clean_class_name(root_model_name)
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
def prune_tool_name(tool_name: str, length=50) -> str:
|
|
359
|
+
"""Prune tool name to avoid maxiumum of 64 characters. If it exceeds, truncate and append a random suffix."""
|
|
360
|
+
if len(tool_name) > length:
|
|
361
|
+
tool_name = tool_name[:length]
|
|
362
|
+
tool_name += f"_{secrets.token_hex(3)}"
|
|
363
|
+
return tool_name
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
def get_template_fixtures(field: str = "orchestrationBasePrompts", group: str = "REACT_MULTI_ACTION") -> dict:
|
|
367
|
+
"""Extract all templateFixtures from a specified field in template_fixtures_merged.json.
|
|
368
|
+
|
|
369
|
+
For orchestrationBasePrompts, uses the specified group (defaults to REACT_MULTI_ACTION).
|
|
370
|
+
|
|
371
|
+
Args:
|
|
372
|
+
field: The field to extract templateFixtures from (defaults to "orchestrationBasePrompts")
|
|
373
|
+
group: For orchestrationBasePrompts, which group to use (defaults to "REACT_MULTI_ACTION")
|
|
374
|
+
|
|
375
|
+
Returns:
|
|
376
|
+
Dict mapping fixture names to their template strings
|
|
377
|
+
"""
|
|
378
|
+
project_root = os.path.dirname(os.path.abspath(__file__))
|
|
379
|
+
file_path = os.path.join(project_root, "assets", "template_fixtures_merged.json")
|
|
380
|
+
with open(file_path, "r", encoding="utf-8") as f:
|
|
381
|
+
data = json.load(f)
|
|
382
|
+
|
|
383
|
+
if field not in data:
|
|
384
|
+
raise ValueError(f"Field '{field}' not found in template_fixtures_merged.json")
|
|
385
|
+
|
|
386
|
+
field_data = data[field]
|
|
387
|
+
|
|
388
|
+
# For orchestrationBasePrompts, get the specified group's templateFixtures
|
|
389
|
+
if field == "orchestrationBasePrompts":
|
|
390
|
+
if group not in field_data:
|
|
391
|
+
raise ValueError(f"Group '{group}' not found in orchestrationBasePrompts")
|
|
392
|
+
fixtures = field_data[group].get("templateFixtures", {})
|
|
393
|
+
else:
|
|
394
|
+
# For other fields, get templateFixtures directly
|
|
395
|
+
fixtures = field_data.get("templateFixtures", {})
|
|
396
|
+
|
|
397
|
+
result = {}
|
|
398
|
+
for name, fixture in fixtures.items():
|
|
399
|
+
if isinstance(fixture, dict) and "template" in fixture:
|
|
400
|
+
result[name] = fixture["template"]
|
|
401
|
+
|
|
402
|
+
return result
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
def safe_substitute_placeholders(template_str, substitutions):
|
|
406
|
+
"""Safely substitute placeholders in a string, leaving non-matching placeholders unchanged."""
|
|
407
|
+
result = template_str
|
|
408
|
+
for key, value in substitutions.items():
|
|
409
|
+
# Only replace if the key exists in the substitutions dict
|
|
410
|
+
if key in template_str:
|
|
411
|
+
result = result.replace(key, value)
|
|
412
|
+
return result
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
def get_base_dir(file):
|
|
416
|
+
"""Get the base directory of the project."""
|
|
417
|
+
return os.path.dirname(os.path.dirname(os.path.abspath(file)))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bedrock-agentcore-starter-toolkit
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: A starter toolkit for using Bedrock AgentCore
|
|
5
5
|
Project-URL: Homepage, https://github.com/aws/bedrock-agentcore-starter-toolkit
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/aws/bedrock-agentcore-starter-toolkit/issues
|
|
@@ -21,17 +21,23 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
21
21
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
23
|
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: autopep8>=2.3.2
|
|
24
25
|
Requires-Dist: bedrock-agentcore>=0.1.1
|
|
25
26
|
Requires-Dist: boto3>=1.39.7
|
|
26
27
|
Requires-Dist: botocore>=1.39.7
|
|
27
28
|
Requires-Dist: docstring-parser<1.0,>=0.15
|
|
28
29
|
Requires-Dist: httpx>=0.28.1
|
|
29
30
|
Requires-Dist: jinja2>=3.1.6
|
|
31
|
+
Requires-Dist: openapi-spec-validator>=0.7.2
|
|
32
|
+
Requires-Dist: prance>=25.4.8.0
|
|
30
33
|
Requires-Dist: prompt-toolkit>=3.0.51
|
|
34
|
+
Requires-Dist: py-openapi-schema-to-json-schema>=0.0.3
|
|
31
35
|
Requires-Dist: pydantic<3.0.0,>=2.0.0
|
|
32
36
|
Requires-Dist: pyyaml>=6.0.2
|
|
37
|
+
Requires-Dist: questionary>=2.1.0
|
|
33
38
|
Requires-Dist: requests>=2.25.0
|
|
34
|
-
Requires-Dist: rich
|
|
39
|
+
Requires-Dist: rich>=13.0.0
|
|
40
|
+
Requires-Dist: ruamel-yaml>=0.18.14
|
|
35
41
|
Requires-Dist: toml>=0.10.2
|
|
36
42
|
Requires-Dist: typer>=0.16.0
|
|
37
43
|
Requires-Dist: typing-extensions<5.0.0,>=4.13.2
|
|
@@ -121,6 +127,20 @@ agentcore invoke '{"prompt": "Hello from Bedrock AgentCore!"}'
|
|
|
121
127
|
- 🌐 **Browser** - Fast, secure cloud-based browser for web automation
|
|
122
128
|
- 📊 **Observability** - Real-time monitoring and tracing with OpenTelemetry support
|
|
123
129
|
|
|
130
|
+
## ➡️ Importing from Bedrock Agents
|
|
131
|
+
|
|
132
|
+
Import from Bedrock Agents to AgentCore using the `import-agent` utility.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Launch the import-agent workflow
|
|
136
|
+
agentcore import-agent
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
This will generate an equivalent Langchain or Strands agent in `./output`, leveraging AgentCore primitives, and provide an option to deploy the agent to AgentCore Runtime. See additional documentation on this utility:
|
|
140
|
+
- [Quickstart Guide](https://github.com/aws/bedrock-agentcore-starter-toolkit/blob/main/documentation/docs/user-guide/import-agent/quickstart.md)
|
|
141
|
+
- [Utility Overview](https://github.com/aws/bedrock-agentcore-starter-toolkit/blob/main/documentation/docs/user-guide/import-agent/overview.md)
|
|
142
|
+
|
|
143
|
+
|
|
124
144
|
## 📚 About Amazon Bedrock AgentCore
|
|
125
145
|
|
|
126
146
|
Amazon Bedrock AgentCore enables you to deploy and operate highly effective agents securely, at scale using any framework and model. With AgentCore, developers can accelerate AI agents into production with enterprise-grade scale, reliability, and security. The platform provides:
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
bedrock_agentcore_starter_toolkit/__init__.py,sha256=tN3-JWKvxk4ZSJQJIHQ4mMsDtt8J_cDCz-drcGU9USA,120
|
|
2
|
-
bedrock_agentcore_starter_toolkit/cli/
|
|
2
|
+
bedrock_agentcore_starter_toolkit/cli/__init__.py,sha256=WuIWfHtJKD9gQA-mE49bq8OHGb0Ugt8upRGaOp6-H90,62
|
|
3
|
+
bedrock_agentcore_starter_toolkit/cli/cli.py,sha256=h7lb9htskppokMShmrfzna_8qic49q0nYG6BCWY13fQ,965
|
|
3
4
|
bedrock_agentcore_starter_toolkit/cli/common.py,sha256=R9ZRKmW9gq7u7gkTiCUOTCQTno2lXnsplnq2x0-k2v8,1311
|
|
4
5
|
bedrock_agentcore_starter_toolkit/cli/gateway/__init__.py,sha256=8IZ0kSe6Kz5s2j-SBsoc6qy04MbK85RMTQwZCiR2wmo,68
|
|
5
6
|
bedrock_agentcore_starter_toolkit/cli/gateway/commands.py,sha256=3DuXCvqXlmHU2cmjGzDruyc2Fkrpgoi158myj0vc3nA,3265
|
|
7
|
+
bedrock_agentcore_starter_toolkit/cli/import_agent/README.md,sha256=e7WJz4dagYU2HrGmgSr6Skk7gl_Um8pGKlGKCSAF9rk,2291
|
|
8
|
+
bedrock_agentcore_starter_toolkit/cli/import_agent/__init__.py,sha256=tyM3dXM3Tce3me6roMG4N3nsrfpj3jgCJne5fbobvmI,54
|
|
9
|
+
bedrock_agentcore_starter_toolkit/cli/import_agent/agent_info.py,sha256=V0fZEbV76_H3gmkA17yscyJ8UdcMAquzNqENQ9DXdHA,9477
|
|
10
|
+
bedrock_agentcore_starter_toolkit/cli/import_agent/commands.py,sha256=vpA66fGwKf6cxBelT3Yb_Af5Ow3AMquGLIDe-tBLjmc,22419
|
|
6
11
|
bedrock_agentcore_starter_toolkit/cli/runtime/__init__.py,sha256=0zKPPoYThoDIr3DZhIQJavq5nVTKRsgcE1s9--wx118,60
|
|
7
12
|
bedrock_agentcore_starter_toolkit/cli/runtime/commands.py,sha256=4Mk4ZjlgzYA55Zt--wCDxC84pgso7hpDhdLIUn1f3CI,33141
|
|
8
13
|
bedrock_agentcore_starter_toolkit/cli/runtime/configuration_manager.py,sha256=5TJK80uzA1ARh263smLfthw1t5Ona3bAtdO1pE7OfNo,5808
|
|
@@ -12,7 +17,7 @@ bedrock_agentcore_starter_toolkit/notebook/runtime/bedrock_agentcore.py,sha256=U
|
|
|
12
17
|
bedrock_agentcore_starter_toolkit/operations/__init__.py,sha256=L7sCNjfZviiVVoh2f3NEs2sbjNqFkmIRI3ZPYMMWMz0,51
|
|
13
18
|
bedrock_agentcore_starter_toolkit/operations/gateway/README.md,sha256=aJla3qAaZmM0b4t9q4lQYqfamAugU0FyyzsufFMRi_A,8192
|
|
14
19
|
bedrock_agentcore_starter_toolkit/operations/gateway/__init__.py,sha256=5Qo1GeN-DghNp9g0coFUs7WpUJDboJoidOVs-5Co7fo,233
|
|
15
|
-
bedrock_agentcore_starter_toolkit/operations/gateway/client.py,sha256=
|
|
20
|
+
bedrock_agentcore_starter_toolkit/operations/gateway/client.py,sha256=dLSuM2jwEMMkCfkpHNQ-BEZdM64TN5UorvPjFBULI1k,20029
|
|
16
21
|
bedrock_agentcore_starter_toolkit/operations/gateway/constants.py,sha256=0_4J6BN4VAE4-XTQhPTEACkhilRrFqu_iKiuHSm2pYk,4610
|
|
17
22
|
bedrock_agentcore_starter_toolkit/operations/gateway/create_lambda.py,sha256=MQsBJfUj26zBh7LqYWLoekHuvbAHIJE8qcXwrmJOhM0,2875
|
|
18
23
|
bedrock_agentcore_starter_toolkit/operations/gateway/create_role.py,sha256=a38JE28PbdRabskTgLXsiqHqWS1vt06jxEEGneYPO_g,3145
|
|
@@ -24,9 +29,20 @@ bedrock_agentcore_starter_toolkit/operations/runtime/invoke.py,sha256=ZcPXI7Zx7N
|
|
|
24
29
|
bedrock_agentcore_starter_toolkit/operations/runtime/launch.py,sha256=vG6SFKVWtKNtxIkpDA9tHlvHDs1LYA4_t-M_RUXXfyo,19206
|
|
25
30
|
bedrock_agentcore_starter_toolkit/operations/runtime/models.py,sha256=Qr45hc73a25cqmiSErq9-degckPXuVhnENyDSshU_mU,3673
|
|
26
31
|
bedrock_agentcore_starter_toolkit/operations/runtime/status.py,sha256=tpOtzAq1S3z_7baxR_WOT8Avo3MtWKGpelVOOfb-uMA,2516
|
|
32
|
+
bedrock_agentcore_starter_toolkit/services/__init__.py,sha256=s7QtYYFCCX2ff0gZHUdDxCDI3zhUq0fPsjevZbF9xdA,66
|
|
27
33
|
bedrock_agentcore_starter_toolkit/services/codebuild.py,sha256=i5VbjqAWrPsPwLUdGSWI-_beqFHPqN3FnVLKM4s3rSo,13445
|
|
28
34
|
bedrock_agentcore_starter_toolkit/services/ecr.py,sha256=nW9wIZcXI6amZeLVSmM9F6awVBQP1-zrFXTozSNEDjo,2805
|
|
29
35
|
bedrock_agentcore_starter_toolkit/services/runtime.py,sha256=TPN2eElh-X-svPpVHn_dHF0Fzl1kAqUIgVSlG_vHaPc,18353
|
|
36
|
+
bedrock_agentcore_starter_toolkit/services/import_agent/__init__.py,sha256=ig-xanZqA3oJdRTucYz9xF9_2yi31ADRVIKFsnIw_l4,68
|
|
37
|
+
bedrock_agentcore_starter_toolkit/services/import_agent/utils.py,sha256=ErY-J0hClJbt5D-pQ99ma-1Fll35tHjqOttM-h0bKKw,15675
|
|
38
|
+
bedrock_agentcore_starter_toolkit/services/import_agent/assets/memory_manager_template.py,sha256=RKrtTxir5XxyMg6cim4CAEbguaxb4mg1Qb31pd7D_kY,7892
|
|
39
|
+
bedrock_agentcore_starter_toolkit/services/import_agent/assets/requirements_langchain.j2,sha256=gZcpxIW0D4qSU6hNPSRZ75zBB6ES7IZj1G-mrfEJG1s,181
|
|
40
|
+
bedrock_agentcore_starter_toolkit/services/import_agent/assets/requirements_strands.j2,sha256=ZAWzCFwdj8Mbq8aBGO3Jnxz0G8XJZPNpIsPf_2Jetfk,100
|
|
41
|
+
bedrock_agentcore_starter_toolkit/services/import_agent/assets/template_fixtures_merged.json,sha256=Xem7jS8n96QEyHBmnPAvWHM4AyTLyma7Nq9sCVHuXJA,175239
|
|
42
|
+
bedrock_agentcore_starter_toolkit/services/import_agent/scripts/__init__.py,sha256=UmhcnsfIo2P1Z9VAJ6Ua2mSkxs4BOeTxgFMcgQXQWCQ,79
|
|
43
|
+
bedrock_agentcore_starter_toolkit/services/import_agent/scripts/base_bedrock_translate.py,sha256=xAqf0Rrhb4QWE_6WBk98NkQdHbCyy2uFzKbiw_9cWA4,72520
|
|
44
|
+
bedrock_agentcore_starter_toolkit/services/import_agent/scripts/bedrock_to_langchain.py,sha256=xwoZcmZ27CfYohwSfLIgbFxa2ubiBFhvufgQEWZkmLk,14950
|
|
45
|
+
bedrock_agentcore_starter_toolkit/services/import_agent/scripts/bedrock_to_strands.py,sha256=eC3v2Ts7B_RUGl4bkUim2uFYYuZZYP9syYBlylJ2gXs,14642
|
|
30
46
|
bedrock_agentcore_starter_toolkit/utils/endpoints.py,sha256=1gIDRd1oO1fymYpiedVit7m6zl5k6N8Ns9N-2ix7ZaE,1153
|
|
31
47
|
bedrock_agentcore_starter_toolkit/utils/logging_config.py,sha256=NtZDyndNKCAbz7jZ0leb13bb3UmjjRUTSVwI8MMlOfw,2191
|
|
32
48
|
bedrock_agentcore_starter_toolkit/utils/runtime/config.py,sha256=qRQid59rD3zJ0d0hcBY4-8R52PNIWEIUt9iR3biuz_c,4495
|
|
@@ -37,11 +53,11 @@ bedrock_agentcore_starter_toolkit/utils/runtime/policy_template.py,sha256=CgER7Y
|
|
|
37
53
|
bedrock_agentcore_starter_toolkit/utils/runtime/schema.py,sha256=gZ0zPvry-ZkXwqUEAy6Izz1RJvmZaXA6a2twnSdk1AY,6418
|
|
38
54
|
bedrock_agentcore_starter_toolkit/utils/runtime/templates/Dockerfile.j2,sha256=ti33aLVoqSfdbBUohxSK-ad1Qb_h7AoO_bkFcgik4UA,1166
|
|
39
55
|
bedrock_agentcore_starter_toolkit/utils/runtime/templates/dockerignore.template,sha256=b_70sBi0MwkTuA9TqxPqFcWK7TcmpaXBJ6M2Ipox65Q,691
|
|
40
|
-
bedrock_agentcore_starter_toolkit/utils/runtime/templates/execution_role_policy.json.j2,sha256=
|
|
56
|
+
bedrock_agentcore_starter_toolkit/utils/runtime/templates/execution_role_policy.json.j2,sha256=kBNIDrILAx4ZGUxB_ExZAYxTKENfwNFVc7eifiD8z9U,2511
|
|
41
57
|
bedrock_agentcore_starter_toolkit/utils/runtime/templates/execution_role_trust_policy.json.j2,sha256=PPJF6Ofq70W5DUE0NlbmnZjw5RkgepPgkskxEgEG28o,473
|
|
42
|
-
bedrock_agentcore_starter_toolkit-0.1.
|
|
43
|
-
bedrock_agentcore_starter_toolkit-0.1.
|
|
44
|
-
bedrock_agentcore_starter_toolkit-0.1.
|
|
45
|
-
bedrock_agentcore_starter_toolkit-0.1.
|
|
46
|
-
bedrock_agentcore_starter_toolkit-0.1.
|
|
47
|
-
bedrock_agentcore_starter_toolkit-0.1.
|
|
58
|
+
bedrock_agentcore_starter_toolkit-0.1.4.dist-info/METADATA,sha256=4QvHTT1QQzcZwwXiq8jj9d_uWFhRTCfrbYSyV_f0gQM,7120
|
|
59
|
+
bedrock_agentcore_starter_toolkit-0.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
60
|
+
bedrock_agentcore_starter_toolkit-0.1.4.dist-info/entry_points.txt,sha256=Tf94DkUf2Tp8P7p8MEXLxre7A7Pp_XNukteiz0wHnk8,77
|
|
61
|
+
bedrock_agentcore_starter_toolkit-0.1.4.dist-info/licenses/LICENSE.txt,sha256=nNPOMinitYdtfbhdQgsPgz1UowBznU6QVN3Xs0pSTKU,10768
|
|
62
|
+
bedrock_agentcore_starter_toolkit-0.1.4.dist-info/licenses/NOTICE.txt,sha256=rkBsg8DbKqfIoQbveqX9foR4uJPUVAokbkr02pRPilE,8674
|
|
63
|
+
bedrock_agentcore_starter_toolkit-0.1.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|