@cdklabs/cdk-appmod-catalog-blueprints 1.10.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/.jsii +1276 -211
  2. package/lib/document-processing/adapter/queued-s3-adapter.js +1 -1
  3. package/lib/document-processing/agentic-document-processing.js +2 -2
  4. package/lib/document-processing/base-document-processing.js +1 -1
  5. package/lib/document-processing/bedrock-document-processing.js +1 -1
  6. package/lib/document-processing/default-document-processing-config.js +1 -1
  7. package/lib/framework/agents/base-agent.d.ts +15 -2
  8. package/lib/framework/agents/base-agent.js +3 -3
  9. package/lib/framework/agents/batch-agent.d.ts +1 -1
  10. package/lib/framework/agents/batch-agent.js +2 -2
  11. package/lib/framework/agents/default-agent-config.js +1 -1
  12. package/lib/framework/agents/interactive-agent.d.ts +286 -3
  13. package/lib/framework/agents/interactive-agent.js +412 -123
  14. package/lib/framework/agents/knowledge-base/base-knowledge-base.js +1 -1
  15. package/lib/framework/agents/knowledge-base/bedrock-knowledge-base.js +1 -1
  16. package/lib/framework/agents/resources/agentcore-agent-handler/Dockerfile +20 -0
  17. package/lib/framework/agents/resources/agentcore-agent-handler/main.py +224 -0
  18. package/lib/framework/agents/resources/agentcore-agent-handler/requirements.txt +5 -0
  19. package/lib/framework/agents/resources/interactive-agent-handler/index.py +16 -93
  20. package/lib/framework/agents/resources/interactive-agent-handler/test_handler.py +214 -413
  21. package/lib/framework/bedrock/bedrock.js +1 -1
  22. package/lib/framework/custom-resource/default-runtimes.js +1 -1
  23. package/lib/framework/foundation/access-log.js +1 -1
  24. package/lib/framework/foundation/eventbridge-broker.js +1 -1
  25. package/lib/framework/foundation/network.js +1 -1
  26. package/lib/framework/tests/interactive-agent-nag.test.js +56 -1
  27. package/lib/framework/tests/interactive-agent.test.js +257 -11
  28. package/lib/tsconfig.tsbuildinfo +1 -1
  29. package/lib/utilities/data-loader.js +1 -1
  30. package/lib/utilities/lambda-iam-utils.js +1 -1
  31. package/lib/utilities/observability/cloudfront-distribution-observability-property-injector.js +1 -1
  32. package/lib/utilities/observability/cloudwatch-transaction-search.js +1 -1
  33. package/lib/utilities/observability/default-observability-config.js +1 -1
  34. package/lib/utilities/observability/lambda-observability-property-injector.js +1 -1
  35. package/lib/utilities/observability/log-group-data-protection-utils.js +1 -1
  36. package/lib/utilities/observability/powertools-config.js +1 -1
  37. package/lib/utilities/observability/state-machine-observability-property-injector.js +1 -1
  38. package/lib/webapp/frontend-construct.js +1 -1
  39. package/package.json +2 -2
@@ -1,11 +1,14 @@
1
1
  import { Duration, RemovalPolicy } from 'aws-cdk-lib';
2
2
  import { RestApi } from 'aws-cdk-lib/aws-apigateway';
3
+ import { CfnRuntime } from 'aws-cdk-lib/aws-bedrockagentcore';
3
4
  import { UserPool, UserPoolClient } from 'aws-cdk-lib/aws-cognito';
4
- import { IKey } from 'aws-cdk-lib/aws-kms';
5
- import { IFunction, Architecture } from 'aws-cdk-lib/aws-lambda';
5
+ import { Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam';
6
+ import { IKey, Key } from 'aws-cdk-lib/aws-kms';
7
+ import { IFunction, Architecture, ILayerVersion } from 'aws-cdk-lib/aws-lambda';
6
8
  import { IBucket } from 'aws-cdk-lib/aws-s3';
7
9
  import { Construct } from 'constructs';
8
10
  import { BaseAgent, BaseAgentProps } from './base-agent';
11
+ import { Network } from '../foundation';
9
12
  /**
10
13
  * Strategy interface for pluggable communication mechanisms.
11
14
  * Default implementation is StreamingHttpAdapter (API Gateway REST API with response streaming).
@@ -133,6 +136,9 @@ export declare class StreamingHttpAdapter implements ICommunicationAdapter {
133
136
  *
134
137
  * Session stores manage conversation state persistence across HTTP requests.
135
138
  * The default implementation (S3SessionManager) uses S3 for durable storage.
139
+ *
140
+ * @deprecated Use Strands-native `S3SessionManager` from `strands.session.s3_session_manager` instead.
141
+ * The Python handler now uses Strands-native session management automatically.
136
142
  */
137
143
  export interface ISessionStore {
138
144
  /**
@@ -148,6 +154,8 @@ export interface ISessionStore {
148
154
  }
149
155
  /**
150
156
  * Configuration properties for S3SessionManager.
157
+ *
158
+ * @deprecated Use Strands-native `S3SessionManager` from `strands.session.s3_session_manager` instead.
151
159
  */
152
160
  export interface S3SessionManagerProps {
153
161
  /**
@@ -208,6 +216,11 @@ export interface S3SessionManagerProps {
208
216
  * sessionStore: sessionManager
209
217
  * });
210
218
  * ```
219
+ *
220
+ * @deprecated Use Strands-native `S3SessionManager` from `strands.session.s3_session_manager` instead.
221
+ * The Python handler now uses Strands-native session management automatically.
222
+ * An S3 bucket is still created for the Strands session manager; this CDK class
223
+ * is no longer needed to configure session persistence.
211
224
  */
212
225
  export declare class S3SessionManager implements ISessionStore {
213
226
  /**
@@ -233,6 +246,10 @@ export declare class S3SessionManager implements ISessionStore {
233
246
  *
234
247
  * Context strategies control how conversation history is maintained and provided
235
248
  * to the agent. Different strategies enable different conversation patterns.
249
+ *
250
+ * @deprecated Use Strands-native `SlidingWindowConversationManager` from
251
+ * `strands.agent.conversation_manager` instead. The Python handler now uses
252
+ * Strands-native conversation management automatically.
236
253
  */
237
254
  export interface IContextStrategy {
238
255
  /**
@@ -244,6 +261,9 @@ export interface IContextStrategy {
244
261
  }
245
262
  /**
246
263
  * Configuration properties for SlidingWindowConversationManager.
264
+ *
265
+ * @deprecated Use Strands-native `SlidingWindowConversationManager` from
266
+ * `strands.agent.conversation_manager` instead.
247
267
  */
248
268
  export interface SlidingWindowConversationManagerProps {
249
269
  /**
@@ -274,6 +294,10 @@ export interface SlidingWindowConversationManagerProps {
274
294
  * contextStrategy: contextManager
275
295
  * });
276
296
  * ```
297
+ *
298
+ * @deprecated Use Strands-native `SlidingWindowConversationManager` from
299
+ * `strands.agent.conversation_manager` instead. The Python handler now handles
300
+ * conversation windowing natively.
277
301
  */
278
302
  export declare class SlidingWindowConversationManager implements IContextStrategy {
279
303
  /**
@@ -291,6 +315,9 @@ export declare class SlidingWindowConversationManager implements IContextStrateg
291
315
  *
292
316
  * Disables conversation history, treating each message as independent.
293
317
  * Useful for stateless use cases where context is not needed.
318
+ *
319
+ * @deprecated The Python handler now uses Strands-native conversation management.
320
+ * To disable conversation history, omit the session bucket configuration.
294
321
  */
295
322
  export declare class NullConversationManager implements IContextStrategy {
296
323
  /**
@@ -420,6 +447,242 @@ export declare class NoAuthenticator implements IAuthenticator {
420
447
  */
421
448
  environmentVariables(): Record<string, string>;
422
449
  }
450
+ /**
451
+ * Configuration passed to a hosting adapter's deploy method.
452
+ */
453
+ export interface AgentHostingConfig {
454
+ /** CDK scope for creating resources. */
455
+ readonly scope: Construct;
456
+ /** Agent name identifier. */
457
+ readonly agentName: string;
458
+ /** IAM role for the agent runtime. */
459
+ readonly agentRole: Role;
460
+ /** Environment variables to set on the runtime. */
461
+ readonly environment: Record<string, string>;
462
+ /** KMS encryption key. */
463
+ readonly encryptionKey: Key;
464
+ /** Optional VPC network configuration. */
465
+ readonly network?: Network;
466
+ /** Lambda architecture (Lambda hosting only). */
467
+ readonly architecture?: Architecture;
468
+ /** Lambda memory size in MB (Lambda hosting only). */
469
+ readonly memorySize?: number;
470
+ /** Lambda timeout (Lambda hosting only). */
471
+ readonly timeout?: Duration;
472
+ /** Reserved concurrent executions (Lambda hosting only). */
473
+ readonly reservedConcurrentExecutions?: number;
474
+ /** Lambda layers from agent definition (Lambda hosting only). */
475
+ readonly lambdaLayers?: ILayerVersion[];
476
+ /** Lambda layers from knowledge bases (Lambda hosting only). */
477
+ readonly knowledgeBaseLayers?: ILayerVersion[];
478
+ /** Whether observability is enabled. */
479
+ readonly enableObservability?: boolean;
480
+ /** Agent tools location definitions (JSON serialized). */
481
+ readonly toolsConfig: string;
482
+ /** System prompt S3 bucket name. */
483
+ readonly systemPromptBucket: string;
484
+ /** System prompt S3 key. */
485
+ readonly systemPromptKey: string;
486
+ /** Knowledge base configs (JSON serialized). */
487
+ readonly knowledgeBaseConfigs?: string;
488
+ /** Knowledge base system prompt addition. */
489
+ readonly knowledgeBaseSystemPromptAddition?: string;
490
+ /** Removal policy for resources. */
491
+ readonly removalPolicy?: RemovalPolicy;
492
+ }
493
+ /**
494
+ * Result returned by a hosting adapter's deploy method.
495
+ */
496
+ export interface AgentHostingResult {
497
+ /** The agent endpoint URL or ARN. */
498
+ readonly endpoint: string;
499
+ /** The Lambda function (if Lambda-hosted). */
500
+ readonly agentFunction?: IFunction;
501
+ /** The AgentCore CfnRuntime (if AgentCore-hosted). */
502
+ readonly cfnRuntime?: CfnRuntime;
503
+ }
504
+ /**
505
+ * Strategy interface for pluggable hosting backends.
506
+ *
507
+ * Hosting adapters encapsulate the infrastructure needed to run an agent.
508
+ * The default implementation is `LambdaHostingAdapter` (Lambda + LWA + API Gateway).
509
+ * `AgentCoreRuntimeHostingAdapter` provides an alternative using AgentCore Runtime.
510
+ */
511
+ export interface IHostingAdapter {
512
+ /**
513
+ * The IAM service principal that this hosting backend requires.
514
+ *
515
+ * BaseAgent uses this to create the agent role with the correct trust policy.
516
+ * For example, Lambda hosting requires `lambda.amazonaws.com` while AgentCore
517
+ * hosting requires `bedrock-agentcore.amazonaws.com`.
518
+ */
519
+ readonly servicePrincipal: ServicePrincipal;
520
+ /**
521
+ * Deploy the agent hosting infrastructure.
522
+ *
523
+ * @param config - Configuration for the agent hosting
524
+ * @returns The hosting result including endpoint and optional resources
525
+ */
526
+ deploy(config: AgentHostingConfig): AgentHostingResult;
527
+ }
528
+ /**
529
+ * Configuration properties for LambdaHostingAdapter.
530
+ */
531
+ export interface LambdaHostingAdapterProps {
532
+ /**
533
+ * Communication adapter for client-agent interaction.
534
+ *
535
+ * @default StreamingHttpAdapter
536
+ */
537
+ readonly communicationAdapter?: ICommunicationAdapter;
538
+ /**
539
+ * Authenticator for securing API endpoints.
540
+ *
541
+ * @default CognitoAuthenticator
542
+ */
543
+ readonly authenticator?: IAuthenticator;
544
+ /**
545
+ * Lambda function memory size in MB.
546
+ *
547
+ * @default 1024
548
+ */
549
+ readonly memorySize?: number;
550
+ /**
551
+ * Lambda function timeout.
552
+ *
553
+ * @default Duration.minutes(15)
554
+ */
555
+ readonly timeout?: Duration;
556
+ /**
557
+ * Lambda function architecture.
558
+ *
559
+ * @default Architecture.X86_64
560
+ */
561
+ readonly architecture?: Architecture;
562
+ /**
563
+ * Reserved concurrent executions for the Lambda function.
564
+ *
565
+ * @default No reserved concurrency
566
+ */
567
+ readonly reservedConcurrentExecutions?: number;
568
+ }
569
+ /**
570
+ * Lambda hosting adapter for InteractiveAgent.
571
+ *
572
+ * Deploys the agent as a Lambda function behind Lambda Web Adapter and API Gateway
573
+ * REST API with response streaming. This is the default hosting backend.
574
+ *
575
+ * ## Architecture
576
+ *
577
+ * ```
578
+ * Client → POST /chat → API Gateway REST API (STREAM) → Lambda (FastAPI + LWA) → Bedrock
579
+ * Client ← SSE stream ← API Gateway ← Lambda response streaming ← Agent tokens
580
+ * ```
581
+ */
582
+ export declare class LambdaHostingAdapter implements IHostingAdapter {
583
+ /** The communication adapter. */
584
+ readonly communicationAdapter?: ICommunicationAdapter;
585
+ /** The authenticator. */
586
+ readonly authenticator?: IAuthenticator;
587
+ private readonly props;
588
+ constructor(props?: LambdaHostingAdapterProps);
589
+ get servicePrincipal(): ServicePrincipal;
590
+ /**
591
+ * Deploy Lambda + LWA + API Gateway hosting infrastructure.
592
+ */
593
+ deploy(config: AgentHostingConfig): AgentHostingResult;
594
+ }
595
+ /**
596
+ * Custom JWT authorizer configuration for AgentCore Runtime.
597
+ */
598
+ export interface AgentCoreJwtAuthorizerConfig {
599
+ /** OIDC discovery URL. */
600
+ readonly discoveryUrl: string;
601
+ /** Allowed audiences. */
602
+ readonly allowedAudience?: string[];
603
+ /** Allowed client IDs. */
604
+ readonly allowedClients?: string[];
605
+ }
606
+ /**
607
+ * Configuration properties for AgentCoreRuntimeHostingAdapter.
608
+ */
609
+ export interface AgentCoreRuntimeHostingAdapterProps {
610
+ /**
611
+ * ECR container image URI. If not provided, builds from the bundled handler source.
612
+ *
613
+ * @default Builds from agentcore-agent-handler directory
614
+ */
615
+ readonly containerImageUri?: string;
616
+ /**
617
+ * Network mode: 'PUBLIC' or 'VPC'.
618
+ *
619
+ * @default 'PUBLIC'
620
+ */
621
+ readonly networkMode?: string;
622
+ /**
623
+ * Custom JWT authorizer configuration.
624
+ * Omit for IAM-only auth.
625
+ */
626
+ readonly customJwtAuthorizer?: AgentCoreJwtAuthorizerConfig;
627
+ /**
628
+ * Protocol configuration: 'HTTP' | 'MCP' | 'A2A'.
629
+ *
630
+ * @default 'HTTP'
631
+ */
632
+ readonly protocolConfiguration?: string;
633
+ /**
634
+ * Runtime endpoint name.
635
+ *
636
+ * @default Auto-generated from agent name
637
+ */
638
+ readonly endpointName?: string;
639
+ }
640
+ /**
641
+ * AgentCore Runtime hosting adapter for InteractiveAgent.
642
+ *
643
+ * Deploys the agent as a container running on AgentCore Runtime (microVM).
644
+ * Uses L1 constructs `CfnRuntime` and `CfnRuntimeEndpoint` from
645
+ * `aws-cdk-lib/aws-bedrockagentcore`.
646
+ *
647
+ * ## Architecture
648
+ *
649
+ * ```
650
+ * Client → AgentCore Runtime Endpoint → Container (FastAPI on port 8080) → Bedrock
651
+ * ```
652
+ *
653
+ * ## Features
654
+ *
655
+ * - **Session Isolation**: microVM provides per-session isolation (no S3 session bucket needed)
656
+ * - **Managed Infrastructure**: No Lambda cold starts or timeout limits
657
+ * - **Multiple Protocols**: HTTP, MCP, or A2A protocol support
658
+ * - **Container-Based**: Standard Docker image deployment
659
+ *
660
+ * ## Usage
661
+ *
662
+ * ```typescript
663
+ * import { Asset } from 'aws-cdk-lib/aws-s3-assets';
664
+ * import { InteractiveAgent, AgentCoreRuntimeHostingAdapter } from '@cdklabs/cdk-appmod-catalog-blueprints';
665
+ *
666
+ * declare const myPrompt: Asset;
667
+ *
668
+ * new InteractiveAgent(this, 'Agent', {
669
+ * agentName: 'MyChatbot',
670
+ * agentDefinition: { bedrockModel: {}, systemPrompt: myPrompt },
671
+ * hostingAdapter: new AgentCoreRuntimeHostingAdapter({
672
+ * networkMode: 'PUBLIC',
673
+ * }),
674
+ * });
675
+ * ```
676
+ */
677
+ export declare class AgentCoreRuntimeHostingAdapter implements IHostingAdapter {
678
+ private readonly props;
679
+ constructor(props?: AgentCoreRuntimeHostingAdapterProps);
680
+ get servicePrincipal(): ServicePrincipal;
681
+ /**
682
+ * Deploy AgentCore Runtime hosting infrastructure.
683
+ */
684
+ deploy(config: AgentHostingConfig): AgentHostingResult;
685
+ }
423
686
  /**
424
687
  * Configuration properties for InteractiveAgent.
425
688
  *
@@ -427,6 +690,19 @@ export declare class NoAuthenticator implements IAuthenticator {
427
690
  * strategy interfaces for building real-time conversational AI agents.
428
691
  */
429
692
  export interface InteractiveAgentProps extends BaseAgentProps {
693
+ /**
694
+ * Hosting adapter for deploying the agent runtime.
695
+ *
696
+ * Use `LambdaHostingAdapter` for Lambda + API Gateway (default) or
697
+ * `AgentCoreRuntimeHostingAdapter` for AgentCore Runtime hosting.
698
+ *
699
+ * When provided, `communicationAdapter`, `authenticator`, `memorySize`,
700
+ * `timeout`, `architecture`, and `reservedConcurrentExecutions` props
701
+ * are ignored (configure them on the adapter directly).
702
+ *
703
+ * @default LambdaHostingAdapter
704
+ */
705
+ readonly hostingAdapter?: IHostingAdapter;
430
706
  /**
431
707
  * Communication adapter for client-agent interaction.
432
708
  *
@@ -438,6 +714,8 @@ export interface InteractiveAgentProps extends BaseAgentProps {
438
714
  * Set to undefined to disable session persistence (stateless mode).
439
715
  *
440
716
  * @default S3SessionManager with 24-hour TTL
717
+ * @deprecated Session management is now handled by Strands-native `S3SessionManager`.
718
+ * An S3 bucket is always created and passed as `SESSION_BUCKET` env var.
441
719
  */
442
720
  readonly sessionStore?: ISessionStore;
443
721
  /**
@@ -457,6 +735,8 @@ export interface InteractiveAgentProps extends BaseAgentProps {
457
735
  * Context strategy for conversation history management.
458
736
  *
459
737
  * @default SlidingWindowConversationManager with 20 messages
738
+ * @deprecated Conversation management is now handled by Strands-native
739
+ * `SlidingWindowConversationManager` in the Python handler.
460
740
  */
461
741
  readonly contextStrategy?: IContextStrategy;
462
742
  /**
@@ -465,6 +745,8 @@ export interface InteractiveAgentProps extends BaseAgentProps {
465
745
  * Ignored if contextStrategy is provided.
466
746
  *
467
747
  * @default 20
748
+ * @deprecated Conversation windowing is now handled by Strands-native
749
+ * `SlidingWindowConversationManager` in the Python handler (default: 20).
468
750
  */
469
751
  readonly messageHistoryLimit?: number;
470
752
  /**
@@ -550,13 +832,14 @@ export interface InteractiveAgentProps extends BaseAgentProps {
550
832
  * ```
551
833
  */
552
834
  export declare class InteractiveAgent extends BaseAgent {
553
- readonly agentFunction: IFunction;
835
+ readonly agentFunction?: IFunction;
554
836
  readonly adapter?: ICommunicationAdapter;
555
837
  readonly sessionStore?: ISessionStore;
556
838
  readonly contextStrategy?: IContextStrategy;
557
839
  readonly authenticator?: IAuthenticator;
558
840
  readonly apiEndpoint: string;
559
841
  readonly sessionBucket?: IBucket;
842
+ readonly cfnRuntime?: CfnRuntime;
560
843
  constructor(scope: Construct, id: string, props: InteractiveAgentProps);
561
844
  /**
562
845
  * Validates InteractiveAgent props.