Skip to content

New serverless pattern - apigw-lambda-bedrock-code-interpreter-cdk#3185

Open
NithinChandranR-AWS wants to merge 1 commit into
aws-samples:mainfrom
NithinChandranR-AWS:NithinChandranR-AWS-feature-apigw-lambda-bedrock-code-interpreter-cdk
Open

New serverless pattern - apigw-lambda-bedrock-code-interpreter-cdk#3185
NithinChandranR-AWS wants to merge 1 commit into
aws-samples:mainfrom
NithinChandranR-AWS:NithinChandranR-AWS-feature-apigw-lambda-bedrock-code-interpreter-cdk

Conversation

@NithinChandranR-AWS

Copy link
Copy Markdown
Contributor

Description

AI data analyst: ask questions in natural language, Amazon Bedrock generates Python code, Amazon Bedrock AgentCore Code Interpreter executes it in a secure sandbox.

Architecture

Amazon API Gateway → AWS Lambda → Amazon Bedrock (code generation) → Amazon Bedrock AgentCore Code Interpreter (sandboxed execution) → results

Composition

  • Bedrock alone can't execute code
  • Code Interpreter alone can't decide what code to write
  • Combined = natural language to executed analysis in one API call

Deployed and tested

  • Stack deploys successfully in us-east-1
  • Bedrock generates correct Python for data questions
  • Code Interpreter executes in sandbox (no host access)
  • End-to-end: question → code → execution → results

Deploy Amazon API Gateway + AWS Lambda that uses Amazon Bedrock to
generate Python code from natural language questions, then executes it
safely in Amazon Bedrock AgentCore Code Interpreter.

Two-step composition: Bedrock reasons about what code to write, Code
Interpreter provides sandboxed execution. Neither works alone —
Bedrock can't run code, Code Interpreter can't decide what to run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants