Technical overview · Amazon Bedrock AgentCore

Orchestrating asynchronous AI agents with AWS Step Functions.

In this SDLC solution, Step Functions coordinates the generation of requirements, software design and user stories. The workflow sequences agents, waits for their callback results and makes progress visible.

Services and mechanisms
  • AWS Step Functions
  • waitForTaskToken
  • Amazon EventBridge
  • AWS Lambda
  • AgentCore Runtime
  • Amazon S3
  • Amazon DynamoDB
  • Heartbeats
  • Terraform
Lifecycle

From submitted file to completed job.

The workflow follows an explicit sequence and updates its state at each transition, from initialisation through success or failure.

1. Event trigger

An EventBridge rule detects creation of the S3 object matching */intents-final/intents.md, then starts the state machine with the intent references.

2. Job initialisation

The workflow creates the job in DynamoDB and sets each step to PENDING. A step changes to RUNNING when its processing begins.

3. Sequential generation

Agents generate requirements (requirements), software design (swDesign) and then user stories (userStories), in sequence.

4. Completion and status

After each callback, Step Functions marks the step DONE and continues. An error sets the step and job to FAILED, with details retained.

Long-running tasks

Wait for an agent without keeping Lambda busy.

The waitForTaskToken callback pattern lets the workflow wait while an agent works, without keeping the invocation Lambda active until generation finishes.

Task hand-off

For each document, Step Functions provides a task token to the invocation Lambda. It passes the deliverable type, input S3 keys and token to the generate-agent, which then starts processing in the background.

Waiting and heartbeat

The Step Functions execution waits for the callback. While processing, the agent periodically renews the wait with a heartbeat; the Terraform definition specifies a 120-second heartbeat and a maximum task duration of 3,600 seconds.

Processing result

When the document is ready, the agent writes it to S3 and calls SendTaskSuccess. If a problem occurs, it calls SendTaskFailure; the workflow follows its failure path and retains the error status for inspection.

Operational tracking

DynamoDB exposes status; S3 stores the deliverables.

Job tracking is separate from document storage. This lets the application show progress without reading execution logs or passing documents through workflow messages.

Status in DynamoDB

The table stores the overall status, current step, timestamps, per-deliverable states, generated file references and error information.

Lookup by intent

The intent-agent finds jobs associated with the intent key through the intentKey-index secondary index, then returns the results to the interface.

Progress in the interface

After submission, the frontend polls JOB_STATUS every seven seconds. The display updates, and polling stops when the job is DONE or FAILED.

Responsibilities

One service, one role in the pipeline.

  • EventBridge detects creation of the final intent and triggers the execution.
  • Step Functions enforces the sequence, manages transitions, waits for callbacks and coordinates success and failure paths.
  • The invocation Lambda passes the task, S3 references and task token to the generate-agent.
  • The generate-agent on AgentCore Runtime creates the document, stores it in S3 and reports its result to the workflow.
  • DynamoDB provides the application with a queryable view of progress, while S3 remains the document repository.

The workflow definition also provides targeted retries for certain invocation and heartbeat errors. Execution details remain available in Step Functions history, and errors are recorded in the job data.