@@ -21,13 +21,13 @@ export interface UseCaseBuilderProps {
2121 readonly api : RestApi ;
2222 readonly vpc ?: IVpc ;
2323 readonly securityGroups ?: ISecurityGroup [ ] ;
24- readonly createGenericAgentCoreRuntime ?: boolean ;
24+ readonly agentBuilderRuntimeArn ?: string ;
2525}
2626export class UseCaseBuilder extends Construct {
2727 constructor ( scope : Construct , id : string , props : UseCaseBuilderProps ) {
2828 super ( scope , id ) ;
2929
30- const { userPool, api, createGenericAgentCoreRuntime } = props ;
30+ const { userPool, api, agentBuilderRuntimeArn } = props ;
3131
3232 const useCaseIdIndexName = 'UseCaseIdIndexName' ;
3333 const useCaseBuilderTable = new ddb . Table ( this , 'UseCaseBuilderTable' , {
@@ -243,7 +243,7 @@ export class UseCaseBuilder extends Construct {
243243 commonAuthorizerProps
244244 ) ;
245245
246- if ( createGenericAgentCoreRuntime ) {
246+ if ( agentBuilderRuntimeArn ) {
247247 // Add Agent Builder related APIs
248248 const agentBuilderFunction = new NodejsFunction ( this , 'AgentBuilder' , {
249249 ...commonProperty ,
@@ -276,30 +276,24 @@ export class UseCaseBuilder extends Construct {
276276 } ) ;
277277 agentBuilderFunction . role ?. addToPrincipalPolicy ( cognitoPolicyForAgent ) ;
278278
279- // Agent Builder API endpoints
279+ // Agent Builder API endpoints - all routes handled by proxy+ integration
280280 const agentsResource = api . root . addResource ( 'agents' ) ;
281281
282- // GET: /agents
282+ // Handle root /agents requests
283283 agentsResource . addMethod (
284- 'GET' ,
285- new LambdaIntegration ( agentBuilderFunction ) ,
286- commonAuthorizerProps
287- ) ;
288-
289- // POST: /agents
290- agentsResource . addMethod (
291- 'POST' ,
284+ 'ANY' ,
292285 new LambdaIntegration ( agentBuilderFunction ) ,
293286 commonAuthorizerProps
294287 ) ;
295288
296289 // All agent sub-routes handled by proxy+ integration
297- const agentResource = agentsResource . addResource ( '{proxy+}' ) ;
298- agentResource . addMethod (
299- 'ANY' ,
300- new LambdaIntegration ( agentBuilderFunction ) ,
301- commonAuthorizerProps
302- ) ;
290+ agentsResource
291+ . addResource ( '{proxy+}' )
292+ . addMethod (
293+ 'ANY' ,
294+ new LambdaIntegration ( agentBuilderFunction ) ,
295+ commonAuthorizerProps
296+ ) ;
303297 }
304298 }
305299}
0 commit comments