AWS Builder Center

Production-Ready AI Agents for Loan Underwriting with Temporal and AWS

This post explores how Temporal's Durable Execution platform, Amazon Bedrock AgentCore, and the Strands Agents SDK can be used to build AI-powered loan underwriting systems, covering agent orchestration, state persistence, parallel AI assessments, and human-in-the-loop workflows with a full audit trail.

Financial institutions are rapidly adopting agentic AI to modernize loan underwriting while maintaining regulatory compliance. However, moving AI agents from proof-of-concept to production presents significant challenges: handling provider failures gracefully, maintaining state across long-running workflows, and ensuring complete auditability for regulators.
In this post, we demonstrate how  Temporal’s Durable Execution platform , combined with Amazon Bedrock AgentCore, enables financial institutions to build resilient, scalable AI-powered loan underwriting systems. We showcase a reference architecture featuring intelligent agent orchestration, multi-provider fallback patterns, and human-in-the-loop workflows.
 Temporal , an AWS Advanced Technology Partner, is used by major financial institutions, frontier AI labs, Fortune 500 companies, and cutting-edge startups to orchestrate mission-critical workflows at scale. Companies like Stripe, Netflix, Macquarie Bank, Intuit, ANZ Bank, Brex, Coinbase, and many others rely on Temporal for reliable, long-running process orchestration.

The challenge: Production-grade AI in regulated environments

Building AI agents for loan underwriting presents unique challenges that typical orchestration tools struggle to address:
  • Provider reliability: Credit bureaus and verification services experience outages. When your primary credit bureau’s API times out, applications get stuck, requiring costly manual intervention.
  • Long-running workflows: Current loan underwriting architectures lack native support for durable state transitions over extended timeframes. As a result, developers spend cycles manually implementing orchestration logic and fault tolerance rather than focusing on business differentiators.
  • Regulatory compliance: Every decision must be auditable with complete traceability. Regulators need to see exactly which data sources, AI models, and human reviewers influenced each decision.
  • LLM unpredictability: AI agents make non-deterministic decisions at runtime. Systems must recover gracefully from rate limits, and API failures without losing progress.
Industry data shows traditional commercial loan underwriting takes 30–45 days, with engineering teams spending up to 40% of their time building custom infrastructure for retry logic, provider fallback, and failure recovery.



Solution architecture

Our reference architecture combines three key technologies:

1. Temporal: Durable Execution for AI agents

Temporal provides the foundation for reliable AI agent execution. Key capabilities include:
Automatic state persistence: Every Workflow step is recorded. If a Worker crashes mid-execution, Temporal replays the Workflow to exactly where it left off, using recorded results rather than re-executing completed steps.
Configurable retry policies: Activities (external API calls) automatically retry with exponential backoff. When retries are exhausted, Workflows can seamlessly invoke fallback providers.
Human-in-the-loop via Signals: Workflows can pause indefinitely awaiting human approval without holding idle resources, relying on Signals to trigger resumption once decisions are made.
Temporal Nexus: Connect applications across Namespaces with service contracts. Nexus enables teams to share capabilities while maintaining isolation, security, and independent scaling. Nexus supports multi-region connectivity within and across AWS and GCP in Temporal Cloud.
Temporal integrates seamlessly with AI frameworks like OpenAI AgentsSDK, Pydantic AI, AI SDK by Vercel and Strands Agents SDK, among others, providing Durable Execution for agents powered by Amazon Bedrock foundation models such as Anthropic Claude and Amazon Nova.

2. Amazon Bedrock AgentCore: Enterprise agent infrastructure

 Amazon Bedrock AgentCore  provides the managed infrastructure for deploying and operating AI agents at scale. AgentCore services work with any framework (including Temporal-orchestrated agents) and any foundation model:
 AgentCore Runtime : Serverless execution with session isolation, supporting long-running workloads without infrastructure management.
 AgentCore Memory : Persistent context storage maintaining agent knowledge across sessions, with built-in strategies for summarization, user preferences, and semantic memory.
 AgentCore Gateway : Secure tool access by transforming APIs and Lambda functions into agent-compatible tools, with native MCP (Model Context Protocol) server support.
 AgentCore Policy : Fine-grained permissions using Cedar policy language to control which tools and data agents can access.

3. Strands Agents: Model-driven agent development

 Strands Agents  is an open-source framework from AWS that simplifies agent development through its model-driven approach. Agents are created using three components: foundation models (Anthropic Claude for complex reasoning,  Amazon Nova  for cost-effective processing, Meta Llama), tools (over 20 built-in, plus custom tools via Python decorators), and prompts that guide agent behaviour. Strands provides native integrations with AgentCore services and supports multi-agent patterns including handoffs and swarm architectures.

Loan underwriting Workflow execution flow

The loan underwriting Workflow executes in four phases:
Data acquisition: Features automated failover for credit bureau data retrieval. Once acquired, data is validated, cleansed, and normalized within the Workflow context, ensuring downstream logic operates solely on trusted datasets. Orchestration and fallback are handled by Temporal without losing context.
AI-powered agentic assessment: Parallel specialist assessments using Amazon Bedrock. Income, expense, and credit assessments run concurrently; each calling foundation models with structured output validation.
Human-in-the-loop decision: The Workflow pauses and exposes queries for the underwriter dashboard. Human reviewers access AI-generated summaries, risk scores, and data provenance. Upon approval or rejection, a Signal resumes the Workflow.
Finalization: The decision is recorded in Temporal’s immutable Event History, downstream systems notified via Amazon EventBridge and database integration, and a customer notification is sent.
In this architecture, we combine Temporal Cloud,  Amazon EKS Fargate , and Amazon Bedrock AgentCore to build a scalable, resilient, AI powered and audit-ready loan underwriting system. The design separates orchestration, compute, AI reasoning, and human approval into clean architectural layers.
AWS - Temporal Workflow

Let’s walk through the end-to-end flow.
Step 1: Customer application submission
A customer submits a loan application through a web application hosted on  Amazon S3  and delivered via  Amazon CloudFront .
The backend service, running on  AWS App Runner , acts as the gateway API layer. It initializes a durable loan-processing Temporal Workflow by invoking the Temporal Client, which connects with Temporal Cloud to orchestrate the  SupervisorWorkflow(Temporal Workflow)  execution.
What goes behind the scenes at this stage:
  • A durable Workflow Execution is created using the Temporal SDK and recorded on a Task Queue within a Namespace in Temporal Cloud.
  • State persistence, timers, and retry logic are automatically managed by Temporal.
  • No custom state database is required.
Step 2: Data acquisition phase
In this phase, we acquire required data from different sources across multiple steps.
Step 2a: Document upload, progress and Temporal Workflow signaling, querying
The applicant uploads supporting documents (bank statements, ID proof, address proof). These files are stored securely in Amazon S3.
Instead of polling for updates, the backend uses a Temporal Signal to notify the running Workflow that documents are available. Temporal resumes the Workflow from its persisted state. To check the progress of a Workflow, we use Temporal Queries.
This enables asynchronous, event-driven progression without losing context.

Step 2b: Bank account data retrieval

The Workflow schedules an Activity to retrieve banking data.
A Temporal Worker running on Amazon EKS Fargate executes the Temporal Activity. It securely invokes external banking APIs with built-in retries, timeout handling, and validation logic.
EKS Fargate automatically scales Temporal Worker pods based on Task Queue depth, eliminating cluster management overhead.

Step 2c: Parallel document processing with Amazon Bedrock

Next, the Workflow orchestrates parallel OCR processing of uploaded documents using Strands Agent SDK within a Temporal Activity.
Each Activity:
  • Runs on a Temporal Worker in EKS Fargate.
  • Extracts structured JSON from documents independently.
Because Temporal supports native parallel orchestration, all documents are processed concurrently, significantly reducing turnaround time.

Step 2d: Credit bureau integration with automatic fallback

The Workflow retrieves the applicant’s credit report using a resilient, provider-agnostic design:
  1. Attempt retrieval from the primary credit bureau.
  1. If it fails, automatically fallback to a secondary bureau.
Retry policies, timeout thresholds, and fallback sequencing are defined declaratively in the Workflow. Workers execute the calls, while Temporal guarantees deterministic execution and durability.

Step 3: Parallel specialized agent assessment using AgentCore Code Interpreter and Strands Agents SDK

The Workflow now initiates financial analysis in parallel tracks, enabling consistent, explainable financial evaluation.

Step 3a: Income assessment

For the income assessment stage, we use:
●  Amazon Bedrock AgentCore Code Interpreter  to execute Python logic in a secured sandbox for calculations like debt-to-income (DTI) ratio and income trend analysis, etc. to execute Python logic in a secured sandbox for calculations like debt-to-income (DTI) ratio and income trend analysis, etc.
● AgentCore Memory to retrieve historical underwriting patterns for contextual comparison.

Step 3b: Expense assessment

In parallel, another Activity analyzes spending behavior. We again use Amazon Bedrock AgentCore Code Interpreter for analysis such as bank statement data categorization, spending anomaly detection, and recurring liability identification.
Persistent categorization context is maintained via AgentCore Memory.

Step 3c: AI-based credit risk assessment

Finally, a Strands Agent invokes Amazon Bedrock to evaluate credit score, financial indicators, and policy thresholds. The reasoning engine produces a structured risk assessment aligned with underwriting guidelines.
All these steps execute concurrently using Temporal’s parallel orchestration model, reducing overall assessment time from sequential processing to near–real-time aggregation.

Step 4: Decision aggregation and recommendation

Once all assessments complete, the Temporal Workflow schedules an Activity to aggregate results.
An LLM-powered agent:
● Synthesizes income, expense, and credit analysis.
● Produces a comprehensive loan recommendation.
● Includes explainable reasoning.
The decision rationale is stored in AgentCore Memory. Optionally, access to decision artifacts can be governed through policy controls (for example, Cedar-based enforcement).

Step 5: Human-in-the-loop with durable SLA

The Workflow enters a durable wait state, notifying the user while awaiting underwriter review.
Key characteristics:
  • No compute resources are consumed while waiting.
  • State remains fully persisted in Temporal Cloud.
  • The underwriter dashboard queries Workflow state using Temporal’s Query API.
  • The final decision is submitted via a Temporal Signal.
Upon receiving the Signal:
  • The Workflow resumes instantly.
  • The final decision is recorded and eventually persisted in the database. Downstream systems are notified via Amazon EventBridge, and a customer notification is sent using Amazon SNS.
  • A complete, immutable Event History is retained for audit and regulatory compliance, which can be seamlessly exported to an Amazon S3 bucket.

Why Temporal + AWS?

The following table compares traditional approaches with the Temporal + AWS solution:
Challenge
Traditional approach
Temporal + AWS solution
State management
Custom DB design + application code
Automatic persistence
Retry logic
Manual exponential backoff implementation
Configurable retry policies
Provider fallback
Complex orchestration + monitoring
Workflow-level declarative fallback
Human approval
Polling database or message queues
Temporal Signals (push-based)
Audit trail
Custom event store + compliance reports
Immutable Event History
Recovery
Manual identification + restart
Automatic replay from checkpoint



Key benefits

Operational resilience: Provider failures become invisible. When primary credit bureau APIs fail, secondary providers automatically take over. Workflows recover from any failure without losing state.
Faster development: As one senior engineering manager reflected: “We’re building foundations that allow us to deliver bigger and better features faster that didn’t even seem possible years ago.” ( Link )
Regulatory compliance: Temporal’s immutable Event History provides complete audit trails showing every API call, retry, fallback decision, AI model invocation, and human action.
Cost optimization: Intelligent recovery minimizes wasted LLM tokens. When failures occur, only failed steps retry, and completed AI assessments use recorded results rather than re-invoking models.



Implementation considerations

Security best practices

Encrypt sensitive data at rest and in transit using AWS KMS and the Temporal Data Converter + Codec pattern. Store API credentials in AWS Secrets Manager with automatic rotation. Deploy Temporal Workers in private subnets with VPC endpoints (PrivateLink) for third-party API access. Use AgentCore Policy to enforce fine-grained access controls on agent tool invocations.

Deployment options

Temporal Cloud provides managed infrastructure with a 99.9% uptime SLA for a single region, a 99.99% uptime SLA for multi-region High Availability, and built-in Nexus connectivity across AWS and GCP regions. You can seamlessly run Temporal Workers on Amazon ECS or Amazon EKS.

Protocol support: MCP and A2A

This architecture can leverage modern agent communication protocols. The  Model Context Protocol (MCP)  standardizes how agents connect with tools and external services. AgentCore Gateway natively supports MCP servers, enabling agents to access credit bureau APIs, document verification services, and fraud detection systems through a unified interface.
Temporal supports implementing MCP tools as durable Workflows, providing reliability guarantees for tool execution. When an agent invokes a credit check via MCP, Temporal ensures the request completes successfully even if the underlying service experiences transient failures.
The  Agent-to-Agent (A2A) protocol  enables multi-agent collaboration. Specialized agents for income verification, credit assessment, and fraud detection can communicate and coordinate through standardized interfaces, orchestrated by Temporal Workflows that maintain overall transaction integrity.

Monitoring and observability

Production AI agents require comprehensive observability. This architecture provides visibility at multiple layers:
Temporal Web UI: Real-time visibility into Workflow state, Execution timeline, and which Activities succeeded or failed. Query running Workflows to check status without examining logs.
 AgentCore Observability : Integrated metrics, logs, and traces with Amazon CloudWatch and OpenTelemetry support. Visualize agent execution paths, tool call latency, and LLM response times..
 Datadog integration : Temporal Cloud offers native Datadog integration for unified monitoring across your entire stack.
Key metrics to monitor include Workflow success/failure rates, provider fallback frequency, AI model latency, human review SLA compliance, and cost per application processed.



Getting started

1. Temporal Cloud: Sign up for Temporal Cloud via AWS Marketplace  here  and receive $1,000 in free credits. Use the  Terraform provider  for infrastructure-as-code management.
2. Amazon Bedrock AgentCore: Visit the AgentCore Developer Guide to deploy your first agent. The AgentCore SDK has been downloaded over two million times since its Public Preview launch.
3. Reference implementation: Access our  complete loan underwriting sample  on GitHub.

Conclusion

The combination of Temporal’s Durable Execution platform, Amazon Bedrock AgentCore, and Strands Agents provides a production-ready foundation for AI-powered loan underwriting. Financial institutions can deliver faster loan decisions while maintaining complete regulatory compliance, reduce operational costs through automated failure recovery, and innovate rapidly without sacrificing reliability.

About the authors

Rick Ross

Rick Ross works at Temporal Technologies as a Staff Solutions Architect, where he helps organizations create reliable applications, simplifying their code and enabling them to deliver features faster.
Prior to Temporal, Rick was a Customer Engineer Specialist for the Central Region at Google Cloud, helping the field with deeper technical conversations around all things related to containers. He has also worked at Pivotal and Kony in pre-sales roles, consulting with organizations of all sizes, and has architected, designed, and shipped software.
He is a published author and has spoken at technical conferences around the world.
Darshit Vora

Darshit Vora is a Staff Solutions Architect at Temporal, partnering with customers across India and APJ to design durable, scalable, and fault-tolerant mission-critical distributed systems using Temporal. He enables organizations to modernize business-critical workflows and adopt resilient architectures on cloud platforms.
Previously, he was a Senior Startup Solutions Architect at AWS, guiding startups in building cloud-native applications, modern data platforms, and scalable infrastructure. Earlier, he served as a Software Engineer at MAQ Software and later as VP and CTO of an HR-tech startup, leading engineering strategy and platform architecture. He has spoken at various technical conferences.
Arun Selvaraj

Arun is a Senior Solution Architect within the FSI specialist team at AWS. He brings deep expertise in FSI and focuses on building joint solutions and go-to-market motions with FSI partners, helping them navigate technical challenges when implementing industry-specific use cases. Prior to AWS, he served in technical leadership roles at leading banks and FinTech’s. He specializes in architecting resilient, secure applications on the cloud tailored specifically for Financial Services.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article