@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
@@ -1,39 +0,0 @@
1
- This is a project generated by the agentcore create CLI tool!
2
-
3
- # Layout
4
-
5
- The generated application code lives at the agent root directory. At the root, there is a `.gitignore` file, an
6
- `agentcore/` folder which represents the configurations and state associated with this project. Other `agentcore`
7
- commands like `deploy`, `dev`, and `invoke` rely on the configuration stored here.
8
-
9
- ## Agent Root
10
-
11
- The main entrypoint to your app is defined in `main.py`. Using the AgentCore SDK `@app.entrypoint` decorator, this
12
- file defines a Starlette ASGI app with the CrewAI framework running within.
13
-
14
- `model/load.py` instantiates your chosen model provider.
15
-
16
- ## Environment Variables
17
-
18
- | Variable | Required | Description |
19
- | --- | --- | --- |
20
- {{#if hasIdentity}}| `{{identityProviders.[0].envVarName}}` | Yes | {{modelProvider}} API key (local) or Identity provider name (deployed) |
21
- {{/if}}| `LOCAL_DEV` | No | Set to `1` to use `.env.local` instead of AgentCore Identity |
22
-
23
- # Developing locally
24
-
25
- If installation was successful, a virtual environment is already created with dependencies installed.
26
-
27
- Run `source .venv/bin/activate` before developing.
28
-
29
- `agentcore dev` will start a local server on 0.0.0.0:8080.
30
-
31
- In a new terminal, you can invoke that server with:
32
-
33
- `agentcore invoke --dev "What can you do"`
34
-
35
- # Deployment
36
-
37
- After providing credentials, `agentcore deploy` will deploy your project into Amazon Bedrock AgentCore.
38
-
39
- Use `agentcore invoke` to invoke your deployed agent.
@@ -1,41 +0,0 @@
1
- # Environment variables
2
- .env
3
-
4
- # Python
5
- __pycache__/
6
- *.py[cod]
7
- *$py.class
8
- *.so
9
- .Python
10
- build/
11
- develop-eggs/
12
- dist/
13
- downloads/
14
- eggs/
15
- .eggs/
16
- lib/
17
- lib64/
18
- parts/
19
- sdist/
20
- var/
21
- wheels/
22
- *.egg-info/
23
- .installed.cfg
24
- *.egg
25
-
26
- # Virtual environments
27
- .venv/
28
- venv/
29
- ENV/
30
- env/
31
-
32
- # IDE
33
- .vscode/
34
- .idea/
35
- *.swp
36
- *.swo
37
- *~
38
-
39
- # OS
40
- .DS_Store
41
- Thumbs.db
@@ -1,55 +0,0 @@
1
- from crewai import Agent, Crew, Task, Process
2
- from crewai.tools import tool
3
- from bedrock_agentcore.runtime import BedrockAgentCoreApp
4
- from model.load import load_model
5
-
6
- app = BedrockAgentCoreApp()
7
- log = app.logger
8
-
9
-
10
- # Define a simple function tool
11
- @tool
12
- def add_numbers(a: int, b: int) -> int:
13
- """Return the sum of two numbers"""
14
- return a + b
15
-
16
-
17
- # Define a collection of tools used by the model
18
- tools = [add_numbers]
19
-
20
-
21
- @app.entrypoint
22
- def invoke(payload, context):
23
- log.info("Invoking Agent.....")
24
-
25
- # Define the Agent with Tools
26
- agent = Agent(
27
- role="Question Answering Assistant",
28
- goal="Answer the users questions",
29
- backstory="Always eager to answer any questions",
30
- llm=load_model(),
31
- tools=tools,
32
- )
33
-
34
- # Define the Task
35
- task = Task(
36
- agent=agent,
37
- description="Answer the users question: {prompt}",
38
- expected_output="An answer to the users question",
39
- )
40
-
41
- # Create the Crew
42
- crew = Crew(agents=[agent], tasks=[task], process=Process.sequential)
43
-
44
- # Process the user prompt
45
- prompt = payload.get("prompt", "What can you help me with?")
46
-
47
- # Run the crew
48
- result = crew.kickoff(inputs={"prompt": prompt})
49
-
50
- # Return result
51
- return {"result": result.raw}
52
-
53
-
54
- if __name__ == "__main__":
55
- app.run()
@@ -1 +0,0 @@
1
- # Package marker
@@ -1,133 +0,0 @@
1
- {{#if (eq modelProvider "Bedrock")}}
2
- from crewai import LLM
3
-
4
- # Uses global inference profile for Claude Sonnet 4.5
5
- # https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html
6
- MODEL_ID = "bedrock/global.anthropic.claude-sonnet-4-5-20250929-v1:0"
7
-
8
-
9
- def load_model() -> LLM:
10
- """Get Bedrock model client using IAM credentials."""
11
- return LLM(model=MODEL_ID)
12
- {{/if}}
13
- {{#if (eq modelProvider "Anthropic")}}
14
- import os
15
- from crewai import LLM
16
- from bedrock_agentcore.identity.auth import requires_api_key
17
-
18
- IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
19
- IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
20
-
21
-
22
- @requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
23
- def _agentcore_identity_api_key_provider(api_key: str) -> str:
24
- """Fetch API key from AgentCore Identity."""
25
- return api_key
26
-
27
-
28
- def _get_api_key() -> str:
29
- """
30
- Uses AgentCore Identity for API key management in deployed environments.
31
- For local development, run via 'agentcore dev' which loads agentcore/.env.
32
- """
33
- if os.getenv("LOCAL_DEV") == "1":
34
- api_key = os.getenv(IDENTITY_ENV_VAR)
35
- if not api_key:
36
- raise RuntimeError(
37
- f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
38
- )
39
- return api_key
40
- return _agentcore_identity_api_key_provider()
41
-
42
-
43
- def load_model() -> LLM:
44
- """Get authenticated Anthropic model client."""
45
- api_key = _get_api_key()
46
- # CrewAI requires ANTHROPIC_API_KEY env var (ignores api_key parameter)
47
- os.environ["ANTHROPIC_API_KEY"] = api_key
48
- return LLM(
49
- model="anthropic/claude-sonnet-4-5-20250929",
50
- api_key=api_key,
51
- max_tokens=4096
52
- )
53
- {{/if}}
54
- {{#if (eq modelProvider "OpenAI")}}
55
- import os
56
- from crewai import LLM
57
- from bedrock_agentcore.identity.auth import requires_api_key
58
-
59
- IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
60
- IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
61
-
62
-
63
- @requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
64
- def _agentcore_identity_api_key_provider(api_key: str) -> str:
65
- """Fetch API key from AgentCore Identity."""
66
- return api_key
67
-
68
-
69
- def _get_api_key() -> str:
70
- """
71
- Uses AgentCore Identity for API key management in deployed environments.
72
- For local development, run via 'agentcore dev' which loads agentcore/.env.
73
- """
74
- if os.getenv("LOCAL_DEV") == "1":
75
- api_key = os.getenv(IDENTITY_ENV_VAR)
76
- if not api_key:
77
- raise RuntimeError(
78
- f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
79
- )
80
- return api_key
81
- return _agentcore_identity_api_key_provider()
82
-
83
-
84
- def load_model() -> LLM:
85
- """Get authenticated OpenAI model client."""
86
- api_key = _get_api_key()
87
- # CrewAI requires OPENAI_API_KEY env var (ignores api_key parameter)
88
- os.environ["OPENAI_API_KEY"] = api_key
89
- return LLM(
90
- model="openai/gpt-4.1",
91
- api_key=api_key
92
- )
93
- {{/if}}
94
- {{#if (eq modelProvider "Gemini")}}
95
- import os
96
- from crewai import LLM
97
- from bedrock_agentcore.identity.auth import requires_api_key
98
-
99
- IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
100
- IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
101
-
102
-
103
- @requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
104
- def _agentcore_identity_api_key_provider(api_key: str) -> str:
105
- """Fetch API key from AgentCore Identity."""
106
- return api_key
107
-
108
-
109
- def _get_api_key() -> str:
110
- """
111
- Uses AgentCore Identity for API key management in deployed environments.
112
- For local development, run via 'agentcore dev' which loads agentcore/.env.
113
- """
114
- if os.getenv("LOCAL_DEV") == "1":
115
- api_key = os.getenv(IDENTITY_ENV_VAR)
116
- if not api_key:
117
- raise RuntimeError(
118
- f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
119
- )
120
- return api_key
121
- return _agentcore_identity_api_key_provider()
122
-
123
-
124
- def load_model() -> LLM:
125
- """Get authenticated Gemini model client."""
126
- api_key = _get_api_key()
127
- # CrewAI requires GEMINI_API_KEY env var (ignores api_key parameter)
128
- os.environ["GEMINI_API_KEY"] = api_key
129
- return LLM(
130
- model="gemini/gemini-2.5-flash",
131
- api_key=api_key
132
- )
133
- {{/if}}
@@ -1,31 +0,0 @@
1
- [build-system]
2
- requires = ["hatchling"]
3
- build-backend = "hatchling.build"
4
-
5
- [project]
6
- name = "{{ name }}"
7
- version = "0.1.0"
8
- description = "AgentCore Runtime Application using CrewAI SDK"
9
- readme = "README.md"
10
- requires-python = ">=3.11"
11
- dependencies = [
12
- "opentelemetry-distro",
13
- "opentelemetry-exporter-otlp",
14
- "bedrock-agentcore >= 1.0.3",
15
- "botocore[crt] >= 1.35.0",
16
- {{#if (eq modelProvider "Bedrock")}}
17
- "crewai[tools,bedrock] >= 1.3.0",
18
- {{/if}}
19
- {{#if (eq modelProvider "Anthropic")}}
20
- "crewai[tools,anthropic] >= 1.3.0",
21
- {{/if}}
22
- {{#if (eq modelProvider "OpenAI")}}
23
- "crewai[tools,openai] >= 1.3.0",
24
- {{/if}}
25
- {{#if (eq modelProvider "Gemini")}}
26
- "crewai[tools,google-genai] >= 1.3.0",
27
- {{/if}}
28
- ]
29
-
30
- [tool.hatch.build.targets.wheel]
31
- packages = ["."]