@aws/agentcore 0.3.0-preview.5.0 → 0.3.0-preview.6.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 +1124 -97
- package/dist/assets/cdk/package.json +1 -1
- package/dist/assets/cdk/test/cdk.test.ts +2 -0
- package/dist/assets/python/a2a/googleadk/base/README.md +22 -0
- package/dist/assets/python/a2a/googleadk/base/main.py +48 -0
- package/dist/assets/python/a2a/googleadk/base/pyproject.toml +20 -0
- package/dist/assets/python/a2a/langchain_langgraph/base/README.md +22 -0
- package/dist/assets/python/a2a/langchain_langgraph/base/main.py +64 -0
- package/dist/assets/python/a2a/langchain_langgraph/base/pyproject.toml +24 -0
- package/dist/assets/python/a2a/strands/base/README.md +22 -0
- package/dist/assets/python/a2a/strands/base/main.py +44 -0
- package/dist/assets/python/a2a/strands/base/pyproject.toml +23 -0
- package/dist/assets/python/a2a/strands/capabilities/memory/session.py +38 -0
- package/dist/assets/python/{autogen → http/autogen}/base/mcp_client/client.py +10 -0
- package/dist/assets/python/http/googleadk/base/gitignore.template +41 -0
- package/dist/assets/python/{googleadk → http/googleadk}/base/mcp_client/client.py +9 -0
- package/dist/assets/python/http/googleadk/base/model/load.py +41 -0
- package/dist/assets/python/http/langchain_langgraph/base/gitignore.template +41 -0
- package/dist/assets/python/{langchain_langgraph → http/langchain_langgraph}/base/mcp_client/client.py +9 -0
- package/dist/assets/python/http/langchain_langgraph/base/model/load.py +123 -0
- package/dist/assets/python/http/openaiagents/base/gitignore.template +41 -0
- package/dist/assets/python/{openaiagents → http/openaiagents}/base/mcp_client/client.py +9 -0
- package/dist/assets/python/http/openaiagents/base/model/__init__.py +1 -0
- package/dist/assets/python/http/strands/base/mcp_client/__init__.py +1 -0
- package/dist/assets/python/{strands → http/strands}/base/mcp_client/client.py +9 -0
- package/dist/assets/python/http/strands/base/model/__init__.py +1 -0
- package/dist/assets/python/http/strands/base/model/load.py +123 -0
- package/dist/assets/python/http/strands/capabilities/memory/__init__.py +1 -0
- package/dist/assets/python/mcp/standalone/base/README.md +36 -0
- package/dist/assets/python/mcp/standalone/base/gitignore.template +41 -0
- package/dist/assets/python/mcp/standalone/base/main.py +25 -0
- package/dist/assets/python/mcp/standalone/base/pyproject.toml +16 -0
- package/dist/cli/index.mjs +359 -321
- package/dist/lib/packaging/helpers.js +2 -2
- package/dist/lib/packaging/helpers.js.map +1 -1
- package/dist/lib/utils/index.d.ts +1 -0
- package/dist/lib/utils/index.d.ts.map +1 -1
- package/dist/lib/utils/index.js +3 -1
- package/dist/lib/utils/index.js.map +1 -1
- package/dist/lib/utils/json-rpc.d.ts +3 -0
- package/dist/lib/utils/json-rpc.d.ts.map +1 -0
- package/dist/lib/utils/json-rpc.js +27 -0
- package/dist/lib/utils/json-rpc.js.map +1 -0
- package/dist/schema/constants.d.ts +20 -1
- package/dist/schema/constants.d.ts.map +1 -1
- package/dist/schema/constants.js +29 -2
- package/dist/schema/constants.js.map +1 -1
- package/dist/schema/schemas/agent-env.d.ts +20 -2
- package/dist/schema/schemas/agent-env.d.ts.map +1 -1
- package/dist/schema/schemas/agent-env.js +37 -2
- package/dist/schema/schemas/agent-env.js.map +1 -1
- package/dist/schema/schemas/agentcore-project.d.ts +82 -1
- package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
- package/dist/schema/schemas/agentcore-project.js +59 -2
- package/dist/schema/schemas/agentcore-project.js.map +1 -1
- package/dist/schema/schemas/deployed-state.d.ts +62 -0
- package/dist/schema/schemas/deployed-state.d.ts.map +1 -1
- package/dist/schema/schemas/deployed-state.js +18 -1
- package/dist/schema/schemas/deployed-state.js.map +1 -1
- package/dist/schema/schemas/mcp.d.ts +25 -10
- package/dist/schema/schemas/mcp.d.ts.map +1 -1
- package/dist/schema/schemas/mcp.js +9 -1
- package/dist/schema/schemas/mcp.js.map +1 -1
- package/dist/schema/schemas/primitives/evaluator.d.ts +68 -0
- package/dist/schema/schemas/primitives/evaluator.d.ts.map +1 -0
- package/dist/schema/schemas/primitives/evaluator.js +58 -0
- package/dist/schema/schemas/primitives/evaluator.js.map +1 -0
- package/dist/schema/schemas/primitives/index.d.ts +4 -0
- package/dist/schema/schemas/primitives/index.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/index.js +14 -1
- package/dist/schema/schemas/primitives/index.js.map +1 -1
- package/dist/schema/schemas/primitives/online-eval-config.d.ts +13 -0
- package/dist/schema/schemas/primitives/online-eval-config.d.ts.map +1 -0
- package/dist/schema/schemas/primitives/online-eval-config.js +27 -0
- package/dist/schema/schemas/primitives/online-eval-config.js.map +1 -0
- package/package.json +11 -5
- /package/dist/assets/python/{autogen → a2a/googleadk}/base/gitignore.template +0 -0
- /package/dist/assets/python/{autogen/base/mcp_client → a2a/googleadk/base/model}/__init__.py +0 -0
- /package/dist/assets/python/{googleadk → a2a/googleadk}/base/model/load.py +0 -0
- /package/dist/assets/python/{crewai → a2a/langchain_langgraph}/base/gitignore.template +0 -0
- /package/dist/assets/python/{autogen → a2a/langchain_langgraph}/base/model/__init__.py +0 -0
- /package/dist/assets/python/{langchain_langgraph → a2a/langchain_langgraph}/base/model/load.py +0 -0
- /package/dist/assets/python/{googleadk → a2a/strands}/base/gitignore.template +0 -0
- /package/dist/assets/python/{crewai → a2a/strands}/base/model/__init__.py +0 -0
- /package/dist/assets/python/{strands → a2a/strands}/base/model/load.py +0 -0
- /package/dist/assets/python/{googleadk/base/mcp_client → a2a/strands/capabilities/memory}/__init__.py +0 -0
- /package/dist/assets/python/{autogen → http/autogen}/base/README.md +0 -0
- /package/dist/assets/python/{langchain_langgraph → http/autogen}/base/gitignore.template +0 -0
- /package/dist/assets/python/{autogen → http/autogen}/base/main.py +0 -0
- /package/dist/assets/python/{googleadk/base/model → http/autogen/base/mcp_client}/__init__.py +0 -0
- /package/dist/assets/python/{langchain_langgraph/base/mcp_client → http/autogen/base/model}/__init__.py +0 -0
- /package/dist/assets/python/{autogen → http/autogen}/base/model/load.py +0 -0
- /package/dist/assets/python/{autogen → http/autogen}/base/pyproject.toml +0 -0
- /package/dist/assets/python/{crewai → http/crewai}/base/README.md +0 -0
- /package/dist/assets/python/{openaiagents → http/crewai}/base/gitignore.template +0 -0
- /package/dist/assets/python/{crewai → http/crewai}/base/main.py +0 -0
- /package/dist/assets/python/{langchain_langgraph → http/crewai}/base/model/__init__.py +0 -0
- /package/dist/assets/python/{crewai → http/crewai}/base/model/load.py +0 -0
- /package/dist/assets/python/{crewai → http/crewai}/base/pyproject.toml +0 -0
- /package/dist/assets/python/{googleadk → http/googleadk}/base/README.md +0 -0
- /package/dist/assets/python/{googleadk → http/googleadk}/base/main.py +0 -0
- /package/dist/assets/python/{openaiagents → http/googleadk}/base/mcp_client/__init__.py +0 -0
- /package/dist/assets/python/{openaiagents → http/googleadk}/base/model/__init__.py +0 -0
- /package/dist/assets/python/{googleadk → http/googleadk}/base/pyproject.toml +0 -0
- /package/dist/assets/python/{langchain_langgraph → http/langchain_langgraph}/base/README.md +0 -0
- /package/dist/assets/python/{langchain_langgraph → http/langchain_langgraph}/base/main.py +0 -0
- /package/dist/assets/python/{strands → http/langchain_langgraph}/base/mcp_client/__init__.py +0 -0
- /package/dist/assets/python/{strands → http/langchain_langgraph}/base/model/__init__.py +0 -0
- /package/dist/assets/python/{langchain_langgraph → http/langchain_langgraph}/base/pyproject.toml +0 -0
- /package/dist/assets/python/{openaiagents → http/openaiagents}/base/README.md +0 -0
- /package/dist/assets/python/{openaiagents → http/openaiagents}/base/main.py +0 -0
- /package/dist/assets/python/{strands/capabilities/memory → http/openaiagents/base/mcp_client}/__init__.py +0 -0
- /package/dist/assets/python/{openaiagents → http/openaiagents}/base/model/load.py +0 -0
- /package/dist/assets/python/{openaiagents → http/openaiagents}/base/pyproject.toml +0 -0
- /package/dist/assets/python/{strands → http/strands}/base/README.md +0 -0
- /package/dist/assets/python/{strands → http/strands}/base/gitignore.template +0 -0
- /package/dist/assets/python/{strands → http/strands}/base/main.py +0 -0
- /package/dist/assets/python/{strands → http/strands}/base/pyproject.toml +0 -0
- /package/dist/assets/python/{strands → http/strands}/capabilities/memory/session.py +0 -0
|
@@ -351,7 +351,7 @@ exports[`Assets Directory Snapshots > CDK assets > cdk/cdk/package.json should m
|
|
|
351
351
|
},
|
|
352
352
|
"dependencies": {
|
|
353
353
|
"@aws/agentcore-cdk": "^0.1.0-alpha.1",
|
|
354
|
-
"aws-cdk-lib": "2.
|
|
354
|
+
"aws-cdk-lib": "2.243.0",
|
|
355
355
|
"constructs": "^10.0.0"
|
|
356
356
|
}
|
|
357
357
|
}
|
|
@@ -372,6 +372,8 @@ test('AgentCoreStack synthesizes with empty spec', () => {
|
|
|
372
372
|
agents: [],
|
|
373
373
|
memories: [],
|
|
374
374
|
credentials: [],
|
|
375
|
+
evaluators: [],
|
|
376
|
+
onlineEvalConfigs: [],
|
|
375
377
|
},
|
|
376
378
|
});
|
|
377
379
|
const template = Template.fromStack(stack);
|
|
@@ -438,54 +440,78 @@ exports[`Assets Directory Snapshots > File listing > should match the expected f
|
|
|
438
440
|
"mcp/python/README.md",
|
|
439
441
|
"mcp/python/pyproject.toml",
|
|
440
442
|
"mcp/python/server.py",
|
|
441
|
-
"python/
|
|
442
|
-
"python/
|
|
443
|
-
"python/
|
|
444
|
-
"python/
|
|
445
|
-
"python/
|
|
446
|
-
"python/
|
|
447
|
-
"python/
|
|
448
|
-
"python/
|
|
449
|
-
"python/
|
|
450
|
-
"python/
|
|
451
|
-
"python/
|
|
452
|
-
"python/
|
|
453
|
-
"python/
|
|
454
|
-
"python/
|
|
455
|
-
"python/
|
|
456
|
-
"python/
|
|
457
|
-
"python/
|
|
458
|
-
"python/
|
|
459
|
-
"python/
|
|
460
|
-
"python/
|
|
461
|
-
"python/
|
|
462
|
-
"python/
|
|
463
|
-
"python/
|
|
464
|
-
"python/
|
|
465
|
-
"python/
|
|
466
|
-
"python/
|
|
467
|
-
"python/
|
|
468
|
-
"python/
|
|
469
|
-
"python/
|
|
470
|
-
"python/
|
|
471
|
-
"python/
|
|
472
|
-
"python/
|
|
473
|
-
"python/
|
|
474
|
-
"python/
|
|
475
|
-
"python/
|
|
476
|
-
"python/
|
|
477
|
-
"python/
|
|
478
|
-
"python/
|
|
479
|
-
"python/
|
|
480
|
-
"python/
|
|
481
|
-
"python/
|
|
482
|
-
"python/
|
|
483
|
-
"python/
|
|
484
|
-
"python/
|
|
485
|
-
"python/
|
|
486
|
-
"python/
|
|
487
|
-
"python/
|
|
488
|
-
"python/
|
|
443
|
+
"python/a2a/googleadk/base/README.md",
|
|
444
|
+
"python/a2a/googleadk/base/gitignore.template",
|
|
445
|
+
"python/a2a/googleadk/base/main.py",
|
|
446
|
+
"python/a2a/googleadk/base/model/__init__.py",
|
|
447
|
+
"python/a2a/googleadk/base/model/load.py",
|
|
448
|
+
"python/a2a/googleadk/base/pyproject.toml",
|
|
449
|
+
"python/a2a/langchain_langgraph/base/README.md",
|
|
450
|
+
"python/a2a/langchain_langgraph/base/gitignore.template",
|
|
451
|
+
"python/a2a/langchain_langgraph/base/main.py",
|
|
452
|
+
"python/a2a/langchain_langgraph/base/model/__init__.py",
|
|
453
|
+
"python/a2a/langchain_langgraph/base/model/load.py",
|
|
454
|
+
"python/a2a/langchain_langgraph/base/pyproject.toml",
|
|
455
|
+
"python/a2a/strands/base/README.md",
|
|
456
|
+
"python/a2a/strands/base/gitignore.template",
|
|
457
|
+
"python/a2a/strands/base/main.py",
|
|
458
|
+
"python/a2a/strands/base/model/__init__.py",
|
|
459
|
+
"python/a2a/strands/base/model/load.py",
|
|
460
|
+
"python/a2a/strands/base/pyproject.toml",
|
|
461
|
+
"python/a2a/strands/capabilities/memory/__init__.py",
|
|
462
|
+
"python/a2a/strands/capabilities/memory/session.py",
|
|
463
|
+
"python/http/autogen/base/README.md",
|
|
464
|
+
"python/http/autogen/base/gitignore.template",
|
|
465
|
+
"python/http/autogen/base/main.py",
|
|
466
|
+
"python/http/autogen/base/mcp_client/__init__.py",
|
|
467
|
+
"python/http/autogen/base/mcp_client/client.py",
|
|
468
|
+
"python/http/autogen/base/model/__init__.py",
|
|
469
|
+
"python/http/autogen/base/model/load.py",
|
|
470
|
+
"python/http/autogen/base/pyproject.toml",
|
|
471
|
+
"python/http/crewai/base/README.md",
|
|
472
|
+
"python/http/crewai/base/gitignore.template",
|
|
473
|
+
"python/http/crewai/base/main.py",
|
|
474
|
+
"python/http/crewai/base/model/__init__.py",
|
|
475
|
+
"python/http/crewai/base/model/load.py",
|
|
476
|
+
"python/http/crewai/base/pyproject.toml",
|
|
477
|
+
"python/http/googleadk/base/README.md",
|
|
478
|
+
"python/http/googleadk/base/gitignore.template",
|
|
479
|
+
"python/http/googleadk/base/main.py",
|
|
480
|
+
"python/http/googleadk/base/mcp_client/__init__.py",
|
|
481
|
+
"python/http/googleadk/base/mcp_client/client.py",
|
|
482
|
+
"python/http/googleadk/base/model/__init__.py",
|
|
483
|
+
"python/http/googleadk/base/model/load.py",
|
|
484
|
+
"python/http/googleadk/base/pyproject.toml",
|
|
485
|
+
"python/http/langchain_langgraph/base/README.md",
|
|
486
|
+
"python/http/langchain_langgraph/base/gitignore.template",
|
|
487
|
+
"python/http/langchain_langgraph/base/main.py",
|
|
488
|
+
"python/http/langchain_langgraph/base/mcp_client/__init__.py",
|
|
489
|
+
"python/http/langchain_langgraph/base/mcp_client/client.py",
|
|
490
|
+
"python/http/langchain_langgraph/base/model/__init__.py",
|
|
491
|
+
"python/http/langchain_langgraph/base/model/load.py",
|
|
492
|
+
"python/http/langchain_langgraph/base/pyproject.toml",
|
|
493
|
+
"python/http/openaiagents/base/README.md",
|
|
494
|
+
"python/http/openaiagents/base/gitignore.template",
|
|
495
|
+
"python/http/openaiagents/base/main.py",
|
|
496
|
+
"python/http/openaiagents/base/mcp_client/__init__.py",
|
|
497
|
+
"python/http/openaiagents/base/mcp_client/client.py",
|
|
498
|
+
"python/http/openaiagents/base/model/__init__.py",
|
|
499
|
+
"python/http/openaiagents/base/model/load.py",
|
|
500
|
+
"python/http/openaiagents/base/pyproject.toml",
|
|
501
|
+
"python/http/strands/base/README.md",
|
|
502
|
+
"python/http/strands/base/gitignore.template",
|
|
503
|
+
"python/http/strands/base/main.py",
|
|
504
|
+
"python/http/strands/base/mcp_client/__init__.py",
|
|
505
|
+
"python/http/strands/base/mcp_client/client.py",
|
|
506
|
+
"python/http/strands/base/model/__init__.py",
|
|
507
|
+
"python/http/strands/base/model/load.py",
|
|
508
|
+
"python/http/strands/base/pyproject.toml",
|
|
509
|
+
"python/http/strands/capabilities/memory/__init__.py",
|
|
510
|
+
"python/http/strands/capabilities/memory/session.py",
|
|
511
|
+
"python/mcp/standalone/base/README.md",
|
|
512
|
+
"python/mcp/standalone/base/gitignore.template",
|
|
513
|
+
"python/mcp/standalone/base/main.py",
|
|
514
|
+
"python/mcp/standalone/base/pyproject.toml",
|
|
489
515
|
"typescript/.gitkeep",
|
|
490
516
|
]
|
|
491
517
|
`;
|
|
@@ -861,7 +887,828 @@ packages = ["."]
|
|
|
861
887
|
"
|
|
862
888
|
`;
|
|
863
889
|
|
|
864
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/
|
|
890
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/googleadk/base/README.md should match snapshot 1`] = `
|
|
891
|
+
"# {{ name }}
|
|
892
|
+
|
|
893
|
+
An A2A (Agent-to-Agent) agent deployed on Amazon Bedrock AgentCore using Google ADK.
|
|
894
|
+
|
|
895
|
+
## Overview
|
|
896
|
+
|
|
897
|
+
This agent implements the A2A protocol using Google's Agent Development Kit, enabling agent-to-agent communication.
|
|
898
|
+
|
|
899
|
+
## Local Development
|
|
900
|
+
|
|
901
|
+
\`\`\`bash
|
|
902
|
+
uv sync
|
|
903
|
+
uv run python main.py
|
|
904
|
+
\`\`\`
|
|
905
|
+
|
|
906
|
+
The agent starts on port 9000.
|
|
907
|
+
|
|
908
|
+
## Deploy
|
|
909
|
+
|
|
910
|
+
\`\`\`bash
|
|
911
|
+
agentcore deploy
|
|
912
|
+
\`\`\`
|
|
913
|
+
"
|
|
914
|
+
`;
|
|
915
|
+
|
|
916
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/googleadk/base/gitignore.template should match snapshot 1`] = `
|
|
917
|
+
"# Environment variables
|
|
918
|
+
.env
|
|
919
|
+
|
|
920
|
+
# Python
|
|
921
|
+
__pycache__/
|
|
922
|
+
*.py[cod]
|
|
923
|
+
*$py.class
|
|
924
|
+
*.so
|
|
925
|
+
.Python
|
|
926
|
+
build/
|
|
927
|
+
develop-eggs/
|
|
928
|
+
dist/
|
|
929
|
+
downloads/
|
|
930
|
+
eggs/
|
|
931
|
+
.eggs/
|
|
932
|
+
lib/
|
|
933
|
+
lib64/
|
|
934
|
+
parts/
|
|
935
|
+
sdist/
|
|
936
|
+
var/
|
|
937
|
+
wheels/
|
|
938
|
+
*.egg-info/
|
|
939
|
+
.installed.cfg
|
|
940
|
+
*.egg
|
|
941
|
+
|
|
942
|
+
# Virtual environments
|
|
943
|
+
.venv/
|
|
944
|
+
venv/
|
|
945
|
+
ENV/
|
|
946
|
+
env/
|
|
947
|
+
|
|
948
|
+
# IDE
|
|
949
|
+
.vscode/
|
|
950
|
+
.idea/
|
|
951
|
+
*.swp
|
|
952
|
+
*.swo
|
|
953
|
+
*~
|
|
954
|
+
|
|
955
|
+
# OS
|
|
956
|
+
.DS_Store
|
|
957
|
+
Thumbs.db
|
|
958
|
+
"
|
|
959
|
+
`;
|
|
960
|
+
|
|
961
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/googleadk/base/main.py should match snapshot 1`] = `
|
|
962
|
+
"from google.adk.agents import Agent
|
|
963
|
+
from google.adk.a2a.executor.a2a_agent_executor import A2aAgentExecutor
|
|
964
|
+
from google.adk.runners import Runner
|
|
965
|
+
from google.adk.sessions import InMemorySessionService
|
|
966
|
+
from a2a.types import AgentCapabilities, AgentCard, AgentSkill
|
|
967
|
+
from bedrock_agentcore.runtime import serve_a2a
|
|
968
|
+
from model.load import load_model
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
def add_numbers(a: int, b: int) -> int:
|
|
972
|
+
"""Return the sum of two numbers."""
|
|
973
|
+
return a + b
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
agent = Agent(
|
|
977
|
+
model=load_model(),
|
|
978
|
+
name="{{ name }}",
|
|
979
|
+
description="A helpful assistant that can use tools.",
|
|
980
|
+
instruction="You are a helpful assistant. Use tools when appropriate.",
|
|
981
|
+
tools=[add_numbers],
|
|
982
|
+
)
|
|
983
|
+
|
|
984
|
+
runner = Runner(
|
|
985
|
+
app_name=agent.name,
|
|
986
|
+
agent=agent,
|
|
987
|
+
session_service=InMemorySessionService(),
|
|
988
|
+
)
|
|
989
|
+
|
|
990
|
+
card = AgentCard(
|
|
991
|
+
name=agent.name,
|
|
992
|
+
description=agent.description,
|
|
993
|
+
url="http://localhost:9000/",
|
|
994
|
+
version="0.1.0",
|
|
995
|
+
capabilities=AgentCapabilities(streaming=True),
|
|
996
|
+
skills=[
|
|
997
|
+
AgentSkill(
|
|
998
|
+
id="tools",
|
|
999
|
+
name="tools",
|
|
1000
|
+
description="Use tools to help answer questions",
|
|
1001
|
+
tags=["tools"],
|
|
1002
|
+
)
|
|
1003
|
+
],
|
|
1004
|
+
default_input_modes=["text"],
|
|
1005
|
+
default_output_modes=["text"],
|
|
1006
|
+
)
|
|
1007
|
+
|
|
1008
|
+
if __name__ == "__main__":
|
|
1009
|
+
serve_a2a(A2aAgentExecutor(runner=runner), card)
|
|
1010
|
+
"
|
|
1011
|
+
`;
|
|
1012
|
+
|
|
1013
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/googleadk/base/model/__init__.py should match snapshot 1`] = `
|
|
1014
|
+
"# Package marker
|
|
1015
|
+
"
|
|
1016
|
+
`;
|
|
1017
|
+
|
|
1018
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/googleadk/base/model/load.py should match snapshot 1`] = `
|
|
1019
|
+
"import os
|
|
1020
|
+
from bedrock_agentcore.identity.auth import requires_api_key
|
|
1021
|
+
|
|
1022
|
+
IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
|
|
1023
|
+
IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
@requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
|
|
1027
|
+
def _agentcore_identity_api_key_provider(api_key: str) -> str:
|
|
1028
|
+
"""Fetch API key from AgentCore Identity."""
|
|
1029
|
+
return api_key
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
def _get_api_key() -> str:
|
|
1033
|
+
"""
|
|
1034
|
+
Uses AgentCore Identity for API key management in deployed environments.
|
|
1035
|
+
For local development, run via 'agentcore dev' which loads agentcore/.env.
|
|
1036
|
+
"""
|
|
1037
|
+
if os.getenv("LOCAL_DEV") == "1":
|
|
1038
|
+
api_key = os.getenv(IDENTITY_ENV_VAR)
|
|
1039
|
+
if not api_key:
|
|
1040
|
+
raise RuntimeError(
|
|
1041
|
+
f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
|
|
1042
|
+
)
|
|
1043
|
+
return api_key
|
|
1044
|
+
return _agentcore_identity_api_key_provider()
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
def load_model() -> None:
|
|
1048
|
+
"""
|
|
1049
|
+
Set up Gemini API key authentication.
|
|
1050
|
+
Uses AgentCore Identity for API key management in deployed environments,
|
|
1051
|
+
and falls back to .env file for local development.
|
|
1052
|
+
Sets the GOOGLE_API_KEY environment variable for the Google ADK.
|
|
1053
|
+
"""
|
|
1054
|
+
api_key = _get_api_key()
|
|
1055
|
+
# Use Google AI Studios API Key Authentication.
|
|
1056
|
+
# https://google.github.io/adk-docs/agents/models/#google-ai-studio
|
|
1057
|
+
os.environ["GOOGLE_API_KEY"] = api_key
|
|
1058
|
+
# Set to TRUE is using Google Vertex AI, Set to FALSE for Google AI Studio
|
|
1059
|
+
os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "FALSE"
|
|
1060
|
+
"
|
|
1061
|
+
`;
|
|
1062
|
+
|
|
1063
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/googleadk/base/pyproject.toml should match snapshot 1`] = `
|
|
1064
|
+
"[build-system]
|
|
1065
|
+
requires = ["hatchling"]
|
|
1066
|
+
build-backend = "hatchling.build"
|
|
1067
|
+
|
|
1068
|
+
[project]
|
|
1069
|
+
name = "{{ name }}"
|
|
1070
|
+
version = "0.1.0"
|
|
1071
|
+
description = "AgentCore A2A Agent using Google ADK"
|
|
1072
|
+
readme = "README.md"
|
|
1073
|
+
requires-python = ">=3.10"
|
|
1074
|
+
dependencies = [
|
|
1075
|
+
"a2a-sdk >= 0.2.0",
|
|
1076
|
+
"aws-opentelemetry-distro",
|
|
1077
|
+
"bedrock-agentcore[a2a] >= 1.0.3",
|
|
1078
|
+
"google-adk >= 1.0.0",
|
|
1079
|
+
"google-genai >= 1.0.0",
|
|
1080
|
+
]
|
|
1081
|
+
|
|
1082
|
+
[tool.hatch.build.targets.wheel]
|
|
1083
|
+
packages = ["."]
|
|
1084
|
+
"
|
|
1085
|
+
`;
|
|
1086
|
+
|
|
1087
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/langchain_langgraph/base/README.md should match snapshot 1`] = `
|
|
1088
|
+
"# {{ name }}
|
|
1089
|
+
|
|
1090
|
+
An A2A (Agent-to-Agent) agent deployed on Amazon Bedrock AgentCore using LangChain + LangGraph.
|
|
1091
|
+
|
|
1092
|
+
## Overview
|
|
1093
|
+
|
|
1094
|
+
This agent implements the A2A protocol using LangGraph, enabling agent-to-agent communication.
|
|
1095
|
+
|
|
1096
|
+
## Local Development
|
|
1097
|
+
|
|
1098
|
+
\`\`\`bash
|
|
1099
|
+
uv sync
|
|
1100
|
+
uv run python main.py
|
|
1101
|
+
\`\`\`
|
|
1102
|
+
|
|
1103
|
+
The agent starts on port 9000.
|
|
1104
|
+
|
|
1105
|
+
## Deploy
|
|
1106
|
+
|
|
1107
|
+
\`\`\`bash
|
|
1108
|
+
agentcore deploy
|
|
1109
|
+
\`\`\`
|
|
1110
|
+
"
|
|
1111
|
+
`;
|
|
1112
|
+
|
|
1113
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/langchain_langgraph/base/gitignore.template should match snapshot 1`] = `
|
|
1114
|
+
"# Environment variables
|
|
1115
|
+
.env
|
|
1116
|
+
|
|
1117
|
+
# Python
|
|
1118
|
+
__pycache__/
|
|
1119
|
+
*.py[cod]
|
|
1120
|
+
*$py.class
|
|
1121
|
+
*.so
|
|
1122
|
+
.Python
|
|
1123
|
+
build/
|
|
1124
|
+
develop-eggs/
|
|
1125
|
+
dist/
|
|
1126
|
+
downloads/
|
|
1127
|
+
eggs/
|
|
1128
|
+
.eggs/
|
|
1129
|
+
lib/
|
|
1130
|
+
lib64/
|
|
1131
|
+
parts/
|
|
1132
|
+
sdist/
|
|
1133
|
+
var/
|
|
1134
|
+
wheels/
|
|
1135
|
+
*.egg-info/
|
|
1136
|
+
.installed.cfg
|
|
1137
|
+
*.egg
|
|
1138
|
+
|
|
1139
|
+
# Virtual environments
|
|
1140
|
+
.venv/
|
|
1141
|
+
venv/
|
|
1142
|
+
ENV/
|
|
1143
|
+
env/
|
|
1144
|
+
|
|
1145
|
+
# IDE
|
|
1146
|
+
.vscode/
|
|
1147
|
+
.idea/
|
|
1148
|
+
*.swp
|
|
1149
|
+
*.swo
|
|
1150
|
+
*~
|
|
1151
|
+
|
|
1152
|
+
# OS
|
|
1153
|
+
.DS_Store
|
|
1154
|
+
Thumbs.db
|
|
1155
|
+
"
|
|
1156
|
+
`;
|
|
1157
|
+
|
|
1158
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/langchain_langgraph/base/main.py should match snapshot 1`] = `
|
|
1159
|
+
"from langchain_core.tools import tool
|
|
1160
|
+
from langgraph.prebuilt import create_react_agent
|
|
1161
|
+
from a2a.server.agent_execution import AgentExecutor, RequestContext
|
|
1162
|
+
from a2a.server.events import EventQueue
|
|
1163
|
+
from a2a.server.tasks import TaskUpdater
|
|
1164
|
+
from a2a.types import AgentCapabilities, AgentCard, AgentSkill, Part, TextPart
|
|
1165
|
+
from a2a.utils import new_task
|
|
1166
|
+
from bedrock_agentcore.runtime import serve_a2a
|
|
1167
|
+
from model.load import load_model
|
|
1168
|
+
|
|
1169
|
+
|
|
1170
|
+
@tool
|
|
1171
|
+
def add_numbers(a: int, b: int) -> int:
|
|
1172
|
+
"""Return the sum of two numbers."""
|
|
1173
|
+
return a + b
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
model = load_model()
|
|
1177
|
+
graph = create_react_agent(model, tools=[add_numbers])
|
|
1178
|
+
|
|
1179
|
+
|
|
1180
|
+
class LangGraphA2AExecutor(AgentExecutor):
|
|
1181
|
+
"""Wraps a LangGraph CompiledGraph as an a2a-sdk AgentExecutor."""
|
|
1182
|
+
|
|
1183
|
+
def __init__(self, graph):
|
|
1184
|
+
self.graph = graph
|
|
1185
|
+
|
|
1186
|
+
async def execute(self, context: RequestContext, event_queue: EventQueue) -> None:
|
|
1187
|
+
task = context.current_task or new_task(context.message)
|
|
1188
|
+
if not context.current_task:
|
|
1189
|
+
await event_queue.enqueue_event(task)
|
|
1190
|
+
updater = TaskUpdater(event_queue, task.id, task.context_id)
|
|
1191
|
+
|
|
1192
|
+
user_text = context.get_user_input()
|
|
1193
|
+
result = await self.graph.ainvoke({"messages": [("user", user_text)]})
|
|
1194
|
+
response = result["messages"][-1].content
|
|
1195
|
+
|
|
1196
|
+
await updater.add_artifact([Part(root=TextPart(text=response))])
|
|
1197
|
+
await updater.complete()
|
|
1198
|
+
|
|
1199
|
+
async def cancel(self, context: RequestContext, event_queue: EventQueue) -> None:
|
|
1200
|
+
pass
|
|
1201
|
+
|
|
1202
|
+
|
|
1203
|
+
card = AgentCard(
|
|
1204
|
+
name="{{ name }}",
|
|
1205
|
+
description="A LangGraph agent on Bedrock AgentCore",
|
|
1206
|
+
url="http://localhost:9000/",
|
|
1207
|
+
version="0.1.0",
|
|
1208
|
+
capabilities=AgentCapabilities(streaming=True),
|
|
1209
|
+
skills=[
|
|
1210
|
+
AgentSkill(
|
|
1211
|
+
id="tools",
|
|
1212
|
+
name="tools",
|
|
1213
|
+
description="Use tools to help answer questions",
|
|
1214
|
+
tags=["tools"],
|
|
1215
|
+
)
|
|
1216
|
+
],
|
|
1217
|
+
default_input_modes=["text"],
|
|
1218
|
+
default_output_modes=["text"],
|
|
1219
|
+
)
|
|
1220
|
+
|
|
1221
|
+
if __name__ == "__main__":
|
|
1222
|
+
serve_a2a(LangGraphA2AExecutor(graph), card)
|
|
1223
|
+
"
|
|
1224
|
+
`;
|
|
1225
|
+
|
|
1226
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/langchain_langgraph/base/model/__init__.py should match snapshot 1`] = `
|
|
1227
|
+
"# Package marker
|
|
1228
|
+
"
|
|
1229
|
+
`;
|
|
1230
|
+
|
|
1231
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/langchain_langgraph/base/model/load.py should match snapshot 1`] = `
|
|
1232
|
+
"{{#if (eq modelProvider "Bedrock")}}
|
|
1233
|
+
from langchain_aws import ChatBedrock
|
|
1234
|
+
|
|
1235
|
+
# Uses global inference profile for Claude Sonnet 4.5
|
|
1236
|
+
# https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html
|
|
1237
|
+
MODEL_ID = "global.anthropic.claude-sonnet-4-5-20250929-v1:0"
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
def load_model() -> ChatBedrock:
|
|
1241
|
+
"""Get Bedrock model client using IAM credentials."""
|
|
1242
|
+
return ChatBedrock(model_id=MODEL_ID)
|
|
1243
|
+
{{/if}}
|
|
1244
|
+
{{#if (eq modelProvider "Anthropic")}}
|
|
1245
|
+
import os
|
|
1246
|
+
from langchain_anthropic import ChatAnthropic
|
|
1247
|
+
from bedrock_agentcore.identity.auth import requires_api_key
|
|
1248
|
+
|
|
1249
|
+
IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
|
|
1250
|
+
IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
@requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
|
|
1254
|
+
def _agentcore_identity_api_key_provider(api_key: str) -> str:
|
|
1255
|
+
"""Fetch API key from AgentCore Identity."""
|
|
1256
|
+
return api_key
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
def _get_api_key() -> str:
|
|
1260
|
+
"""
|
|
1261
|
+
Uses AgentCore Identity for API key management in deployed environments.
|
|
1262
|
+
For local development, run via 'agentcore dev' which loads agentcore/.env.
|
|
1263
|
+
"""
|
|
1264
|
+
if os.getenv("LOCAL_DEV") == "1":
|
|
1265
|
+
api_key = os.getenv(IDENTITY_ENV_VAR)
|
|
1266
|
+
if not api_key:
|
|
1267
|
+
raise RuntimeError(
|
|
1268
|
+
f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
|
|
1269
|
+
)
|
|
1270
|
+
return api_key
|
|
1271
|
+
return _agentcore_identity_api_key_provider()
|
|
1272
|
+
|
|
1273
|
+
|
|
1274
|
+
def load_model() -> ChatAnthropic:
|
|
1275
|
+
"""Get authenticated Anthropic model client."""
|
|
1276
|
+
return ChatAnthropic(
|
|
1277
|
+
model="claude-sonnet-4-5-20250929",
|
|
1278
|
+
api_key=_get_api_key()
|
|
1279
|
+
)
|
|
1280
|
+
{{/if}}
|
|
1281
|
+
{{#if (eq modelProvider "OpenAI")}}
|
|
1282
|
+
import os
|
|
1283
|
+
from langchain_openai import ChatOpenAI
|
|
1284
|
+
from bedrock_agentcore.identity.auth import requires_api_key
|
|
1285
|
+
|
|
1286
|
+
IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
|
|
1287
|
+
IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
@requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
|
|
1291
|
+
def _agentcore_identity_api_key_provider(api_key: str) -> str:
|
|
1292
|
+
"""Fetch API key from AgentCore Identity."""
|
|
1293
|
+
return api_key
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
def _get_api_key() -> str:
|
|
1297
|
+
"""
|
|
1298
|
+
Uses AgentCore Identity for API key management in deployed environments.
|
|
1299
|
+
For local development, run via 'agentcore dev' which loads agentcore/.env.
|
|
1300
|
+
"""
|
|
1301
|
+
if os.getenv("LOCAL_DEV") == "1":
|
|
1302
|
+
api_key = os.getenv(IDENTITY_ENV_VAR)
|
|
1303
|
+
if not api_key:
|
|
1304
|
+
raise RuntimeError(
|
|
1305
|
+
f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
|
|
1306
|
+
)
|
|
1307
|
+
return api_key
|
|
1308
|
+
return _agentcore_identity_api_key_provider()
|
|
1309
|
+
|
|
1310
|
+
|
|
1311
|
+
def load_model() -> ChatOpenAI:
|
|
1312
|
+
"""Get authenticated OpenAI model client."""
|
|
1313
|
+
return ChatOpenAI(
|
|
1314
|
+
model="gpt-4.1",
|
|
1315
|
+
api_key=_get_api_key()
|
|
1316
|
+
)
|
|
1317
|
+
{{/if}}
|
|
1318
|
+
{{#if (eq modelProvider "Gemini")}}
|
|
1319
|
+
import os
|
|
1320
|
+
from langchain_google_genai import ChatGoogleGenerativeAI
|
|
1321
|
+
from bedrock_agentcore.identity.auth import requires_api_key
|
|
1322
|
+
|
|
1323
|
+
IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
|
|
1324
|
+
IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
@requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
|
|
1328
|
+
def _agentcore_identity_api_key_provider(api_key: str) -> str:
|
|
1329
|
+
"""Fetch API key from AgentCore Identity."""
|
|
1330
|
+
return api_key
|
|
1331
|
+
|
|
1332
|
+
|
|
1333
|
+
def _get_api_key() -> str:
|
|
1334
|
+
"""
|
|
1335
|
+
Uses AgentCore Identity for API key management in deployed environments.
|
|
1336
|
+
For local development, run via 'agentcore dev' which loads agentcore/.env.
|
|
1337
|
+
"""
|
|
1338
|
+
if os.getenv("LOCAL_DEV") == "1":
|
|
1339
|
+
api_key = os.getenv(IDENTITY_ENV_VAR)
|
|
1340
|
+
if not api_key:
|
|
1341
|
+
raise RuntimeError(
|
|
1342
|
+
f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
|
|
1343
|
+
)
|
|
1344
|
+
return api_key
|
|
1345
|
+
return _agentcore_identity_api_key_provider()
|
|
1346
|
+
|
|
1347
|
+
|
|
1348
|
+
def load_model() -> ChatGoogleGenerativeAI:
|
|
1349
|
+
"""Get authenticated Gemini model client."""
|
|
1350
|
+
return ChatGoogleGenerativeAI(
|
|
1351
|
+
model="gemini-2.5-flash",
|
|
1352
|
+
api_key=_get_api_key()
|
|
1353
|
+
)
|
|
1354
|
+
{{/if}}
|
|
1355
|
+
"
|
|
1356
|
+
`;
|
|
1357
|
+
|
|
1358
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/langchain_langgraph/base/pyproject.toml should match snapshot 1`] = `
|
|
1359
|
+
"[build-system]
|
|
1360
|
+
requires = ["hatchling"]
|
|
1361
|
+
build-backend = "hatchling.build"
|
|
1362
|
+
|
|
1363
|
+
[project]
|
|
1364
|
+
name = "{{ name }}"
|
|
1365
|
+
version = "0.1.0"
|
|
1366
|
+
description = "AgentCore A2A Agent using LangChain + LangGraph"
|
|
1367
|
+
readme = "README.md"
|
|
1368
|
+
requires-python = ">=3.10"
|
|
1369
|
+
dependencies = [
|
|
1370
|
+
"a2a-sdk >= 0.2.0",
|
|
1371
|
+
{{#if (eq modelProvider "Anthropic")}}"langchain-anthropic >= 0.3.0",
|
|
1372
|
+
{{/if}}{{#if (eq modelProvider "Bedrock")}}"langchain-aws >= 0.2.0",
|
|
1373
|
+
{{/if}}{{#if (eq modelProvider "Gemini")}}"langchain-google-genai >= 2.0.0",
|
|
1374
|
+
{{/if}}{{#if (eq modelProvider "OpenAI")}}"langchain-openai >= 0.2.0",
|
|
1375
|
+
{{/if}}"aws-opentelemetry-distro",
|
|
1376
|
+
"bedrock-agentcore[a2a] >= 1.0.3",
|
|
1377
|
+
"botocore[crt] >= 1.35.0",
|
|
1378
|
+
"langgraph >= 0.2.0",
|
|
1379
|
+
]
|
|
1380
|
+
|
|
1381
|
+
[tool.hatch.build.targets.wheel]
|
|
1382
|
+
packages = ["."]
|
|
1383
|
+
"
|
|
1384
|
+
`;
|
|
1385
|
+
|
|
1386
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/strands/base/README.md should match snapshot 1`] = `
|
|
1387
|
+
"# {{ name }}
|
|
1388
|
+
|
|
1389
|
+
An A2A (Agent-to-Agent) agent deployed on Amazon Bedrock AgentCore using Strands SDK.
|
|
1390
|
+
|
|
1391
|
+
## Overview
|
|
1392
|
+
|
|
1393
|
+
This agent implements the A2A protocol, enabling agent-to-agent communication. Other agents can discover and interact with this agent via the \`/.well-known/agent-card.json\` endpoint.
|
|
1394
|
+
|
|
1395
|
+
## Local Development
|
|
1396
|
+
|
|
1397
|
+
\`\`\`bash
|
|
1398
|
+
uv sync
|
|
1399
|
+
uv run python main.py
|
|
1400
|
+
\`\`\`
|
|
1401
|
+
|
|
1402
|
+
The agent starts on port 9000.
|
|
1403
|
+
|
|
1404
|
+
## Deploy
|
|
1405
|
+
|
|
1406
|
+
\`\`\`bash
|
|
1407
|
+
agentcore deploy
|
|
1408
|
+
\`\`\`
|
|
1409
|
+
"
|
|
1410
|
+
`;
|
|
1411
|
+
|
|
1412
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/strands/base/gitignore.template should match snapshot 1`] = `
|
|
1413
|
+
"# Environment variables
|
|
1414
|
+
.env
|
|
1415
|
+
|
|
1416
|
+
# Python
|
|
1417
|
+
__pycache__/
|
|
1418
|
+
*.py[cod]
|
|
1419
|
+
*$py.class
|
|
1420
|
+
*.so
|
|
1421
|
+
.Python
|
|
1422
|
+
build/
|
|
1423
|
+
develop-eggs/
|
|
1424
|
+
dist/
|
|
1425
|
+
downloads/
|
|
1426
|
+
eggs/
|
|
1427
|
+
.eggs/
|
|
1428
|
+
lib/
|
|
1429
|
+
lib64/
|
|
1430
|
+
parts/
|
|
1431
|
+
sdist/
|
|
1432
|
+
var/
|
|
1433
|
+
wheels/
|
|
1434
|
+
*.egg-info/
|
|
1435
|
+
.installed.cfg
|
|
1436
|
+
*.egg
|
|
1437
|
+
|
|
1438
|
+
# Virtual environments
|
|
1439
|
+
.venv/
|
|
1440
|
+
venv/
|
|
1441
|
+
ENV/
|
|
1442
|
+
env/
|
|
1443
|
+
|
|
1444
|
+
# IDE
|
|
1445
|
+
.vscode/
|
|
1446
|
+
.idea/
|
|
1447
|
+
*.swp
|
|
1448
|
+
*.swo
|
|
1449
|
+
*~
|
|
1450
|
+
|
|
1451
|
+
# OS
|
|
1452
|
+
.DS_Store
|
|
1453
|
+
Thumbs.db
|
|
1454
|
+
"
|
|
1455
|
+
`;
|
|
1456
|
+
|
|
1457
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/strands/base/main.py should match snapshot 1`] = `
|
|
1458
|
+
"from strands import Agent, tool
|
|
1459
|
+
from strands.multiagent.a2a.executor import StrandsA2AExecutor
|
|
1460
|
+
from bedrock_agentcore.runtime import serve_a2a
|
|
1461
|
+
from model.load import load_model
|
|
1462
|
+
{{#if hasMemory}}
|
|
1463
|
+
from memory.session import get_memory_session_manager
|
|
1464
|
+
{{/if}}
|
|
1465
|
+
|
|
1466
|
+
|
|
1467
|
+
@tool
|
|
1468
|
+
def add_numbers(a: int, b: int) -> int:
|
|
1469
|
+
"""Return the sum of two numbers."""
|
|
1470
|
+
return a + b
|
|
1471
|
+
|
|
1472
|
+
|
|
1473
|
+
tools = [add_numbers]
|
|
1474
|
+
|
|
1475
|
+
{{#if hasMemory}}
|
|
1476
|
+
def agent_factory():
|
|
1477
|
+
cache = {}
|
|
1478
|
+
def get_or_create_agent(session_id, user_id):
|
|
1479
|
+
key = f"{session_id}/{user_id}"
|
|
1480
|
+
if key not in cache:
|
|
1481
|
+
cache[key] = Agent(
|
|
1482
|
+
model=load_model(),
|
|
1483
|
+
session_manager=get_memory_session_manager(session_id, user_id),
|
|
1484
|
+
system_prompt="You are a helpful assistant. Use tools when appropriate.",
|
|
1485
|
+
tools=tools,
|
|
1486
|
+
)
|
|
1487
|
+
return cache[key]
|
|
1488
|
+
return get_or_create_agent
|
|
1489
|
+
|
|
1490
|
+
get_or_create_agent = agent_factory()
|
|
1491
|
+
agent = get_or_create_agent("default-session", "default-user")
|
|
1492
|
+
{{else}}
|
|
1493
|
+
agent = Agent(
|
|
1494
|
+
model=load_model(),
|
|
1495
|
+
system_prompt="You are a helpful assistant. Use tools when appropriate.",
|
|
1496
|
+
tools=tools,
|
|
1497
|
+
)
|
|
1498
|
+
{{/if}}
|
|
1499
|
+
|
|
1500
|
+
if __name__ == "__main__":
|
|
1501
|
+
serve_a2a(StrandsA2AExecutor(agent))
|
|
1502
|
+
"
|
|
1503
|
+
`;
|
|
1504
|
+
|
|
1505
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/strands/base/model/__init__.py should match snapshot 1`] = `
|
|
1506
|
+
"# Package marker
|
|
1507
|
+
"
|
|
1508
|
+
`;
|
|
1509
|
+
|
|
1510
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/strands/base/model/load.py should match snapshot 1`] = `
|
|
1511
|
+
"{{#if (eq modelProvider "Bedrock")}}
|
|
1512
|
+
from strands.models.bedrock import BedrockModel
|
|
1513
|
+
|
|
1514
|
+
|
|
1515
|
+
def load_model() -> BedrockModel:
|
|
1516
|
+
"""Get Bedrock model client using IAM credentials."""
|
|
1517
|
+
return BedrockModel(model_id="global.anthropic.claude-sonnet-4-5-20250929-v1:0")
|
|
1518
|
+
{{/if}}
|
|
1519
|
+
{{#if (eq modelProvider "Anthropic")}}
|
|
1520
|
+
import os
|
|
1521
|
+
|
|
1522
|
+
from strands.models.anthropic import AnthropicModel
|
|
1523
|
+
from bedrock_agentcore.identity.auth import requires_api_key
|
|
1524
|
+
|
|
1525
|
+
IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
|
|
1526
|
+
IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
|
|
1527
|
+
|
|
1528
|
+
|
|
1529
|
+
@requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
|
|
1530
|
+
def _agentcore_identity_api_key_provider(api_key: str) -> str:
|
|
1531
|
+
"""Fetch API key from AgentCore Identity."""
|
|
1532
|
+
return api_key
|
|
1533
|
+
|
|
1534
|
+
|
|
1535
|
+
def _get_api_key() -> str:
|
|
1536
|
+
"""
|
|
1537
|
+
Uses AgentCore Identity for API key management in deployed environments.
|
|
1538
|
+
For local development, run via 'agentcore dev' which loads agentcore/.env.
|
|
1539
|
+
"""
|
|
1540
|
+
if os.getenv("LOCAL_DEV") == "1":
|
|
1541
|
+
api_key = os.getenv(IDENTITY_ENV_VAR)
|
|
1542
|
+
if not api_key:
|
|
1543
|
+
raise RuntimeError(
|
|
1544
|
+
f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
|
|
1545
|
+
)
|
|
1546
|
+
return api_key
|
|
1547
|
+
return _agentcore_identity_api_key_provider()
|
|
1548
|
+
|
|
1549
|
+
|
|
1550
|
+
def load_model() -> AnthropicModel:
|
|
1551
|
+
"""Get authenticated Anthropic model client."""
|
|
1552
|
+
return AnthropicModel(
|
|
1553
|
+
client_args={"api_key": _get_api_key()},
|
|
1554
|
+
model_id="claude-sonnet-4-5-20250929",
|
|
1555
|
+
max_tokens=5000,
|
|
1556
|
+
)
|
|
1557
|
+
{{/if}}
|
|
1558
|
+
{{#if (eq modelProvider "OpenAI")}}
|
|
1559
|
+
import os
|
|
1560
|
+
|
|
1561
|
+
from strands.models.openai import OpenAIModel
|
|
1562
|
+
from bedrock_agentcore.identity.auth import requires_api_key
|
|
1563
|
+
|
|
1564
|
+
IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
|
|
1565
|
+
IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
|
|
1566
|
+
|
|
1567
|
+
|
|
1568
|
+
@requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
|
|
1569
|
+
def _agentcore_identity_api_key_provider(api_key: str) -> str:
|
|
1570
|
+
"""Fetch API key from AgentCore Identity."""
|
|
1571
|
+
return api_key
|
|
1572
|
+
|
|
1573
|
+
|
|
1574
|
+
def _get_api_key() -> str:
|
|
1575
|
+
"""
|
|
1576
|
+
Uses AgentCore Identity for API key management in deployed environments.
|
|
1577
|
+
For local development, run via 'agentcore dev' which loads agentcore/.env.
|
|
1578
|
+
"""
|
|
1579
|
+
if os.getenv("LOCAL_DEV") == "1":
|
|
1580
|
+
api_key = os.getenv(IDENTITY_ENV_VAR)
|
|
1581
|
+
if not api_key:
|
|
1582
|
+
raise RuntimeError(
|
|
1583
|
+
f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
|
|
1584
|
+
)
|
|
1585
|
+
return api_key
|
|
1586
|
+
return _agentcore_identity_api_key_provider()
|
|
1587
|
+
|
|
1588
|
+
|
|
1589
|
+
def load_model() -> OpenAIModel:
|
|
1590
|
+
"""Get authenticated OpenAI model client."""
|
|
1591
|
+
return OpenAIModel(
|
|
1592
|
+
client_args={"api_key": _get_api_key()},
|
|
1593
|
+
model_id="gpt-4.1",
|
|
1594
|
+
)
|
|
1595
|
+
{{/if}}
|
|
1596
|
+
{{#if (eq modelProvider "Gemini")}}
|
|
1597
|
+
import os
|
|
1598
|
+
|
|
1599
|
+
from strands.models.gemini import GeminiModel
|
|
1600
|
+
from bedrock_agentcore.identity.auth import requires_api_key
|
|
1601
|
+
|
|
1602
|
+
IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
|
|
1603
|
+
IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
|
|
1604
|
+
|
|
1605
|
+
|
|
1606
|
+
@requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
|
|
1607
|
+
def _agentcore_identity_api_key_provider(api_key: str) -> str:
|
|
1608
|
+
"""Fetch API key from AgentCore Identity."""
|
|
1609
|
+
return api_key
|
|
1610
|
+
|
|
1611
|
+
|
|
1612
|
+
def _get_api_key() -> str:
|
|
1613
|
+
"""
|
|
1614
|
+
Uses AgentCore Identity for API key management in deployed environments.
|
|
1615
|
+
For local development, run via 'agentcore dev' which loads agentcore/.env.
|
|
1616
|
+
"""
|
|
1617
|
+
if os.getenv("LOCAL_DEV") == "1":
|
|
1618
|
+
api_key = os.getenv(IDENTITY_ENV_VAR)
|
|
1619
|
+
if not api_key:
|
|
1620
|
+
raise RuntimeError(
|
|
1621
|
+
f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
|
|
1622
|
+
)
|
|
1623
|
+
return api_key
|
|
1624
|
+
return _agentcore_identity_api_key_provider()
|
|
1625
|
+
|
|
1626
|
+
|
|
1627
|
+
def load_model() -> GeminiModel:
|
|
1628
|
+
"""Get authenticated Gemini model client."""
|
|
1629
|
+
return GeminiModel(
|
|
1630
|
+
client_args={"api_key": _get_api_key()},
|
|
1631
|
+
model_id="gemini-2.5-flash",
|
|
1632
|
+
)
|
|
1633
|
+
{{/if}}
|
|
1634
|
+
"
|
|
1635
|
+
`;
|
|
1636
|
+
|
|
1637
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/strands/base/pyproject.toml should match snapshot 1`] = `
|
|
1638
|
+
"[build-system]
|
|
1639
|
+
requires = ["hatchling"]
|
|
1640
|
+
build-backend = "hatchling.build"
|
|
1641
|
+
|
|
1642
|
+
[project]
|
|
1643
|
+
name = "{{ name }}"
|
|
1644
|
+
version = "0.1.0"
|
|
1645
|
+
description = "AgentCore A2A Agent using Strands SDK"
|
|
1646
|
+
readme = "README.md"
|
|
1647
|
+
requires-python = ">=3.10"
|
|
1648
|
+
dependencies = [
|
|
1649
|
+
{{#if (eq modelProvider "Anthropic")}}"anthropic >= 0.30.0",
|
|
1650
|
+
{{/if}}"a2a-sdk[all] >= 0.2.0",
|
|
1651
|
+
"aws-opentelemetry-distro",
|
|
1652
|
+
"bedrock-agentcore[a2a] >= 1.0.3",
|
|
1653
|
+
"botocore[crt] >= 1.35.0",
|
|
1654
|
+
{{#if (eq modelProvider "Gemini")}}"google-genai >= 1.0.0",
|
|
1655
|
+
{{/if}}{{#if (eq modelProvider "OpenAI")}}"openai >= 1.0.0",
|
|
1656
|
+
{{/if}}"strands-agents >= 1.13.0",
|
|
1657
|
+
]
|
|
1658
|
+
|
|
1659
|
+
[tool.hatch.build.targets.wheel]
|
|
1660
|
+
packages = ["."]
|
|
1661
|
+
"
|
|
1662
|
+
`;
|
|
1663
|
+
|
|
1664
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/strands/capabilities/memory/__init__.py should match snapshot 1`] = `
|
|
1665
|
+
"# Package marker
|
|
1666
|
+
"
|
|
1667
|
+
`;
|
|
1668
|
+
|
|
1669
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/strands/capabilities/memory/session.py should match snapshot 1`] = `
|
|
1670
|
+
"import os
|
|
1671
|
+
from typing import Optional
|
|
1672
|
+
|
|
1673
|
+
from bedrock_agentcore.memory.integrations.strands.config import AgentCoreMemoryConfig{{#if memoryProviders.[0].strategies.length}}, RetrievalConfig{{/if}}
|
|
1674
|
+
from bedrock_agentcore.memory.integrations.strands.session_manager import AgentCoreMemorySessionManager
|
|
1675
|
+
|
|
1676
|
+
MEMORY_ID = os.getenv("{{memoryProviders.[0].envVarName}}")
|
|
1677
|
+
REGION = os.getenv("AWS_REGION")
|
|
1678
|
+
|
|
1679
|
+
def get_memory_session_manager(session_id: str, actor_id: str) -> Optional[AgentCoreMemorySessionManager]:
|
|
1680
|
+
if not MEMORY_ID:
|
|
1681
|
+
return None
|
|
1682
|
+
|
|
1683
|
+
{{#if memoryProviders.[0].strategies.length}}
|
|
1684
|
+
retrieval_config = {
|
|
1685
|
+
{{#if (includes memoryProviders.[0].strategies "SEMANTIC")}}
|
|
1686
|
+
f"/users/{actor_id}/facts": RetrievalConfig(top_k=3, relevance_score=0.5),
|
|
1687
|
+
{{/if}}
|
|
1688
|
+
{{#if (includes memoryProviders.[0].strategies "USER_PREFERENCE")}}
|
|
1689
|
+
f"/users/{actor_id}/preferences": RetrievalConfig(top_k=3, relevance_score=0.5),
|
|
1690
|
+
{{/if}}
|
|
1691
|
+
{{#if (includes memoryProviders.[0].strategies "SUMMARIZATION")}}
|
|
1692
|
+
f"/summaries/{actor_id}/{session_id}": RetrievalConfig(top_k=3, relevance_score=0.5),
|
|
1693
|
+
{{/if}}
|
|
1694
|
+
}
|
|
1695
|
+
{{/if}}
|
|
1696
|
+
|
|
1697
|
+
return AgentCoreMemorySessionManager(
|
|
1698
|
+
AgentCoreMemoryConfig(
|
|
1699
|
+
memory_id=MEMORY_ID,
|
|
1700
|
+
session_id=session_id,
|
|
1701
|
+
actor_id=actor_id,
|
|
1702
|
+
{{#if memoryProviders.[0].strategies.length}}
|
|
1703
|
+
retrieval_config=retrieval_config,
|
|
1704
|
+
{{/if}}
|
|
1705
|
+
),
|
|
1706
|
+
REGION
|
|
1707
|
+
)
|
|
1708
|
+
"
|
|
1709
|
+
`;
|
|
1710
|
+
|
|
1711
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/autogen/base/README.md should match snapshot 1`] = `
|
|
865
1712
|
"This is a project generated by the agentcore create CLI tool!
|
|
866
1713
|
|
|
867
1714
|
# Layout
|
|
@@ -904,7 +1751,7 @@ Use \`agentcore invoke\` to invoke your deployed agent.
|
|
|
904
1751
|
"
|
|
905
1752
|
`;
|
|
906
1753
|
|
|
907
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/autogen/base/gitignore.template should match snapshot 1`] = `
|
|
1754
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/autogen/base/gitignore.template should match snapshot 1`] = `
|
|
908
1755
|
"# Environment variables
|
|
909
1756
|
.env
|
|
910
1757
|
|
|
@@ -949,7 +1796,7 @@ Thumbs.db
|
|
|
949
1796
|
"
|
|
950
1797
|
`;
|
|
951
1798
|
|
|
952
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/autogen/base/main.py should match snapshot 1`] = `
|
|
1799
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/autogen/base/main.py should match snapshot 1`] = `
|
|
953
1800
|
"import os
|
|
954
1801
|
from autogen_agentchat.agents import AssistantAgent
|
|
955
1802
|
from autogen_core.tools import FunctionTool
|
|
@@ -1005,13 +1852,22 @@ if __name__ == "__main__":
|
|
|
1005
1852
|
"
|
|
1006
1853
|
`;
|
|
1007
1854
|
|
|
1008
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/autogen/base/mcp_client/__init__.py should match snapshot 1`] = `
|
|
1855
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/autogen/base/mcp_client/__init__.py should match snapshot 1`] = `
|
|
1009
1856
|
"# Package marker
|
|
1010
1857
|
"
|
|
1011
1858
|
`;
|
|
1012
1859
|
|
|
1013
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/autogen/base/mcp_client/client.py should match snapshot 1`] = `
|
|
1860
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/autogen/base/mcp_client/client.py should match snapshot 1`] = `
|
|
1014
1861
|
"from typing import List
|
|
1862
|
+
{{#if isVpc}}
|
|
1863
|
+
# VPC mode: external MCP endpoints are not reachable without a NAT gateway.
|
|
1864
|
+
# Add an AgentCore Gateway with \`agentcore add gateway\`, or configure your own endpoint below.
|
|
1865
|
+
|
|
1866
|
+
|
|
1867
|
+
async def get_streamable_http_mcp_tools() -> List:
|
|
1868
|
+
"""No MCP server configured. Add a gateway with \`agentcore add gateway\`."""
|
|
1869
|
+
return []
|
|
1870
|
+
{{else}}
|
|
1015
1871
|
from autogen_ext.tools.mcp import (
|
|
1016
1872
|
StreamableHttpMcpToolAdapter,
|
|
1017
1873
|
StreamableHttpServerParams,
|
|
@@ -1029,15 +1885,16 @@ async def get_streamable_http_mcp_tools() -> List[StreamableHttpMcpToolAdapter]:
|
|
|
1029
1885
|
# to use an MCP server that supports bearer authentication, add headers={"Authorization": f"Bearer {access_token}"}
|
|
1030
1886
|
server_params = StreamableHttpServerParams(url=EXAMPLE_MCP_ENDPOINT)
|
|
1031
1887
|
return await mcp_server_tools(server_params)
|
|
1888
|
+
{{/if}}
|
|
1032
1889
|
"
|
|
1033
1890
|
`;
|
|
1034
1891
|
|
|
1035
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/autogen/base/model/__init__.py should match snapshot 1`] = `
|
|
1892
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/autogen/base/model/__init__.py should match snapshot 1`] = `
|
|
1036
1893
|
"# Package marker
|
|
1037
1894
|
"
|
|
1038
1895
|
`;
|
|
1039
1896
|
|
|
1040
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/autogen/base/model/load.py should match snapshot 1`] = `
|
|
1897
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/autogen/base/model/load.py should match snapshot 1`] = `
|
|
1041
1898
|
"{{#if (eq modelProvider "Bedrock")}}
|
|
1042
1899
|
import os
|
|
1043
1900
|
from autogen_ext.models.anthropic import AnthropicBedrockChatCompletionClient
|
|
@@ -1177,7 +2034,7 @@ def load_model() -> OpenAIChatCompletionClient:
|
|
|
1177
2034
|
"
|
|
1178
2035
|
`;
|
|
1179
2036
|
|
|
1180
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/autogen/base/pyproject.toml should match snapshot 1`] = `
|
|
2037
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/autogen/base/pyproject.toml should match snapshot 1`] = `
|
|
1181
2038
|
"[build-system]
|
|
1182
2039
|
requires = ["hatchling"]
|
|
1183
2040
|
build-backend = "hatchling.build"
|
|
@@ -1215,7 +2072,7 @@ packages = ["."]
|
|
|
1215
2072
|
"
|
|
1216
2073
|
`;
|
|
1217
2074
|
|
|
1218
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/crewai/base/README.md should match snapshot 1`] = `
|
|
2075
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/crewai/base/README.md should match snapshot 1`] = `
|
|
1219
2076
|
"This is a project generated by the agentcore create CLI tool!
|
|
1220
2077
|
|
|
1221
2078
|
# Layout
|
|
@@ -1258,7 +2115,7 @@ Use \`agentcore invoke\` to invoke your deployed agent.
|
|
|
1258
2115
|
"
|
|
1259
2116
|
`;
|
|
1260
2117
|
|
|
1261
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/crewai/base/gitignore.template should match snapshot 1`] = `
|
|
2118
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/crewai/base/gitignore.template should match snapshot 1`] = `
|
|
1262
2119
|
"# Environment variables
|
|
1263
2120
|
.env
|
|
1264
2121
|
|
|
@@ -1303,7 +2160,7 @@ Thumbs.db
|
|
|
1303
2160
|
"
|
|
1304
2161
|
`;
|
|
1305
2162
|
|
|
1306
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/crewai/base/main.py should match snapshot 1`] = `
|
|
2163
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/crewai/base/main.py should match snapshot 1`] = `
|
|
1307
2164
|
"from crewai import Agent, Crew, Task, Process
|
|
1308
2165
|
from crewai.tools import tool
|
|
1309
2166
|
from bedrock_agentcore.runtime import BedrockAgentCoreApp
|
|
@@ -1362,12 +2219,12 @@ if __name__ == "__main__":
|
|
|
1362
2219
|
"
|
|
1363
2220
|
`;
|
|
1364
2221
|
|
|
1365
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/crewai/base/model/__init__.py should match snapshot 1`] = `
|
|
2222
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/crewai/base/model/__init__.py should match snapshot 1`] = `
|
|
1366
2223
|
"# Package marker
|
|
1367
2224
|
"
|
|
1368
2225
|
`;
|
|
1369
2226
|
|
|
1370
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/crewai/base/model/load.py should match snapshot 1`] = `
|
|
2227
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/crewai/base/model/load.py should match snapshot 1`] = `
|
|
1371
2228
|
"{{#if (eq modelProvider "Bedrock")}}
|
|
1372
2229
|
from crewai import LLM
|
|
1373
2230
|
|
|
@@ -1504,7 +2361,7 @@ def load_model() -> LLM:
|
|
|
1504
2361
|
"
|
|
1505
2362
|
`;
|
|
1506
2363
|
|
|
1507
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/crewai/base/pyproject.toml should match snapshot 1`] = `
|
|
2364
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/crewai/base/pyproject.toml should match snapshot 1`] = `
|
|
1508
2365
|
"[build-system]
|
|
1509
2366
|
requires = ["hatchling"]
|
|
1510
2367
|
build-backend = "hatchling.build"
|
|
@@ -1539,7 +2396,7 @@ packages = ["."]
|
|
|
1539
2396
|
"
|
|
1540
2397
|
`;
|
|
1541
2398
|
|
|
1542
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/googleadk/base/README.md should match snapshot 1`] = `
|
|
2399
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/googleadk/base/README.md should match snapshot 1`] = `
|
|
1543
2400
|
"This is a project generated by the agentcore create CLI tool!
|
|
1544
2401
|
|
|
1545
2402
|
# Layout
|
|
@@ -1582,7 +2439,7 @@ Use \`agentcore invoke\` to invoke your deployed agent.
|
|
|
1582
2439
|
"
|
|
1583
2440
|
`;
|
|
1584
2441
|
|
|
1585
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/googleadk/base/gitignore.template should match snapshot 1`] = `
|
|
2442
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/googleadk/base/gitignore.template should match snapshot 1`] = `
|
|
1586
2443
|
"# Environment variables
|
|
1587
2444
|
.env
|
|
1588
2445
|
|
|
@@ -1627,7 +2484,7 @@ Thumbs.db
|
|
|
1627
2484
|
"
|
|
1628
2485
|
`;
|
|
1629
2486
|
|
|
1630
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/googleadk/base/main.py should match snapshot 1`] = `
|
|
2487
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/googleadk/base/main.py should match snapshot 1`] = `
|
|
1631
2488
|
"import os
|
|
1632
2489
|
from google.adk.agents import Agent
|
|
1633
2490
|
from google.adk.runners import Runner
|
|
@@ -1731,12 +2588,12 @@ if __name__ == "__main__":
|
|
|
1731
2588
|
"
|
|
1732
2589
|
`;
|
|
1733
2590
|
|
|
1734
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/googleadk/base/mcp_client/__init__.py should match snapshot 1`] = `
|
|
2591
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/googleadk/base/mcp_client/__init__.py should match snapshot 1`] = `
|
|
1735
2592
|
"# Package marker
|
|
1736
2593
|
"
|
|
1737
2594
|
`;
|
|
1738
2595
|
|
|
1739
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/googleadk/base/mcp_client/client.py should match snapshot 1`] = `
|
|
2596
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/googleadk/base/mcp_client/client.py should match snapshot 1`] = `
|
|
1740
2597
|
"import os
|
|
1741
2598
|
import logging
|
|
1742
2599
|
from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset
|
|
@@ -1792,6 +2649,14 @@ def get_all_gateway_mcp_toolsets() -> list[MCPToolset]:
|
|
|
1792
2649
|
{{/each}}
|
|
1793
2650
|
return toolsets
|
|
1794
2651
|
{{else}}
|
|
2652
|
+
{{#if isVpc}}
|
|
2653
|
+
# VPC mode: external MCP endpoints are not reachable without a NAT gateway.
|
|
2654
|
+
# Add an AgentCore Gateway with \`agentcore add gateway\`, or configure your own endpoint below.
|
|
2655
|
+
|
|
2656
|
+
def get_streamable_http_mcp_client() -> MCPToolset | None:
|
|
2657
|
+
"""No MCP server configured. Add a gateway with \`agentcore add gateway\`."""
|
|
2658
|
+
return None
|
|
2659
|
+
{{else}}
|
|
1795
2660
|
# ExaAI provides information about code through web searches, crawling and code context searches through their platform. Requires no authentication
|
|
1796
2661
|
EXAMPLE_MCP_ENDPOINT = "https://mcp.exa.ai/mcp"
|
|
1797
2662
|
|
|
@@ -1803,15 +2668,16 @@ def get_streamable_http_mcp_client() -> MCPToolset:
|
|
|
1803
2668
|
connection_params=StreamableHTTPConnectionParams(url=EXAMPLE_MCP_ENDPOINT)
|
|
1804
2669
|
)
|
|
1805
2670
|
{{/if}}
|
|
2671
|
+
{{/if}}
|
|
1806
2672
|
"
|
|
1807
2673
|
`;
|
|
1808
2674
|
|
|
1809
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/googleadk/base/model/__init__.py should match snapshot 1`] = `
|
|
2675
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/googleadk/base/model/__init__.py should match snapshot 1`] = `
|
|
1810
2676
|
"# Package marker
|
|
1811
2677
|
"
|
|
1812
2678
|
`;
|
|
1813
2679
|
|
|
1814
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/googleadk/base/model/load.py should match snapshot 1`] = `
|
|
2680
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/googleadk/base/model/load.py should match snapshot 1`] = `
|
|
1815
2681
|
"import os
|
|
1816
2682
|
from bedrock_agentcore.identity.auth import requires_api_key
|
|
1817
2683
|
|
|
@@ -1856,7 +2722,7 @@ def load_model() -> None:
|
|
|
1856
2722
|
"
|
|
1857
2723
|
`;
|
|
1858
2724
|
|
|
1859
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/googleadk/base/pyproject.toml should match snapshot 1`] = `
|
|
2725
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/googleadk/base/pyproject.toml should match snapshot 1`] = `
|
|
1860
2726
|
"[build-system]
|
|
1861
2727
|
requires = ["hatchling"]
|
|
1862
2728
|
build-backend = "hatchling.build"
|
|
@@ -1882,7 +2748,7 @@ packages = ["."]
|
|
|
1882
2748
|
"
|
|
1883
2749
|
`;
|
|
1884
2750
|
|
|
1885
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/langchain_langgraph/base/README.md should match snapshot 1`] = `
|
|
2751
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/langchain_langgraph/base/README.md should match snapshot 1`] = `
|
|
1886
2752
|
"This is a project generated by the agentcore create CLI tool!
|
|
1887
2753
|
|
|
1888
2754
|
# Layout
|
|
@@ -1925,7 +2791,7 @@ Use \`agentcore invoke\` to invoke your deployed agent.
|
|
|
1925
2791
|
"
|
|
1926
2792
|
`;
|
|
1927
2793
|
|
|
1928
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/langchain_langgraph/base/gitignore.template should match snapshot 1`] = `
|
|
2794
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/langchain_langgraph/base/gitignore.template should match snapshot 1`] = `
|
|
1929
2795
|
"# Environment variables
|
|
1930
2796
|
.env
|
|
1931
2797
|
|
|
@@ -1970,7 +2836,7 @@ Thumbs.db
|
|
|
1970
2836
|
"
|
|
1971
2837
|
`;
|
|
1972
2838
|
|
|
1973
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/langchain_langgraph/base/main.py should match snapshot 1`] = `
|
|
2839
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/langchain_langgraph/base/main.py should match snapshot 1`] = `
|
|
1974
2840
|
"import os
|
|
1975
2841
|
from langchain_core.messages import HumanMessage
|
|
1976
2842
|
from langgraph.prebuilt import create_react_agent
|
|
@@ -2040,12 +2906,12 @@ if __name__ == "__main__":
|
|
|
2040
2906
|
"
|
|
2041
2907
|
`;
|
|
2042
2908
|
|
|
2043
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/langchain_langgraph/base/mcp_client/__init__.py should match snapshot 1`] = `
|
|
2909
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/langchain_langgraph/base/mcp_client/__init__.py should match snapshot 1`] = `
|
|
2044
2910
|
"# Package marker
|
|
2045
2911
|
"
|
|
2046
2912
|
`;
|
|
2047
2913
|
|
|
2048
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/langchain_langgraph/base/mcp_client/client.py should match snapshot 1`] = `
|
|
2914
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/langchain_langgraph/base/mcp_client/client.py should match snapshot 1`] = `
|
|
2049
2915
|
"import os
|
|
2050
2916
|
import logging
|
|
2051
2917
|
from langchain_mcp_adapters.client import MultiServerMCPClient
|
|
@@ -2098,6 +2964,14 @@ def get_all_gateway_mcp_client() -> MultiServerMCPClient | None:
|
|
|
2098
2964
|
return None
|
|
2099
2965
|
return MultiServerMCPClient(servers)
|
|
2100
2966
|
{{else}}
|
|
2967
|
+
{{#if isVpc}}
|
|
2968
|
+
# VPC mode: external MCP endpoints are not reachable without a NAT gateway.
|
|
2969
|
+
# Add an AgentCore Gateway with \`agentcore add gateway\`, or configure your own endpoint below.
|
|
2970
|
+
|
|
2971
|
+
def get_streamable_http_mcp_client() -> MultiServerMCPClient | None:
|
|
2972
|
+
"""No MCP server configured. Add a gateway with \`agentcore add gateway\`."""
|
|
2973
|
+
return None
|
|
2974
|
+
{{else}}
|
|
2101
2975
|
# ExaAI provides information about code through web searches, crawling and code context searches through their platform. Requires no authentication
|
|
2102
2976
|
EXAMPLE_MCP_ENDPOINT = "https://mcp.exa.ai/mcp"
|
|
2103
2977
|
|
|
@@ -2114,15 +2988,16 @@ def get_streamable_http_mcp_client() -> MultiServerMCPClient:
|
|
|
2114
2988
|
}
|
|
2115
2989
|
)
|
|
2116
2990
|
{{/if}}
|
|
2991
|
+
{{/if}}
|
|
2117
2992
|
"
|
|
2118
2993
|
`;
|
|
2119
2994
|
|
|
2120
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/langchain_langgraph/base/model/__init__.py should match snapshot 1`] = `
|
|
2995
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/langchain_langgraph/base/model/__init__.py should match snapshot 1`] = `
|
|
2121
2996
|
"# Package marker
|
|
2122
2997
|
"
|
|
2123
2998
|
`;
|
|
2124
2999
|
|
|
2125
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/langchain_langgraph/base/model/load.py should match snapshot 1`] = `
|
|
3000
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/langchain_langgraph/base/model/load.py should match snapshot 1`] = `
|
|
2126
3001
|
"{{#if (eq modelProvider "Bedrock")}}
|
|
2127
3002
|
from langchain_aws import ChatBedrock
|
|
2128
3003
|
|
|
@@ -2249,7 +3124,7 @@ def load_model() -> ChatGoogleGenerativeAI:
|
|
|
2249
3124
|
"
|
|
2250
3125
|
`;
|
|
2251
3126
|
|
|
2252
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/langchain_langgraph/base/pyproject.toml should match snapshot 1`] = `
|
|
3127
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/langchain_langgraph/base/pyproject.toml should match snapshot 1`] = `
|
|
2253
3128
|
"[build-system]
|
|
2254
3129
|
requires = ["hatchling"]
|
|
2255
3130
|
build-backend = "hatchling.build"
|
|
@@ -2290,7 +3165,7 @@ packages = ["."]
|
|
|
2290
3165
|
"
|
|
2291
3166
|
`;
|
|
2292
3167
|
|
|
2293
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/openaiagents/base/README.md should match snapshot 1`] = `
|
|
3168
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/openaiagents/base/README.md should match snapshot 1`] = `
|
|
2294
3169
|
"This is a project generated by the agentcore create CLI tool!
|
|
2295
3170
|
|
|
2296
3171
|
# Layout
|
|
@@ -2333,7 +3208,7 @@ Use \`agentcore invoke\` to invoke your deployed agent.
|
|
|
2333
3208
|
"
|
|
2334
3209
|
`;
|
|
2335
3210
|
|
|
2336
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/openaiagents/base/gitignore.template should match snapshot 1`] = `
|
|
3211
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/openaiagents/base/gitignore.template should match snapshot 1`] = `
|
|
2337
3212
|
"# Environment variables
|
|
2338
3213
|
.env
|
|
2339
3214
|
|
|
@@ -2378,7 +3253,7 @@ Thumbs.db
|
|
|
2378
3253
|
"
|
|
2379
3254
|
`;
|
|
2380
3255
|
|
|
2381
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/openaiagents/base/main.py should match snapshot 1`] = `
|
|
3256
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/openaiagents/base/main.py should match snapshot 1`] = `
|
|
2382
3257
|
"import os
|
|
2383
3258
|
from agents import Agent, Runner, function_tool
|
|
2384
3259
|
from bedrock_agentcore.runtime import BedrockAgentCoreApp
|
|
@@ -2485,12 +3360,12 @@ if __name__ == "__main__":
|
|
|
2485
3360
|
"
|
|
2486
3361
|
`;
|
|
2487
3362
|
|
|
2488
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/openaiagents/base/mcp_client/__init__.py should match snapshot 1`] = `
|
|
3363
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/openaiagents/base/mcp_client/__init__.py should match snapshot 1`] = `
|
|
2489
3364
|
"# Package marker
|
|
2490
3365
|
"
|
|
2491
3366
|
`;
|
|
2492
3367
|
|
|
2493
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/openaiagents/base/mcp_client/client.py should match snapshot 1`] = `
|
|
3368
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/openaiagents/base/mcp_client/client.py should match snapshot 1`] = `
|
|
2494
3369
|
"import os
|
|
2495
3370
|
import logging
|
|
2496
3371
|
from agents.mcp import MCPServerStreamableHttp
|
|
@@ -2545,6 +3420,14 @@ def get_all_gateway_mcp_servers() -> list[MCPServerStreamableHttp]:
|
|
|
2545
3420
|
{{/each}}
|
|
2546
3421
|
return servers
|
|
2547
3422
|
{{else}}
|
|
3423
|
+
{{#if isVpc}}
|
|
3424
|
+
# VPC mode: external MCP endpoints are not reachable without a NAT gateway.
|
|
3425
|
+
# Add an AgentCore Gateway with \`agentcore add gateway\`, or configure your own endpoint below.
|
|
3426
|
+
|
|
3427
|
+
def get_streamable_http_mcp_client() -> MCPServerStreamableHttp | None:
|
|
3428
|
+
"""No MCP server configured. Add a gateway with \`agentcore add gateway\`."""
|
|
3429
|
+
return None
|
|
3430
|
+
{{else}}
|
|
2548
3431
|
# ExaAI provides information about code through web searches, crawling and code context searches through their platform. Requires no authentication
|
|
2549
3432
|
EXAMPLE_MCP_ENDPOINT = "https://mcp.exa.ai/mcp"
|
|
2550
3433
|
|
|
@@ -2556,15 +3439,16 @@ def get_streamable_http_mcp_client() -> MCPServerStreamableHttp:
|
|
|
2556
3439
|
name="AgentCore Gateway MCP", params={"url": EXAMPLE_MCP_ENDPOINT}
|
|
2557
3440
|
)
|
|
2558
3441
|
{{/if}}
|
|
3442
|
+
{{/if}}
|
|
2559
3443
|
"
|
|
2560
3444
|
`;
|
|
2561
3445
|
|
|
2562
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/openaiagents/base/model/__init__.py should match snapshot 1`] = `
|
|
3446
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/openaiagents/base/model/__init__.py should match snapshot 1`] = `
|
|
2563
3447
|
"# Package marker
|
|
2564
3448
|
"
|
|
2565
3449
|
`;
|
|
2566
3450
|
|
|
2567
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/openaiagents/base/model/load.py should match snapshot 1`] = `
|
|
3451
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/openaiagents/base/model/load.py should match snapshot 1`] = `
|
|
2568
3452
|
"import os
|
|
2569
3453
|
from bedrock_agentcore.identity.auth import requires_api_key
|
|
2570
3454
|
|
|
@@ -2605,7 +3489,7 @@ def load_model() -> None:
|
|
|
2605
3489
|
"
|
|
2606
3490
|
`;
|
|
2607
3491
|
|
|
2608
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/openaiagents/base/pyproject.toml should match snapshot 1`] = `
|
|
3492
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/openaiagents/base/pyproject.toml should match snapshot 1`] = `
|
|
2609
3493
|
"[build-system]
|
|
2610
3494
|
requires = ["hatchling"]
|
|
2611
3495
|
build-backend = "hatchling.build"
|
|
@@ -2630,7 +3514,7 @@ packages = ["."]
|
|
|
2630
3514
|
"
|
|
2631
3515
|
`;
|
|
2632
3516
|
|
|
2633
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/strands/base/README.md should match snapshot 1`] = `
|
|
3517
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/strands/base/README.md should match snapshot 1`] = `
|
|
2634
3518
|
"This is a project generated by the AgentCore CLI!
|
|
2635
3519
|
|
|
2636
3520
|
# Layout
|
|
@@ -2673,7 +3557,7 @@ Use \`agentcore invoke\` to invoke your deployed agent.
|
|
|
2673
3557
|
"
|
|
2674
3558
|
`;
|
|
2675
3559
|
|
|
2676
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/strands/base/gitignore.template should match snapshot 1`] = `
|
|
3560
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/strands/base/gitignore.template should match snapshot 1`] = `
|
|
2677
3561
|
"# Environment variables
|
|
2678
3562
|
.env
|
|
2679
3563
|
|
|
@@ -2717,7 +3601,7 @@ env/
|
|
|
2717
3601
|
Thumbs.db"
|
|
2718
3602
|
`;
|
|
2719
3603
|
|
|
2720
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/strands/base/main.py should match snapshot 1`] = `
|
|
3604
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/strands/base/main.py should match snapshot 1`] = `
|
|
2721
3605
|
"from strands import Agent, tool
|
|
2722
3606
|
from bedrock_agentcore.runtime import BedrockAgentCoreApp
|
|
2723
3607
|
from model.load import load_model
|
|
@@ -2817,12 +3701,12 @@ if __name__ == "__main__":
|
|
|
2817
3701
|
"
|
|
2818
3702
|
`;
|
|
2819
3703
|
|
|
2820
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/strands/base/mcp_client/__init__.py should match snapshot 1`] = `
|
|
3704
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/strands/base/mcp_client/__init__.py should match snapshot 1`] = `
|
|
2821
3705
|
"# Package marker
|
|
2822
3706
|
"
|
|
2823
3707
|
`;
|
|
2824
3708
|
|
|
2825
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/strands/base/mcp_client/client.py should match snapshot 1`] = `
|
|
3709
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/strands/base/mcp_client/client.py should match snapshot 1`] = `
|
|
2826
3710
|
"import os
|
|
2827
3711
|
import logging
|
|
2828
3712
|
from mcp.client.streamable_http import streamablehttp_client
|
|
@@ -2879,6 +3763,14 @@ def get_all_gateway_mcp_clients() -> list[MCPClient]:
|
|
|
2879
3763
|
{{/each}}
|
|
2880
3764
|
return clients
|
|
2881
3765
|
{{else}}
|
|
3766
|
+
{{#if isVpc}}
|
|
3767
|
+
# VPC mode: external MCP endpoints are not reachable without a NAT gateway.
|
|
3768
|
+
# Add an AgentCore Gateway with \`agentcore add gateway\`, or configure your own endpoint below.
|
|
3769
|
+
|
|
3770
|
+
def get_streamable_http_mcp_client() -> MCPClient | None:
|
|
3771
|
+
"""No MCP server configured. Add a gateway with \`agentcore add gateway\`."""
|
|
3772
|
+
return None
|
|
3773
|
+
{{else}}
|
|
2882
3774
|
# ExaAI provides information about code through web searches, crawling and code context searches through their platform. Requires no authentication
|
|
2883
3775
|
EXAMPLE_MCP_ENDPOINT = "https://mcp.exa.ai/mcp"
|
|
2884
3776
|
|
|
@@ -2887,15 +3779,16 @@ def get_streamable_http_mcp_client() -> MCPClient:
|
|
|
2887
3779
|
# to use an MCP server that supports bearer authentication, add headers={"Authorization": f"Bearer {access_token}"}
|
|
2888
3780
|
return MCPClient(lambda: streamablehttp_client(EXAMPLE_MCP_ENDPOINT))
|
|
2889
3781
|
{{/if}}
|
|
3782
|
+
{{/if}}
|
|
2890
3783
|
"
|
|
2891
3784
|
`;
|
|
2892
3785
|
|
|
2893
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/strands/base/model/__init__.py should match snapshot 1`] = `
|
|
3786
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/strands/base/model/__init__.py should match snapshot 1`] = `
|
|
2894
3787
|
"# Package marker
|
|
2895
3788
|
"
|
|
2896
3789
|
`;
|
|
2897
3790
|
|
|
2898
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/strands/base/model/load.py should match snapshot 1`] = `
|
|
3791
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/strands/base/model/load.py should match snapshot 1`] = `
|
|
2899
3792
|
"{{#if (eq modelProvider "Bedrock")}}
|
|
2900
3793
|
from strands.models.bedrock import BedrockModel
|
|
2901
3794
|
|
|
@@ -3022,7 +3915,7 @@ def load_model() -> GeminiModel:
|
|
|
3022
3915
|
"
|
|
3023
3916
|
`;
|
|
3024
3917
|
|
|
3025
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/strands/base/pyproject.toml should match snapshot 1`] = `
|
|
3918
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/strands/base/pyproject.toml should match snapshot 1`] = `
|
|
3026
3919
|
"[build-system]
|
|
3027
3920
|
requires = ["hatchling"]
|
|
3028
3921
|
build-backend = "hatchling.build"
|
|
@@ -3051,12 +3944,12 @@ packages = ["."]
|
|
|
3051
3944
|
"
|
|
3052
3945
|
`;
|
|
3053
3946
|
|
|
3054
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/strands/capabilities/memory/__init__.py should match snapshot 1`] = `
|
|
3947
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/strands/capabilities/memory/__init__.py should match snapshot 1`] = `
|
|
3055
3948
|
"# Package marker
|
|
3056
3949
|
"
|
|
3057
3950
|
`;
|
|
3058
3951
|
|
|
3059
|
-
exports[`Assets Directory Snapshots > Python framework assets > python/python/strands/capabilities/memory/session.py should match snapshot 1`] = `
|
|
3952
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/http/strands/capabilities/memory/session.py should match snapshot 1`] = `
|
|
3060
3953
|
"import os
|
|
3061
3954
|
from typing import Optional
|
|
3062
3955
|
|
|
@@ -3099,6 +3992,140 @@ def get_memory_session_manager(session_id: str, actor_id: str) -> Optional[Agent
|
|
|
3099
3992
|
"
|
|
3100
3993
|
`;
|
|
3101
3994
|
|
|
3995
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/mcp/standalone/base/README.md should match snapshot 1`] = `
|
|
3996
|
+
"# {{ name }}
|
|
3997
|
+
|
|
3998
|
+
An MCP (Model Context Protocol) server deployed on Amazon Bedrock AgentCore.
|
|
3999
|
+
|
|
4000
|
+
## Overview
|
|
4001
|
+
|
|
4002
|
+
This project implements an MCP server using FastMCP. MCP servers expose tools that can be consumed by MCP clients (other agents or applications).
|
|
4003
|
+
|
|
4004
|
+
## Local Development
|
|
4005
|
+
|
|
4006
|
+
\`\`\`bash
|
|
4007
|
+
# Install dependencies
|
|
4008
|
+
uv sync
|
|
4009
|
+
|
|
4010
|
+
# Run the MCP server locally
|
|
4011
|
+
uv run python main.py
|
|
4012
|
+
\`\`\`
|
|
4013
|
+
|
|
4014
|
+
The server starts on port 8000 with Streamable HTTP transport.
|
|
4015
|
+
|
|
4016
|
+
## Adding Tools
|
|
4017
|
+
|
|
4018
|
+
Define tools using the \`@mcp.tool()\` decorator in \`main.py\`:
|
|
4019
|
+
|
|
4020
|
+
\`\`\`python
|
|
4021
|
+
@mcp.tool()
|
|
4022
|
+
def my_tool(param: str) -> str:
|
|
4023
|
+
"""Description of what the tool does."""
|
|
4024
|
+
return f"Result: {param}"
|
|
4025
|
+
\`\`\`
|
|
4026
|
+
|
|
4027
|
+
## Deploy
|
|
4028
|
+
|
|
4029
|
+
\`\`\`bash
|
|
4030
|
+
agentcore deploy
|
|
4031
|
+
\`\`\`
|
|
4032
|
+
"
|
|
4033
|
+
`;
|
|
4034
|
+
|
|
4035
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/mcp/standalone/base/gitignore.template should match snapshot 1`] = `
|
|
4036
|
+
"# Environment variables
|
|
4037
|
+
.env
|
|
4038
|
+
|
|
4039
|
+
# Python
|
|
4040
|
+
__pycache__/
|
|
4041
|
+
*.py[cod]
|
|
4042
|
+
*$py.class
|
|
4043
|
+
*.so
|
|
4044
|
+
.Python
|
|
4045
|
+
build/
|
|
4046
|
+
develop-eggs/
|
|
4047
|
+
dist/
|
|
4048
|
+
downloads/
|
|
4049
|
+
eggs/
|
|
4050
|
+
.eggs/
|
|
4051
|
+
lib/
|
|
4052
|
+
lib64/
|
|
4053
|
+
parts/
|
|
4054
|
+
sdist/
|
|
4055
|
+
var/
|
|
4056
|
+
wheels/
|
|
4057
|
+
*.egg-info/
|
|
4058
|
+
.installed.cfg
|
|
4059
|
+
*.egg
|
|
4060
|
+
|
|
4061
|
+
# Virtual environments
|
|
4062
|
+
.venv/
|
|
4063
|
+
venv/
|
|
4064
|
+
ENV/
|
|
4065
|
+
env/
|
|
4066
|
+
|
|
4067
|
+
# IDE
|
|
4068
|
+
.vscode/
|
|
4069
|
+
.idea/
|
|
4070
|
+
*.swp
|
|
4071
|
+
*.swo
|
|
4072
|
+
*~
|
|
4073
|
+
|
|
4074
|
+
# OS
|
|
4075
|
+
.DS_Store
|
|
4076
|
+
Thumbs.db
|
|
4077
|
+
"
|
|
4078
|
+
`;
|
|
4079
|
+
|
|
4080
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/mcp/standalone/base/main.py should match snapshot 1`] = `
|
|
4081
|
+
"from mcp.server.fastmcp import FastMCP
|
|
4082
|
+
|
|
4083
|
+
mcp = FastMCP("{{ name }}", host="0.0.0.0", stateless_http=True)
|
|
4084
|
+
|
|
4085
|
+
|
|
4086
|
+
@mcp.tool()
|
|
4087
|
+
def add_numbers(a: int, b: int) -> int:
|
|
4088
|
+
"""Add two numbers together"""
|
|
4089
|
+
return a + b
|
|
4090
|
+
|
|
4091
|
+
|
|
4092
|
+
@mcp.tool()
|
|
4093
|
+
def multiply_numbers(a: int, b: int) -> int:
|
|
4094
|
+
"""Multiply two numbers together"""
|
|
4095
|
+
return a * b
|
|
4096
|
+
|
|
4097
|
+
|
|
4098
|
+
@mcp.tool()
|
|
4099
|
+
def greet_user(name: str) -> str:
|
|
4100
|
+
"""Greet a user by name"""
|
|
4101
|
+
return f"Hello, {name}! Nice to meet you."
|
|
4102
|
+
|
|
4103
|
+
|
|
4104
|
+
if __name__ == "__main__":
|
|
4105
|
+
mcp.run(transport="streamable-http")
|
|
4106
|
+
"
|
|
4107
|
+
`;
|
|
4108
|
+
|
|
4109
|
+
exports[`Assets Directory Snapshots > Python framework assets > python/python/mcp/standalone/base/pyproject.toml should match snapshot 1`] = `
|
|
4110
|
+
"[build-system]
|
|
4111
|
+
requires = ["hatchling"]
|
|
4112
|
+
build-backend = "hatchling.build"
|
|
4113
|
+
|
|
4114
|
+
[project]
|
|
4115
|
+
name = "{{ name }}"
|
|
4116
|
+
version = "0.1.0"
|
|
4117
|
+
description = "AgentCore MCP Server"
|
|
4118
|
+
readme = "README.md"
|
|
4119
|
+
requires-python = ">=3.10"
|
|
4120
|
+
dependencies = [
|
|
4121
|
+
"mcp >= 1.19.0",
|
|
4122
|
+
]
|
|
4123
|
+
|
|
4124
|
+
[tool.hatch.build.targets.wheel]
|
|
4125
|
+
packages = ["."]
|
|
4126
|
+
"
|
|
4127
|
+
`;
|
|
4128
|
+
|
|
3102
4129
|
exports[`Assets Directory Snapshots > Root-level assets > AGENTS.md should match snapshot 1`] = `
|
|
3103
4130
|
"## AgentCore Templates
|
|
3104
4131
|
|