@aws/agentcore 0.3.0-preview.8.0 → 0.4.0
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.
- package/dist/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap +8 -337
- package/dist/assets/agents/AGENTS.md +1 -2
- package/dist/assets/cdk/test/cdk.test.ts +2 -1
- package/dist/assets/python/http/langchain_langgraph/base/main.py +4 -1
- package/dist/assets/python/http/langchain_langgraph/base/pyproject.toml +1 -2
- package/dist/cli/index.mjs +352 -337
- package/dist/lib/packaging/index.js +3 -3
- package/dist/lib/packaging/index.js.map +1 -1
- package/dist/lib/packaging/python.js +1 -1
- package/dist/lib/schemas/io/config-io.d.ts +11 -3
- package/dist/lib/schemas/io/config-io.d.ts.map +1 -1
- package/dist/lib/schemas/io/config-io.js +14 -3
- package/dist/lib/schemas/io/config-io.js.map +1 -1
- package/dist/lib/schemas/io/index.d.ts +1 -1
- package/dist/lib/schemas/io/index.d.ts.map +1 -1
- package/dist/lib/schemas/io/index.js +2 -1
- package/dist/lib/schemas/io/index.js.map +1 -1
- package/dist/schema/constants.d.ts +0 -1
- package/dist/schema/constants.d.ts.map +1 -1
- package/dist/schema/constants.js +2 -5
- package/dist/schema/constants.js.map +1 -1
- package/dist/schema/schemas/agent-env.d.ts +47 -7
- package/dist/schema/schemas/agent-env.d.ts.map +1 -1
- package/dist/schema/schemas/agent-env.js +50 -4
- package/dist/schema/schemas/agent-env.js.map +1 -1
- package/dist/schema/schemas/agentcore-project.d.ts +61 -27
- package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
- package/dist/schema/schemas/agentcore-project.js +24 -14
- package/dist/schema/schemas/agentcore-project.js.map +1 -1
- package/dist/schema/schemas/auth.d.ts +140 -0
- package/dist/schema/schemas/auth.d.ts.map +1 -0
- package/dist/schema/schemas/auth.js +114 -0
- package/dist/schema/schemas/auth.js.map +1 -0
- package/dist/schema/schemas/deployed-state.d.ts +4 -4
- package/dist/schema/schemas/deployed-state.js +3 -3
- package/dist/schema/schemas/deployed-state.js.map +1 -1
- package/dist/schema/schemas/index.d.ts +1 -0
- package/dist/schema/schemas/index.d.ts.map +1 -1
- package/dist/schema/schemas/index.js +1 -0
- package/dist/schema/schemas/index.js.map +1 -1
- package/dist/schema/schemas/mcp.d.ts +4 -107
- package/dist/schema/schemas/mcp.d.ts.map +1 -1
- package/dist/schema/schemas/mcp.js +9 -108
- package/dist/schema/schemas/mcp.js.map +1 -1
- package/dist/schema/schemas/primitives/index.d.ts +1 -1
- package/dist/schema/schemas/primitives/index.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/index.js +2 -1
- package/dist/schema/schemas/primitives/index.js.map +1 -1
- package/dist/schema/schemas/primitives/memory.d.ts +9 -0
- package/dist/schema/schemas/primitives/memory.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/memory.js +26 -3
- package/dist/schema/schemas/primitives/memory.js.map +1 -1
- package/dist/schema/schemas/primitives/online-eval-config.d.ts +0 -1
- package/dist/schema/schemas/primitives/online-eval-config.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/online-eval-config.js +0 -1
- package/dist/schema/schemas/primitives/online-eval-config.js.map +1 -1
- package/package.json +4 -1
- package/scripts/generate-schema.mjs +40 -0
- package/dist/assets/python/http/crewai/base/README.md +0 -39
- package/dist/assets/python/http/crewai/base/gitignore.template +0 -41
- package/dist/assets/python/http/crewai/base/main.py +0 -55
- package/dist/assets/python/http/crewai/base/model/__init__.py +0 -1
- package/dist/assets/python/http/crewai/base/model/load.py +0 -133
- package/dist/assets/python/http/crewai/base/pyproject.toml +0 -31
|
@@ -376,7 +376,8 @@ test('AgentCoreStack synthesizes with empty spec', () => {
|
|
|
376
376
|
spec: {
|
|
377
377
|
name: 'testproject',
|
|
378
378
|
version: 1,
|
|
379
|
-
|
|
379
|
+
managedBy: 'CDK' as const,
|
|
380
|
+
runtimes: [],
|
|
380
381
|
memories: [],
|
|
381
382
|
credentials: [],
|
|
382
383
|
evaluators: [],
|
|
@@ -479,12 +480,6 @@ exports[`Assets Directory Snapshots > File listing > should match the expected f
|
|
|
479
480
|
"python/http/autogen/base/model/__init__.py",
|
|
480
481
|
"python/http/autogen/base/model/load.py",
|
|
481
482
|
"python/http/autogen/base/pyproject.toml",
|
|
482
|
-
"python/http/crewai/base/README.md",
|
|
483
|
-
"python/http/crewai/base/gitignore.template",
|
|
484
|
-
"python/http/crewai/base/main.py",
|
|
485
|
-
"python/http/crewai/base/model/__init__.py",
|
|
486
|
-
"python/http/crewai/base/model/load.py",
|
|
487
|
-
"python/http/crewai/base/pyproject.toml",
|
|
488
483
|
"python/http/googleadk/base/README.md",
|
|
489
484
|
"python/http/googleadk/base/gitignore.template",
|
|
490
485
|
"python/http/googleadk/base/main.py",
|
|
@@ -2083,330 +2078,6 @@ packages = ["."]
|
|
|
2083
2078
|
"
|
|
2084
2079
|
`;
|
|
2085
2080
|
|
|
2086
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/crewai/base/README.md should match snapshot 1`] = `
|
|
2087
|
-
"This is a project generated by the agentcore create CLI tool!
|
|
2088
|
-
|
|
2089
|
-
# Layout
|
|
2090
|
-
|
|
2091
|
-
The generated application code lives at the agent root directory. At the root, there is a \`.gitignore\` file, an
|
|
2092
|
-
\`agentcore/\` folder which represents the configurations and state associated with this project. Other \`agentcore\`
|
|
2093
|
-
commands like \`deploy\`, \`dev\`, and \`invoke\` rely on the configuration stored here.
|
|
2094
|
-
|
|
2095
|
-
## Agent Root
|
|
2096
|
-
|
|
2097
|
-
The main entrypoint to your app is defined in \`main.py\`. Using the AgentCore SDK \`@app.entrypoint\` decorator, this
|
|
2098
|
-
file defines a Starlette ASGI app with the CrewAI framework running within.
|
|
2099
|
-
|
|
2100
|
-
\`model/load.py\` instantiates your chosen model provider.
|
|
2101
|
-
|
|
2102
|
-
## Environment Variables
|
|
2103
|
-
|
|
2104
|
-
| Variable | Required | Description |
|
|
2105
|
-
| --- | --- | --- |
|
|
2106
|
-
{{#if hasIdentity}}| \`{{identityProviders.[0].envVarName}}\` | Yes | {{modelProvider}} API key (local) or Identity provider name (deployed) |
|
|
2107
|
-
{{/if}}| \`LOCAL_DEV\` | No | Set to \`1\` to use \`.env.local\` instead of AgentCore Identity |
|
|
2108
|
-
|
|
2109
|
-
# Developing locally
|
|
2110
|
-
|
|
2111
|
-
If installation was successful, a virtual environment is already created with dependencies installed.
|
|
2112
|
-
|
|
2113
|
-
Run \`source .venv/bin/activate\` before developing.
|
|
2114
|
-
|
|
2115
|
-
\`agentcore dev\` will start a local server on 0.0.0.0:8080.
|
|
2116
|
-
|
|
2117
|
-
In a new terminal, you can invoke that server with:
|
|
2118
|
-
|
|
2119
|
-
\`agentcore invoke --dev "What can you do"\`
|
|
2120
|
-
|
|
2121
|
-
# Deployment
|
|
2122
|
-
|
|
2123
|
-
After providing credentials, \`agentcore deploy\` will deploy your project into Amazon Bedrock AgentCore.
|
|
2124
|
-
|
|
2125
|
-
Use \`agentcore invoke\` to invoke your deployed agent.
|
|
2126
|
-
"
|
|
2127
|
-
`;
|
|
2128
|
-
|
|
2129
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/crewai/base/gitignore.template should match snapshot 1`] = `
|
|
2130
|
-
"# Environment variables
|
|
2131
|
-
.env
|
|
2132
|
-
|
|
2133
|
-
# Python
|
|
2134
|
-
__pycache__/
|
|
2135
|
-
*.py[cod]
|
|
2136
|
-
*$py.class
|
|
2137
|
-
*.so
|
|
2138
|
-
.Python
|
|
2139
|
-
build/
|
|
2140
|
-
develop-eggs/
|
|
2141
|
-
dist/
|
|
2142
|
-
downloads/
|
|
2143
|
-
eggs/
|
|
2144
|
-
.eggs/
|
|
2145
|
-
lib/
|
|
2146
|
-
lib64/
|
|
2147
|
-
parts/
|
|
2148
|
-
sdist/
|
|
2149
|
-
var/
|
|
2150
|
-
wheels/
|
|
2151
|
-
*.egg-info/
|
|
2152
|
-
.installed.cfg
|
|
2153
|
-
*.egg
|
|
2154
|
-
|
|
2155
|
-
# Virtual environments
|
|
2156
|
-
.venv/
|
|
2157
|
-
venv/
|
|
2158
|
-
ENV/
|
|
2159
|
-
env/
|
|
2160
|
-
|
|
2161
|
-
# IDE
|
|
2162
|
-
.vscode/
|
|
2163
|
-
.idea/
|
|
2164
|
-
*.swp
|
|
2165
|
-
*.swo
|
|
2166
|
-
*~
|
|
2167
|
-
|
|
2168
|
-
# OS
|
|
2169
|
-
.DS_Store
|
|
2170
|
-
Thumbs.db
|
|
2171
|
-
"
|
|
2172
|
-
`;
|
|
2173
|
-
|
|
2174
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/crewai/base/main.py should match snapshot 1`] = `
|
|
2175
|
-
"from crewai import Agent, Crew, Task, Process
|
|
2176
|
-
from crewai.tools import tool
|
|
2177
|
-
from bedrock_agentcore.runtime import BedrockAgentCoreApp
|
|
2178
|
-
from model.load import load_model
|
|
2179
|
-
|
|
2180
|
-
app = BedrockAgentCoreApp()
|
|
2181
|
-
log = app.logger
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
# Define a simple function tool
|
|
2185
|
-
@tool
|
|
2186
|
-
def add_numbers(a: int, b: int) -> int:
|
|
2187
|
-
"""Return the sum of two numbers"""
|
|
2188
|
-
return a + b
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
# Define a collection of tools used by the model
|
|
2192
|
-
tools = [add_numbers]
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
@app.entrypoint
|
|
2196
|
-
def invoke(payload, context):
|
|
2197
|
-
log.info("Invoking Agent.....")
|
|
2198
|
-
|
|
2199
|
-
# Define the Agent with Tools
|
|
2200
|
-
agent = Agent(
|
|
2201
|
-
role="Question Answering Assistant",
|
|
2202
|
-
goal="Answer the users questions",
|
|
2203
|
-
backstory="Always eager to answer any questions",
|
|
2204
|
-
llm=load_model(),
|
|
2205
|
-
tools=tools,
|
|
2206
|
-
)
|
|
2207
|
-
|
|
2208
|
-
# Define the Task
|
|
2209
|
-
task = Task(
|
|
2210
|
-
agent=agent,
|
|
2211
|
-
description="Answer the users question: {prompt}",
|
|
2212
|
-
expected_output="An answer to the users question",
|
|
2213
|
-
)
|
|
2214
|
-
|
|
2215
|
-
# Create the Crew
|
|
2216
|
-
crew = Crew(agents=[agent], tasks=[task], process=Process.sequential)
|
|
2217
|
-
|
|
2218
|
-
# Process the user prompt
|
|
2219
|
-
prompt = payload.get("prompt", "What can you help me with?")
|
|
2220
|
-
|
|
2221
|
-
# Run the crew
|
|
2222
|
-
result = crew.kickoff(inputs={"prompt": prompt})
|
|
2223
|
-
|
|
2224
|
-
# Return result
|
|
2225
|
-
return {"result": result.raw}
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
if __name__ == "__main__":
|
|
2229
|
-
app.run()
|
|
2230
|
-
"
|
|
2231
|
-
`;
|
|
2232
|
-
|
|
2233
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/crewai/base/model/__init__.py should match snapshot 1`] = `
|
|
2234
|
-
"# Package marker
|
|
2235
|
-
"
|
|
2236
|
-
`;
|
|
2237
|
-
|
|
2238
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/crewai/base/model/load.py should match snapshot 1`] = `
|
|
2239
|
-
"{{#if (eq modelProvider "Bedrock")}}
|
|
2240
|
-
from crewai import LLM
|
|
2241
|
-
|
|
2242
|
-
# Uses global inference profile for Claude Sonnet 4.5
|
|
2243
|
-
# https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html
|
|
2244
|
-
MODEL_ID = "bedrock/global.anthropic.claude-sonnet-4-5-20250929-v1:0"
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
def load_model() -> LLM:
|
|
2248
|
-
"""Get Bedrock model client using IAM credentials."""
|
|
2249
|
-
return LLM(model=MODEL_ID)
|
|
2250
|
-
{{/if}}
|
|
2251
|
-
{{#if (eq modelProvider "Anthropic")}}
|
|
2252
|
-
import os
|
|
2253
|
-
from crewai import LLM
|
|
2254
|
-
from bedrock_agentcore.identity.auth import requires_api_key
|
|
2255
|
-
|
|
2256
|
-
IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
|
|
2257
|
-
IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
@requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
|
|
2261
|
-
def _agentcore_identity_api_key_provider(api_key: str) -> str:
|
|
2262
|
-
"""Fetch API key from AgentCore Identity."""
|
|
2263
|
-
return api_key
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
def _get_api_key() -> str:
|
|
2267
|
-
"""
|
|
2268
|
-
Uses AgentCore Identity for API key management in deployed environments.
|
|
2269
|
-
For local development, run via 'agentcore dev' which loads agentcore/.env.
|
|
2270
|
-
"""
|
|
2271
|
-
if os.getenv("LOCAL_DEV") == "1":
|
|
2272
|
-
api_key = os.getenv(IDENTITY_ENV_VAR)
|
|
2273
|
-
if not api_key:
|
|
2274
|
-
raise RuntimeError(
|
|
2275
|
-
f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
|
|
2276
|
-
)
|
|
2277
|
-
return api_key
|
|
2278
|
-
return _agentcore_identity_api_key_provider()
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
def load_model() -> LLM:
|
|
2282
|
-
"""Get authenticated Anthropic model client."""
|
|
2283
|
-
api_key = _get_api_key()
|
|
2284
|
-
# CrewAI requires ANTHROPIC_API_KEY env var (ignores api_key parameter)
|
|
2285
|
-
os.environ["ANTHROPIC_API_KEY"] = api_key
|
|
2286
|
-
return LLM(
|
|
2287
|
-
model="anthropic/claude-sonnet-4-5-20250929",
|
|
2288
|
-
api_key=api_key,
|
|
2289
|
-
max_tokens=4096
|
|
2290
|
-
)
|
|
2291
|
-
{{/if}}
|
|
2292
|
-
{{#if (eq modelProvider "OpenAI")}}
|
|
2293
|
-
import os
|
|
2294
|
-
from crewai import LLM
|
|
2295
|
-
from bedrock_agentcore.identity.auth import requires_api_key
|
|
2296
|
-
|
|
2297
|
-
IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
|
|
2298
|
-
IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
@requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
|
|
2302
|
-
def _agentcore_identity_api_key_provider(api_key: str) -> str:
|
|
2303
|
-
"""Fetch API key from AgentCore Identity."""
|
|
2304
|
-
return api_key
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
def _get_api_key() -> str:
|
|
2308
|
-
"""
|
|
2309
|
-
Uses AgentCore Identity for API key management in deployed environments.
|
|
2310
|
-
For local development, run via 'agentcore dev' which loads agentcore/.env.
|
|
2311
|
-
"""
|
|
2312
|
-
if os.getenv("LOCAL_DEV") == "1":
|
|
2313
|
-
api_key = os.getenv(IDENTITY_ENV_VAR)
|
|
2314
|
-
if not api_key:
|
|
2315
|
-
raise RuntimeError(
|
|
2316
|
-
f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
|
|
2317
|
-
)
|
|
2318
|
-
return api_key
|
|
2319
|
-
return _agentcore_identity_api_key_provider()
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
def load_model() -> LLM:
|
|
2323
|
-
"""Get authenticated OpenAI model client."""
|
|
2324
|
-
api_key = _get_api_key()
|
|
2325
|
-
# CrewAI requires OPENAI_API_KEY env var (ignores api_key parameter)
|
|
2326
|
-
os.environ["OPENAI_API_KEY"] = api_key
|
|
2327
|
-
return LLM(
|
|
2328
|
-
model="openai/gpt-4.1",
|
|
2329
|
-
api_key=api_key
|
|
2330
|
-
)
|
|
2331
|
-
{{/if}}
|
|
2332
|
-
{{#if (eq modelProvider "Gemini")}}
|
|
2333
|
-
import os
|
|
2334
|
-
from crewai import LLM
|
|
2335
|
-
from bedrock_agentcore.identity.auth import requires_api_key
|
|
2336
|
-
|
|
2337
|
-
IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
|
|
2338
|
-
IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
@requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
|
|
2342
|
-
def _agentcore_identity_api_key_provider(api_key: str) -> str:
|
|
2343
|
-
"""Fetch API key from AgentCore Identity."""
|
|
2344
|
-
return api_key
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
def _get_api_key() -> str:
|
|
2348
|
-
"""
|
|
2349
|
-
Uses AgentCore Identity for API key management in deployed environments.
|
|
2350
|
-
For local development, run via 'agentcore dev' which loads agentcore/.env.
|
|
2351
|
-
"""
|
|
2352
|
-
if os.getenv("LOCAL_DEV") == "1":
|
|
2353
|
-
api_key = os.getenv(IDENTITY_ENV_VAR)
|
|
2354
|
-
if not api_key:
|
|
2355
|
-
raise RuntimeError(
|
|
2356
|
-
f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
|
|
2357
|
-
)
|
|
2358
|
-
return api_key
|
|
2359
|
-
return _agentcore_identity_api_key_provider()
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
def load_model() -> LLM:
|
|
2363
|
-
"""Get authenticated Gemini model client."""
|
|
2364
|
-
api_key = _get_api_key()
|
|
2365
|
-
# CrewAI requires GEMINI_API_KEY env var (ignores api_key parameter)
|
|
2366
|
-
os.environ["GEMINI_API_KEY"] = api_key
|
|
2367
|
-
return LLM(
|
|
2368
|
-
model="gemini/gemini-2.5-flash",
|
|
2369
|
-
api_key=api_key
|
|
2370
|
-
)
|
|
2371
|
-
{{/if}}
|
|
2372
|
-
"
|
|
2373
|
-
`;
|
|
2374
|
-
|
|
2375
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/crewai/base/pyproject.toml should match snapshot 1`] = `
|
|
2376
|
-
"[build-system]
|
|
2377
|
-
requires = ["hatchling"]
|
|
2378
|
-
build-backend = "hatchling.build"
|
|
2379
|
-
|
|
2380
|
-
[project]
|
|
2381
|
-
name = "{{ name }}"
|
|
2382
|
-
version = "0.1.0"
|
|
2383
|
-
description = "AgentCore Runtime Application using CrewAI SDK"
|
|
2384
|
-
readme = "README.md"
|
|
2385
|
-
requires-python = ">=3.11"
|
|
2386
|
-
dependencies = [
|
|
2387
|
-
"opentelemetry-distro",
|
|
2388
|
-
"opentelemetry-exporter-otlp",
|
|
2389
|
-
"bedrock-agentcore >= 1.0.3",
|
|
2390
|
-
"botocore[crt] >= 1.35.0",
|
|
2391
|
-
{{#if (eq modelProvider "Bedrock")}}
|
|
2392
|
-
"crewai[tools,bedrock] >= 1.3.0",
|
|
2393
|
-
{{/if}}
|
|
2394
|
-
{{#if (eq modelProvider "Anthropic")}}
|
|
2395
|
-
"crewai[tools,anthropic] >= 1.3.0",
|
|
2396
|
-
{{/if}}
|
|
2397
|
-
{{#if (eq modelProvider "OpenAI")}}
|
|
2398
|
-
"crewai[tools,openai] >= 1.3.0",
|
|
2399
|
-
{{/if}}
|
|
2400
|
-
{{#if (eq modelProvider "Gemini")}}
|
|
2401
|
-
"crewai[tools,google-genai] >= 1.3.0",
|
|
2402
|
-
{{/if}}
|
|
2403
|
-
]
|
|
2404
|
-
|
|
2405
|
-
[tool.hatch.build.targets.wheel]
|
|
2406
|
-
packages = ["."]
|
|
2407
|
-
"
|
|
2408
|
-
`;
|
|
2409
|
-
|
|
2410
2081
|
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/googleadk/base/README.md should match snapshot 1`] = `
|
|
2411
2082
|
"This is a project generated by the agentcore create CLI tool!
|
|
2412
2083
|
|
|
@@ -2904,12 +2575,15 @@ async def invoke(payload, context):
|
|
|
2904
2575
|
|
|
2905
2576
|
# Process the user prompt
|
|
2906
2577
|
prompt = payload.get("prompt", "What can you help me with?")
|
|
2578
|
+
log.info(f"Agent input: {prompt}")
|
|
2907
2579
|
|
|
2908
2580
|
# Run the agent
|
|
2909
2581
|
result = await graph.ainvoke({"messages": [HumanMessage(content=prompt)]})
|
|
2910
2582
|
|
|
2911
2583
|
# Return result
|
|
2912
|
-
|
|
2584
|
+
output = result["messages"][-1].content
|
|
2585
|
+
log.info(f"Agent output: {output}")
|
|
2586
|
+
return {"result": output}
|
|
2913
2587
|
|
|
2914
2588
|
|
|
2915
2589
|
if __name__ == "__main__":
|
|
@@ -3147,8 +2821,7 @@ description = "AgentCore Runtime Application using LangChain/LangGraph"
|
|
|
3147
2821
|
readme = "README.md"
|
|
3148
2822
|
requires-python = ">=3.10"
|
|
3149
2823
|
dependencies = [
|
|
3150
|
-
"opentelemetry-distro",
|
|
3151
|
-
"opentelemetry-exporter-otlp",
|
|
2824
|
+
"aws-opentelemetry-distro",
|
|
3152
2825
|
"langgraph >= 1.0.2",
|
|
3153
2826
|
"mcp >= 1.19.0",
|
|
3154
2827
|
"langchain-mcp-adapters >= 0.1.11",
|
|
@@ -4152,7 +3825,6 @@ assets/
|
|
|
4152
3825
|
├── python/ # Framework templates (one per SDK)
|
|
4153
3826
|
│ ├── strands/
|
|
4154
3827
|
│ ├── langchain_langgraph/
|
|
4155
|
-
│ ├── crewai/
|
|
4156
3828
|
│ ├── googleadk/
|
|
4157
3829
|
│ ├── openaiagents/
|
|
4158
3830
|
│ └── autogen/
|
|
@@ -4328,7 +4000,7 @@ file maps to a JSON config file and includes validation constraints as comments.
|
|
|
4328
4000
|
- **BuildType**: \`'CodeZip'\` | \`'Container'\`
|
|
4329
4001
|
- **NetworkMode**: \`'PUBLIC'\`
|
|
4330
4002
|
- **RuntimeVersion**: \`'PYTHON_3_10'\` | \`'PYTHON_3_11'\` | \`'PYTHON_3_12'\` | \`'PYTHON_3_13'\`
|
|
4331
|
-
- **MemoryStrategyType**: \`'SEMANTIC'\` | \`'SUMMARIZATION'\` | \`'USER_PREFERENCE'\`
|
|
4003
|
+
- **MemoryStrategyType**: \`'SEMANTIC'\` | \`'SUMMARIZATION'\` | \`'USER_PREFERENCE'\` | \`'EPISODIC'\`
|
|
4332
4004
|
|
|
4333
4005
|
### Build Types
|
|
4334
4006
|
|
|
@@ -4342,7 +4014,6 @@ file maps to a JSON config file and includes validation constraints as comments.
|
|
|
4342
4014
|
|
|
4343
4015
|
- **Strands** - Works with Bedrock, Anthropic, OpenAI, Gemini
|
|
4344
4016
|
- **LangChain_LangGraph** - Works with Bedrock, Anthropic, OpenAI, Gemini
|
|
4345
|
-
- **CrewAI** - Works with Bedrock, Anthropic, OpenAI, Gemini
|
|
4346
4017
|
- **GoogleADK** - Gemini only
|
|
4347
4018
|
- **OpenAIAgents** - OpenAI only
|
|
4348
4019
|
- **AutoGen** - Works with Bedrock, Anthropic, OpenAI, Gemini
|
|
@@ -63,7 +63,7 @@ file maps to a JSON config file and includes validation constraints as comments.
|
|
|
63
63
|
- **BuildType**: `'CodeZip'` | `'Container'`
|
|
64
64
|
- **NetworkMode**: `'PUBLIC'`
|
|
65
65
|
- **RuntimeVersion**: `'PYTHON_3_10'` | `'PYTHON_3_11'` | `'PYTHON_3_12'` | `'PYTHON_3_13'`
|
|
66
|
-
- **MemoryStrategyType**: `'SEMANTIC'` | `'SUMMARIZATION'` | `'USER_PREFERENCE'`
|
|
66
|
+
- **MemoryStrategyType**: `'SEMANTIC'` | `'SUMMARIZATION'` | `'USER_PREFERENCE'` | `'EPISODIC'`
|
|
67
67
|
|
|
68
68
|
### Build Types
|
|
69
69
|
|
|
@@ -77,7 +77,6 @@ file maps to a JSON config file and includes validation constraints as comments.
|
|
|
77
77
|
|
|
78
78
|
- **Strands** - Works with Bedrock, Anthropic, OpenAI, Gemini
|
|
79
79
|
- **LangChain_LangGraph** - Works with Bedrock, Anthropic, OpenAI, Gemini
|
|
80
|
-
- **CrewAI** - Works with Bedrock, Anthropic, OpenAI, Gemini
|
|
81
80
|
- **GoogleADK** - Gemini only
|
|
82
81
|
- **OpenAIAgents** - OpenAI only
|
|
83
82
|
- **AutoGen** - Works with Bedrock, Anthropic, OpenAI, Gemini
|
|
@@ -54,12 +54,15 @@ async def invoke(payload, context):
|
|
|
54
54
|
|
|
55
55
|
# Process the user prompt
|
|
56
56
|
prompt = payload.get("prompt", "What can you help me with?")
|
|
57
|
+
log.info(f"Agent input: {prompt}")
|
|
57
58
|
|
|
58
59
|
# Run the agent
|
|
59
60
|
result = await graph.ainvoke({"messages": [HumanMessage(content=prompt)]})
|
|
60
61
|
|
|
61
62
|
# Return result
|
|
62
|
-
|
|
63
|
+
output = result["messages"][-1].content
|
|
64
|
+
log.info(f"Agent output: {output}")
|
|
65
|
+
return {"result": output}
|
|
63
66
|
|
|
64
67
|
|
|
65
68
|
if __name__ == "__main__":
|
|
@@ -9,8 +9,7 @@ description = "AgentCore Runtime Application using LangChain/LangGraph"
|
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
11
11
|
dependencies = [
|
|
12
|
-
"opentelemetry-distro",
|
|
13
|
-
"opentelemetry-exporter-otlp",
|
|
12
|
+
"aws-opentelemetry-distro",
|
|
14
13
|
"langgraph >= 1.0.2",
|
|
15
14
|
"mcp >= 1.19.0",
|
|
16
15
|
"langchain-mcp-adapters >= 0.1.11",
|