How kaushaldesai04/sfn-agentic-workflow-automation works
This is an AWS CDK application for bounded, agent-assisted business request routing. A client submits a request through API Gateway; the request handler starts a Standard Step Functions workflow, which validates input, invokes a Bedrock Agent, deterministically validates its recommendation, then routes eligible decisions to destination queues and persists results. Invalid inputs and agent failures are handled in the workflow. The graph also shows the contracts, persistence, and monitoring layers. Lambda internals are included where the source index establishes their responsibilities; some service wiring is visible only in the infrastructure excerpts.
Main entry points: workflow.py Step Functions workflow · stack.py Application stack · monitoring.py Monitoring and alarms · api.py API Gateway
Components 19
Request ingress
- API Gateway
agentic_workflow/constructs/api.py - Request handler
functions/request_handler/handler.py - Workflow request contract
shared/contracts/workflow_request.py
Workflow orchestration
- Step Functions workflow
agentic_workflow/constructs/workflow.py - Request validation
functions/validate_request/handler.py - Decision policy validator
functions/validate_decision/handler.py - Routing policy
shared/policy.py
Agent decisioning
- Bedrock adapter
functions/bedrock_adapter/handler.py - Agent invocation
functions/bedrock_adapter/invoke_agent.py - Response parser
functions/bedrock_adapter/response_parser.py - Bedrock Agent
agentic_workflow/constructs/bedrock_agent.py - Agent decision contract
shared/contracts/agent_decision.py
Routing and results
- Destination queues
agentic_workflow/constructs/data.py - Result persister
functions/persist_result/handler.py - Results table
agentic_workflow/constructs/data.py
Configuration and monitoring
- Monitoring and alarms
agentic_workflow/constructs/monitoring.py - Environment configuration
agentic_workflow/config.py - Application stack
agentic_workflow/stack.py
Other components
- Request client
Connections 24
- Request client → API Gateway: submits request
README.md - API Gateway → Request handler: routes POST
agentic_workflow/constructs/api.py - Request handler → Workflow request contract: validates request
functions/request_handler/handler.py - Request handler → Step Functions workflow: starts execution
agentic_workflow/constructs/workflow.py - Step Functions workflow → Request validation: invokes first
agentic_workflow/constructs/workflow.py - Step Functions workflow → Bedrock adapter: invokes agent task
agentic_workflow/constructs/workflow.py - Bedrock adapter → Agent invocation: delegates invocation
functions/bedrock_adapter/handler.py - Bedrock adapter → Response parser: parses completion
functions/bedrock_adapter/handler.py - Agent invocation → Bedrock Agent: invokes agent
- Response parser → Agent decision contract: validates decision
functions/bedrock_adapter/response_parser.py - Step Functions workflow → Decision policy validator: validates recommendation
agentic_workflow/constructs/workflow.py - Decision policy validator → Agent decision contract: checks decision
functions/validate_decision/handler.py - Decision policy validator → Routing policy: applies policy
functions/validate_decision/handler.py - Step Functions workflow → Destination queues: sends routed message
agentic_workflow/constructs/workflow.py - Step Functions workflow → Result persister: invokes persistence
agentic_workflow/constructs/workflow.py - Step Functions workflow → Results table: grants write access
agentic_workflow/constructs/workflow.py - Result persister → Results table: writes result
- Monitoring and alarms → Step Functions workflow: monitors executions
agentic_workflow/constructs/monitoring.py - Monitoring and alarms → API Gateway: monitors errors
agentic_workflow/constructs/monitoring.py - Monitoring and alarms → Destination queues: alarms on queues
agentic_workflow/constructs/monitoring.py - Application stack → Step Functions workflow: assembles construct
agentic_workflow/stack.py - Application stack → API Gateway: assembles construct
agentic_workflow/stack.py - Application stack → Monitoring and alarms: assembles construct
agentic_workflow/stack.py - Application stack → Environment configuration: passes configuration
agentic_workflow/stack.py