@aws/agentcore 1.0.0-preview.1 → 1.0.0-preview.3

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 (32) hide show
  1. package/dist/agent-inspector/index.js +3 -4
  2. package/dist/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap +43 -15
  3. package/dist/assets/cdk/bin/cdk.ts +6 -1
  4. package/dist/assets/cdk/cdk.json +1 -1
  5. package/dist/assets/cdk/lib/cdk-stack.ts +18 -10
  6. package/dist/assets/evaluators/python-lambda/execution-role-policy.json +1 -1
  7. package/dist/assets/python/a2a/strands/capabilities/memory/session.py +6 -1
  8. package/dist/assets/python/agui/strands/capabilities/memory/session.py +6 -1
  9. package/dist/assets/python/http/strands/capabilities/memory/session.py +6 -1
  10. package/dist/cli/index.mjs +401 -395
  11. package/dist/schema/schemas/agent-env.d.ts +13 -0
  12. package/dist/schema/schemas/agent-env.d.ts.map +1 -1
  13. package/dist/schema/schemas/agent-env.js +20 -1
  14. package/dist/schema/schemas/agent-env.js.map +1 -1
  15. package/dist/schema/schemas/agentcore-project.d.ts +6 -0
  16. package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
  17. package/dist/schema/schemas/agentcore-project.js +1 -9
  18. package/dist/schema/schemas/agentcore-project.js.map +1 -1
  19. package/dist/schema/schemas/aws-targets.d.ts +3 -0
  20. package/dist/schema/schemas/aws-targets.d.ts.map +1 -1
  21. package/dist/schema/schemas/aws-targets.js +1 -0
  22. package/dist/schema/schemas/aws-targets.js.map +1 -1
  23. package/dist/schema/schemas/deployed-state.d.ts +26 -0
  24. package/dist/schema/schemas/deployed-state.d.ts.map +1 -1
  25. package/dist/schema/schemas/deployed-state.js +11 -1
  26. package/dist/schema/schemas/deployed-state.js.map +1 -1
  27. package/dist/schema/schemas/mcp.d.ts +2 -0
  28. package/dist/schema/schemas/mcp.d.ts.map +1 -1
  29. package/dist/schema/schemas/mcp.js +9 -1
  30. package/dist/schema/schemas/mcp.js.map +1 -1
  31. package/package.json +11 -6
  32. package/dist/agent-inspector/index.js.map +0 -1
@@ -110,11 +110,14 @@ async function main() {
110
110
  memoryName?: string;
111
111
  containerUri?: string;
112
112
  hasDockerfile?: boolean;
113
+ dockerfile?: string;
114
+ codeLocation?: string;
113
115
  tools?: { type: string; name: string }[];
114
116
  apiKeyArn?: string;
115
117
  }[] = [];
116
118
  for (const entry of specAny.harnesses ?? []) {
117
- const harnessPath = path.resolve(projectRoot, entry.path, 'harness.json');
119
+ const harnessDir = path.resolve(projectRoot, entry.path);
120
+ const harnessPath = path.resolve(harnessDir, 'harness.json');
118
121
  try {
119
122
  const harnessSpec = JSON.parse(fs.readFileSync(harnessPath, 'utf-8'));
120
123
  harnessConfigs.push({
@@ -123,6 +126,8 @@ async function main() {
123
126
  memoryName: harnessSpec.memory?.name,
124
127
  containerUri: harnessSpec.containerUri,
125
128
  hasDockerfile: !!harnessSpec.dockerfile,
129
+ dockerfile: harnessSpec.dockerfile,
130
+ codeLocation: harnessSpec.dockerfile ? harnessDir : undefined,
126
131
  tools: harnessSpec.tools,
127
132
  apiKeyArn: harnessSpec.model?.apiKeyArn,
128
133
  });
@@ -184,7 +189,7 @@ exports[`Assets Directory Snapshots > CDK assets > cdk/cdk/cdk.json should match
184
189
  "@aws-cdk/aws-ecs-patterns:secGroupsDisablesImplicitOpenListener": true,
185
190
  "@aws-cdk/aws-lambda:recognizeLayerVersion": true,
186
191
  "@aws-cdk/core:checkSecretUsage": true,
187
- "@aws-cdk/core:target-partitions": ["aws", "aws-cn"],
192
+ "@aws-cdk/core:target-partitions": ["aws", "aws-cn", "aws-us-gov"],
188
193
  "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
189
194
  "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
190
195
  "@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true,
@@ -300,6 +305,18 @@ exports[`Assets Directory Snapshots > CDK assets > cdk/cdk/lib/cdk-stack.ts shou
300
305
  import { CfnOutput, Stack, type StackProps } from 'aws-cdk-lib';
301
306
  import { Construct } from 'constructs';
302
307
 
308
+ export interface HarnessConfig {
309
+ name: string;
310
+ executionRoleArn?: string;
311
+ memoryName?: string;
312
+ containerUri?: string;
313
+ hasDockerfile?: boolean;
314
+ dockerfile?: string;
315
+ codeLocation?: string;
316
+ tools?: { type: string; name: string }[];
317
+ apiKeyArn?: string;
318
+ }
319
+
303
320
  export interface AgentCoreStackProps extends StackProps {
304
321
  /**
305
322
  * The AgentCore project specification containing agents, memories, and credentials.
@@ -315,16 +332,12 @@ export interface AgentCoreStackProps extends StackProps {
315
332
  credentials?: Record<string, { credentialProviderArn: string; clientSecretArn?: string }>;
316
333
  /**
317
334
  * Harness role configurations. Each entry creates an IAM execution role for a harness.
335
+ *
336
+ * When \`hasDockerfile\` is true and \`codeLocation\` is provided (without an explicit
337
+ * \`containerUri\`), the L3 construct builds and pushes a container image via CodeBuild
338
+ * and emits its URI as a stack output for the post-CDK harness deployer.
318
339
  */
319
- harnesses?: {
320
- name: string;
321
- executionRoleArn?: string;
322
- memoryName?: string;
323
- containerUri?: string;
324
- hasDockerfile?: boolean;
325
- tools?: { type: string; name: string }[];
326
- apiKeyArn?: string;
327
- }[];
340
+ harnesses?: HarnessConfig[];
328
341
  }
329
342
 
330
343
  /**
@@ -345,7 +358,7 @@ export class AgentCoreStack extends Stack {
345
358
  // Create AgentCoreApplication with all agents and harness roles
346
359
  this.application = new AgentCoreApplication(this, 'Application', {
347
360
  spec,
348
- harnesses,
361
+ harnesses: harnesses?.length ? harnesses : undefined,
349
362
  });
350
363
 
351
364
  // Create AgentCoreMcp if there are gateways configured
@@ -1938,6 +1951,7 @@ exports[`Assets Directory Snapshots > Python framework assets > python/python/a2
1938
1951
 
1939
1952
  exports[`Assets Directory Snapshots > Python framework assets > python/python/a2a/strands/capabilities/memory/session.py should match snapshot 1`] = `
1940
1953
  "import os
1954
+ import uuid
1941
1955
  from typing import Optional
1942
1956
 
1943
1957
  from bedrock_agentcore.memory.integrations.strands.config import AgentCoreMemoryConfig{{#if memoryProviders.[0].strategies.length}}, RetrievalConfig{{/if}}
@@ -1946,10 +1960,14 @@ from bedrock_agentcore.memory.integrations.strands.session_manager import AgentC
1946
1960
  MEMORY_ID = os.getenv("{{memoryProviders.[0].envVarName}}")
1947
1961
  REGION = os.getenv("AWS_REGION")
1948
1962
 
1949
- def get_memory_session_manager(session_id: str, actor_id: str) -> Optional[AgentCoreMemorySessionManager]:
1963
+ def get_memory_session_manager(session_id: Optional[str], actor_id: str) -> Optional[AgentCoreMemorySessionManager]:
1950
1964
  if not MEMORY_ID:
1951
1965
  return None
1952
1966
 
1967
+ # AgentCoreMemoryConfig rejects None; OAuth/CUSTOM_JWT callers can reach us
1968
+ # without a runtime session header, so synthesize one when absent.
1969
+ session_id = session_id or uuid.uuid4().hex
1970
+
1953
1971
  {{#if memoryProviders.[0].strategies.length}}
1954
1972
  retrieval_config = {
1955
1973
  {{#if (includes memoryProviders.[0].strategies "SEMANTIC")}}
@@ -2773,6 +2791,7 @@ exports[`Assets Directory Snapshots > Python framework assets > python/python/ag
2773
2791
 
2774
2792
  exports[`Assets Directory Snapshots > Python framework assets > python/python/agui/strands/capabilities/memory/session.py should match snapshot 1`] = `
2775
2793
  "import os
2794
+ import uuid
2776
2795
  from typing import Optional
2777
2796
 
2778
2797
  from bedrock_agentcore.memory.integrations.strands.config import AgentCoreMemoryConfig{{#if memoryProviders.[0].strategies.length}}, RetrievalConfig{{/if}}
@@ -2781,10 +2800,14 @@ from bedrock_agentcore.memory.integrations.strands.session_manager import AgentC
2781
2800
  MEMORY_ID = os.getenv("{{memoryProviders.[0].envVarName}}")
2782
2801
  REGION = os.getenv("AWS_REGION")
2783
2802
 
2784
- def get_memory_session_manager(session_id: str, actor_id: str) -> Optional[AgentCoreMemorySessionManager]:
2803
+ def get_memory_session_manager(session_id: Optional[str], actor_id: str) -> Optional[AgentCoreMemorySessionManager]:
2785
2804
  if not MEMORY_ID:
2786
2805
  return None
2787
2806
 
2807
+ # AgentCoreMemoryConfig rejects None; OAuth/CUSTOM_JWT callers can reach us
2808
+ # without a runtime session header, so synthesize one when absent.
2809
+ session_id = session_id or uuid.uuid4().hex
2810
+
2788
2811
  {{#if memoryProviders.[0].strategies.length}}
2789
2812
  retrieval_config = {
2790
2813
  {{#if (includes memoryProviders.[0].strategies "SEMANTIC")}}
@@ -5042,6 +5065,7 @@ exports[`Assets Directory Snapshots > Python framework assets > python/python/ht
5042
5065
 
5043
5066
  exports[`Assets Directory Snapshots > Python framework assets > python/python/http/strands/capabilities/memory/session.py should match snapshot 1`] = `
5044
5067
  "import os
5068
+ import uuid
5045
5069
  from typing import Optional
5046
5070
 
5047
5071
  from bedrock_agentcore.memory.integrations.strands.config import AgentCoreMemoryConfig{{#if memoryProviders.[0].strategies.length}}, RetrievalConfig{{/if}}
@@ -5050,10 +5074,14 @@ from bedrock_agentcore.memory.integrations.strands.session_manager import AgentC
5050
5074
  MEMORY_ID = os.getenv("{{memoryProviders.[0].envVarName}}")
5051
5075
  REGION = os.getenv("AWS_REGION")
5052
5076
 
5053
- def get_memory_session_manager(session_id: str, actor_id: str) -> Optional[AgentCoreMemorySessionManager]:
5077
+ def get_memory_session_manager(session_id: Optional[str], actor_id: str) -> Optional[AgentCoreMemorySessionManager]:
5054
5078
  if not MEMORY_ID:
5055
5079
  return None
5056
5080
 
5081
+ # AgentCoreMemoryConfig rejects None; OAuth/CUSTOM_JWT callers can reach us
5082
+ # without a runtime session header, so synthesize one when absent.
5083
+ session_id = session_id or uuid.uuid4().hex
5084
+
5057
5085
  {{#if memoryProviders.[0].strategies.length}}
5058
5086
  retrieval_config = {
5059
5087
  {{#if (includes memoryProviders.[0].strategies "SEMANTIC")}}
@@ -65,11 +65,14 @@ async function main() {
65
65
  memoryName?: string;
66
66
  containerUri?: string;
67
67
  hasDockerfile?: boolean;
68
+ dockerfile?: string;
69
+ codeLocation?: string;
68
70
  tools?: { type: string; name: string }[];
69
71
  apiKeyArn?: string;
70
72
  }[] = [];
71
73
  for (const entry of specAny.harnesses ?? []) {
72
- const harnessPath = path.resolve(projectRoot, entry.path, 'harness.json');
74
+ const harnessDir = path.resolve(projectRoot, entry.path);
75
+ const harnessPath = path.resolve(harnessDir, 'harness.json');
73
76
  try {
74
77
  const harnessSpec = JSON.parse(fs.readFileSync(harnessPath, 'utf-8'));
75
78
  harnessConfigs.push({
@@ -78,6 +81,8 @@ async function main() {
78
81
  memoryName: harnessSpec.memory?.name,
79
82
  containerUri: harnessSpec.containerUri,
80
83
  hasDockerfile: !!harnessSpec.dockerfile,
84
+ dockerfile: harnessSpec.dockerfile,
85
+ codeLocation: harnessSpec.dockerfile ? harnessDir : undefined,
81
86
  tools: harnessSpec.tools,
82
87
  apiKeyArn: harnessSpec.model?.apiKeyArn,
83
88
  });
@@ -9,7 +9,7 @@
9
9
  "@aws-cdk/aws-ecs-patterns:secGroupsDisablesImplicitOpenListener": true,
10
10
  "@aws-cdk/aws-lambda:recognizeLayerVersion": true,
11
11
  "@aws-cdk/core:checkSecretUsage": true,
12
- "@aws-cdk/core:target-partitions": ["aws", "aws-cn"],
12
+ "@aws-cdk/core:target-partitions": ["aws", "aws-cn", "aws-us-gov"],
13
13
  "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
14
14
  "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
15
15
  "@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true,
@@ -7,6 +7,18 @@ import {
7
7
  import { CfnOutput, Stack, type StackProps } from 'aws-cdk-lib';
8
8
  import { Construct } from 'constructs';
9
9
 
10
+ export interface HarnessConfig {
11
+ name: string;
12
+ executionRoleArn?: string;
13
+ memoryName?: string;
14
+ containerUri?: string;
15
+ hasDockerfile?: boolean;
16
+ dockerfile?: string;
17
+ codeLocation?: string;
18
+ tools?: { type: string; name: string }[];
19
+ apiKeyArn?: string;
20
+ }
21
+
10
22
  export interface AgentCoreStackProps extends StackProps {
11
23
  /**
12
24
  * The AgentCore project specification containing agents, memories, and credentials.
@@ -22,16 +34,12 @@ export interface AgentCoreStackProps extends StackProps {
22
34
  credentials?: Record<string, { credentialProviderArn: string; clientSecretArn?: string }>;
23
35
  /**
24
36
  * Harness role configurations. Each entry creates an IAM execution role for a harness.
37
+ *
38
+ * When `hasDockerfile` is true and `codeLocation` is provided (without an explicit
39
+ * `containerUri`), the L3 construct builds and pushes a container image via CodeBuild
40
+ * and emits its URI as a stack output for the post-CDK harness deployer.
25
41
  */
26
- harnesses?: {
27
- name: string;
28
- executionRoleArn?: string;
29
- memoryName?: string;
30
- containerUri?: string;
31
- hasDockerfile?: boolean;
32
- tools?: { type: string; name: string }[];
33
- apiKeyArn?: string;
34
- }[];
42
+ harnesses?: HarnessConfig[];
35
43
  }
36
44
 
37
45
  /**
@@ -52,7 +60,7 @@ export class AgentCoreStack extends Stack {
52
60
  // Create AgentCoreApplication with all agents and harness roles
53
61
  this.application = new AgentCoreApplication(this, 'Application', {
54
62
  spec,
55
- harnesses,
63
+ harnesses: harnesses?.length ? harnesses : undefined,
56
64
  });
57
65
 
58
66
  // Create AgentCoreMcp if there are gateways configured
@@ -4,7 +4,7 @@
4
4
  {
5
5
  "Effect": "Allow",
6
6
  "Action": ["logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents"],
7
- "Resource": "arn:aws:logs:*:*:log-group:/aws/lambda/*"
7
+ "Resource": "arn:*:logs:*:*:log-group:/aws/lambda/*"
8
8
  }
9
9
  ]
10
10
  }
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import uuid
2
3
  from typing import Optional
3
4
 
4
5
  from bedrock_agentcore.memory.integrations.strands.config import AgentCoreMemoryConfig{{#if memoryProviders.[0].strategies.length}}, RetrievalConfig{{/if}}
@@ -7,10 +8,14 @@ from bedrock_agentcore.memory.integrations.strands.session_manager import AgentC
7
8
  MEMORY_ID = os.getenv("{{memoryProviders.[0].envVarName}}")
8
9
  REGION = os.getenv("AWS_REGION")
9
10
 
10
- def get_memory_session_manager(session_id: str, actor_id: str) -> Optional[AgentCoreMemorySessionManager]:
11
+ def get_memory_session_manager(session_id: Optional[str], actor_id: str) -> Optional[AgentCoreMemorySessionManager]:
11
12
  if not MEMORY_ID:
12
13
  return None
13
14
 
15
+ # AgentCoreMemoryConfig rejects None; OAuth/CUSTOM_JWT callers can reach us
16
+ # without a runtime session header, so synthesize one when absent.
17
+ session_id = session_id or uuid.uuid4().hex
18
+
14
19
  {{#if memoryProviders.[0].strategies.length}}
15
20
  retrieval_config = {
16
21
  {{#if (includes memoryProviders.[0].strategies "SEMANTIC")}}
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import uuid
2
3
  from typing import Optional
3
4
 
4
5
  from bedrock_agentcore.memory.integrations.strands.config import AgentCoreMemoryConfig{{#if memoryProviders.[0].strategies.length}}, RetrievalConfig{{/if}}
@@ -7,10 +8,14 @@ from bedrock_agentcore.memory.integrations.strands.session_manager import AgentC
7
8
  MEMORY_ID = os.getenv("{{memoryProviders.[0].envVarName}}")
8
9
  REGION = os.getenv("AWS_REGION")
9
10
 
10
- def get_memory_session_manager(session_id: str, actor_id: str) -> Optional[AgentCoreMemorySessionManager]:
11
+ def get_memory_session_manager(session_id: Optional[str], actor_id: str) -> Optional[AgentCoreMemorySessionManager]:
11
12
  if not MEMORY_ID:
12
13
  return None
13
14
 
15
+ # AgentCoreMemoryConfig rejects None; OAuth/CUSTOM_JWT callers can reach us
16
+ # without a runtime session header, so synthesize one when absent.
17
+ session_id = session_id or uuid.uuid4().hex
18
+
14
19
  {{#if memoryProviders.[0].strategies.length}}
15
20
  retrieval_config = {
16
21
  {{#if (includes memoryProviders.[0].strategies "SEMANTIC")}}
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import uuid
2
3
  from typing import Optional
3
4
 
4
5
  from bedrock_agentcore.memory.integrations.strands.config import AgentCoreMemoryConfig{{#if memoryProviders.[0].strategies.length}}, RetrievalConfig{{/if}}
@@ -7,10 +8,14 @@ from bedrock_agentcore.memory.integrations.strands.session_manager import AgentC
7
8
  MEMORY_ID = os.getenv("{{memoryProviders.[0].envVarName}}")
8
9
  REGION = os.getenv("AWS_REGION")
9
10
 
10
- def get_memory_session_manager(session_id: str, actor_id: str) -> Optional[AgentCoreMemorySessionManager]:
11
+ def get_memory_session_manager(session_id: Optional[str], actor_id: str) -> Optional[AgentCoreMemorySessionManager]:
11
12
  if not MEMORY_ID:
12
13
  return None
13
14
 
15
+ # AgentCoreMemoryConfig rejects None; OAuth/CUSTOM_JWT callers can reach us
16
+ # without a runtime session header, so synthesize one when absent.
17
+ session_id = session_id or uuid.uuid4().hex
18
+
14
19
  {{#if memoryProviders.[0].strategies.length}}
15
20
  retrieval_config = {
16
21
  {{#if (includes memoryProviders.[0].strategies "SEMANTIC")}}