Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions src/assets/templates/a2a-python-strands/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,16 @@ def list_files(path: str) -> str:
{{/each}}{{/if}}
"""

# serve_a2a serves one agent instance, so it is bound to a fixed session and
# actor; get_memory_session_manager returns None (in-process history only) until
# the deployed MEMORY_ID env var is set by the CDK.
agent = Agent(
name="{{ name }}",
model=load_model(),
session_manager=get_memory_session_manager("default-session", "default-user"),
system_prompt=SYSTEM_PROMPT,
tools=tools,
)
def create_agent(context_id: str) -> Agent:
return Agent(
name="{{ name }}",
model=load_model(),
session_manager=get_memory_session_manager(context_id, "default-user"),
system_prompt=SYSTEM_PROMPT,
tools=tools,
)

# serve_a2a binds 0.0.0.0:9000 in the container (the AgentCore A2A service
# contract) and publishes the agent card at /.well-known/agent-card.json. The
# card is derived by introspecting the executor's agent.
# contract) and publishes the agent card at /.well-known/agent-card.json.
if __name__ == "__main__":
serve_a2a(StrandsA2AExecutor(agent))
serve_a2a(StrandsA2AExecutor(agent_factory=create_agent))
8 changes: 4 additions & 4 deletions src/assets/templates/a2a-python-strands/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ description = "AgentCore A2A Agent using Strands SDK"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"a2a-sdk[all] ~= 0.3.0",
"a2a-sdk[all] ~= 0.3.26",
"aws-opentelemetry-distro ~= 0.18.0",
"bedrock-agentcore[a2a,strands-agents] >= 1.18.1, < 2.0.0",
"botocore[crt] ~= 1.43.0",
"strands-agents >= 1.15.0, < 2.0.0",
"bedrock-agentcore[a2a,strands-agents] ~= 1.24.0",
"botocore[crt] ~= 1.43.107",
"strands-agents ~= 1.57.2",
]

[tool.hatch.build.targets.wheel]
Expand Down
11 changes: 10 additions & 1 deletion src/core/project/templates/pythonSecurity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ const renderer = new HandlebarsTemplateRenderer();
test.each([
["agent-python-minimal", ["bedrock-agentcore >= 1.18.1, < 2.0.0"]],
["agent-python-strands", ["bedrock-agentcore[strands-agents] >= 1.18.1, < 2.0.0"]],
["a2a-python-strands", ["bedrock-agentcore[a2a,strands-agents] >= 1.18.1, < 2.0.0"]],
[
"a2a-python-strands",
[
"a2a-sdk[all] ~= 0.3.26",
"aws-opentelemetry-distro ~= 0.18.0",
"bedrock-agentcore[a2a,strands-agents] ~= 1.24.0",
"botocore[crt] ~= 1.43.107",
"strands-agents ~= 1.57.2",
],
],
["agui-python-strands", ["bedrock-agentcore[strands-agents] >= 1.18.1, < 2.0.0"]],
[
"export-harness-python",
Expand Down
Loading