AWS Step Functions sequential agents on Amazon Bedrock AgentCore harness with human approval

Run two Amazon Bedrock AgentCore harness agents in sequence on a CSV file in Amazon S3, then wait for an approver who signs in with Amazon Cognito.

Uploading a CSV file under input/ in an Amazon S3 bucket starts this AWS Step Functions workflow through Amazon EventBridge. The workflow calls one Amazon Bedrock AgentCore harness twice in sequence through the optimized InvokeHarness integration, so there is no agent code to deploy.
The first call writes Python that runs in a custom AgentCore Code Interpreter, works out revenue and return rates by region, and saves the figures as JSON under results/. The workflow reads that file with an S3 GetObject task and checks the figures in a Choice state. The second call turns them into a short executive report.
The workflow emails the report through Amazon SNS with Approve and Reject links and waits up to 24 hours. The approver signs in with Amazon Cognito, and an AWS Lambda function behind Amazon API Gateway returns the decision, which goes to Amazon DynamoDB with the report. A failed check stops the workflow before approval.

< Back to all workflows

GitHub icon View this workflow on GitHub


Clone repo

git clone https://github.com/aws-samples/step-functions-workflows-collection/tree/main/sfn-agentcore-harness-sequential-approval/cd step-functions-workflows-collection/sfn-agentcore-harness-sequential-approval

Deploy

sam buildsam deploy --guided


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Stop running executions, empty the bucket and stop any Code Interpreter session, then delete the stack: sam delete.

Created by:

Surya Sai D

Surya Sai D

Surya works as a Technical Account Manager at AWS. He is an expert in Serverless frameworks and Event Driven Architectures. Surya is also passionate on technical writing and has contributed to AWS blogs and other Open Source Content.