@aws/agentcore 0.3.0-preview.9.0 → 0.5.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.
Files changed (46) hide show
  1. package/dist/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap +2 -333
  2. package/dist/assets/agents/AGENTS.md +0 -1
  3. package/dist/assets/cdk/test/cdk.test.ts +2 -1
  4. package/dist/cli/index.mjs +335 -338
  5. package/dist/lib/packaging/index.js +3 -3
  6. package/dist/lib/packaging/index.js.map +1 -1
  7. package/dist/lib/packaging/python.js +1 -1
  8. package/dist/lib/schemas/io/config-io.d.ts +11 -3
  9. package/dist/lib/schemas/io/config-io.d.ts.map +1 -1
  10. package/dist/lib/schemas/io/config-io.js +14 -3
  11. package/dist/lib/schemas/io/config-io.js.map +1 -1
  12. package/dist/lib/schemas/io/index.d.ts +1 -1
  13. package/dist/lib/schemas/io/index.d.ts.map +1 -1
  14. package/dist/lib/schemas/io/index.js +2 -1
  15. package/dist/lib/schemas/io/index.js.map +1 -1
  16. package/dist/schema/constants.d.ts +0 -1
  17. package/dist/schema/constants.d.ts.map +1 -1
  18. package/dist/schema/constants.js +2 -5
  19. package/dist/schema/constants.js.map +1 -1
  20. package/dist/schema/schemas/agent-env.d.ts +1 -7
  21. package/dist/schema/schemas/agent-env.d.ts.map +1 -1
  22. package/dist/schema/schemas/agent-env.js +4 -3
  23. package/dist/schema/schemas/agent-env.js.map +1 -1
  24. package/dist/schema/schemas/agentcore-project.d.ts +19 -22
  25. package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
  26. package/dist/schema/schemas/agentcore-project.js +21 -12
  27. package/dist/schema/schemas/agentcore-project.js.map +1 -1
  28. package/dist/schema/schemas/deployed-state.d.ts +4 -4
  29. package/dist/schema/schemas/deployed-state.js +1 -1
  30. package/dist/schema/schemas/deployed-state.js.map +1 -1
  31. package/dist/schema/schemas/mcp.d.ts +4 -4
  32. package/dist/schema/schemas/mcp.js +3 -3
  33. package/dist/schema/schemas/mcp.js.map +1 -1
  34. package/dist/schema/schemas/primitives/online-eval-config.d.ts +0 -1
  35. package/dist/schema/schemas/primitives/online-eval-config.d.ts.map +1 -1
  36. package/dist/schema/schemas/primitives/online-eval-config.js +0 -1
  37. package/dist/schema/schemas/primitives/online-eval-config.js.map +1 -1
  38. package/package.json +6 -4
  39. package/scripts/bundle.mjs +162 -0
  40. package/scripts/generate-schema.mjs +40 -0
  41. package/dist/assets/python/http/crewai/base/README.md +0 -39
  42. package/dist/assets/python/http/crewai/base/gitignore.template +0 -41
  43. package/dist/assets/python/http/crewai/base/main.py +0 -55
  44. package/dist/assets/python/http/crewai/base/model/__init__.py +0 -1
  45. package/dist/assets/python/http/crewai/base/model/load.py +0 -133
  46. 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
- agents: [],
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
 
@@ -4154,7 +3825,6 @@ assets/
4154
3825
  ├── python/ # Framework templates (one per SDK)
4155
3826
  │ ├── strands/
4156
3827
  │ ├── langchain_langgraph/
4157
- │ ├── crewai/
4158
3828
  │ ├── googleadk/
4159
3829
  │ ├── openaiagents/
4160
3830
  │ └── autogen/
@@ -4344,7 +4014,6 @@ file maps to a JSON config file and includes validation constraints as comments.
4344
4014
 
4345
4015
  - **Strands** - Works with Bedrock, Anthropic, OpenAI, Gemini
4346
4016
  - **LangChain_LangGraph** - Works with Bedrock, Anthropic, OpenAI, Gemini
4347
- - **CrewAI** - Works with Bedrock, Anthropic, OpenAI, Gemini
4348
4017
  - **GoogleADK** - Gemini only
4349
4018
  - **OpenAIAgents** - OpenAI only
4350
4019
  - **AutoGen** - Works with Bedrock, Anthropic, OpenAI, Gemini
@@ -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
@@ -8,7 +8,8 @@ test('AgentCoreStack synthesizes with empty spec', () => {
8
8
  spec: {
9
9
  name: 'testproject',
10
10
  version: 1,
11
- agents: [],
11
+ managedBy: 'CDK' as const,
12
+ runtimes: [],
12
13
  memories: [],
13
14
  credentials: [],
14
15
  evaluators: [],