Agentic CFD Workflow

Inspiration

Engineers spend weeks manually iterating on CFD simulations to optimize designs. What if an AI agent could autonomously orchestrate the entire workflow—generating geometries, running simulations, analyzing results, and proposing better candidates?

What it does

An autonomous CFD optimization system powered by AWS Bedrock Agent that orchestrates multiple Lambda-based tools through intelligent decision-making:

  • Generates NACA airfoil geometries from design parameters
  • Simulates aerodynamics using physics-based models (mock CFD)
  • Optimizes designs using trust-region algorithms
  • Converges automatically when improvement plateaus
  • Reports comprehensive optimization summaries

The agent runs 5-8 iterations autonomously, minimizing drag while maintaining lift constraints—all managed by a Step Functions workflow with zero human intervention.

How we built it

Architecture: Bedrock Agent → Step Functions → 7 Lambda Functions → S3 Storage

Tech Stack:

  • AWS Bedrock Agent (Claude 3 Sonnet) for intelligent orchestration
  • AWS Step Functions for autonomous loop management
  • AWS Lambda (Python 3.12) for tool implementations
  • S3 for session-based data persistence
  • AWS CDK for infrastructure-as-code

Key Components:

  1. Agent Tools (3 Lambdas):

    • generate_geometry - Creates airfoil designs from NACA parameters
    • run_cfd - Simulates lift/drag coefficients
    • get_next_candidates - Proposes optimized designs using trust-region strategy
  2. Orchestration (4 Lambdas):

    • initialize_optimization - Creates S3 session with unique ID
    • invoke_bedrock_agent - Wraps agent API for Step Functions
    • check_convergence - Detects when improvement < 0.5%
    • generate_report - Summarizes optimization trajectory
  3. State Machine - Manages iteration loops with safety limits and error handling

Challenges we ran into

  1. Bedrock Agent Event Format - Spent 2 hours debugging nested parameter structures unique to Bedrock
  2. Rate Limiting - Aggressive Bedrock throttling required exponential backoff and careful testing
  3. IAM Permissions - Agent role needed explicit bedrock:InvokeModel permission not in docs
  4. Agent Reasoning Reliability - Initial failures were actually mock data quality issues, not orchestration
  5. State Management - Designing iteration counters in Step Functions to prevent infinite loops
  6. Zero Dependencies - Lambda constraints required pure Python CSV parsing instead of Pandas

Accomplishments that we're proud of

Full Autonomy - System runs 5+ iterations without human intervention
Intelligent Orchestration - Agent makes smart decisions about exploration vs exploitation

What we learned

  1. Agent orchestration is the hard part - Once proven, swapping mock tools for real CFD is straightforward
  2. Prompt engineering is critical - Agent decision quality depends heavily on tool descriptions and system prompts
  3. Event formats vary by service - Always check AWS docs for exact schemas
  4. Design for swappability - Interface stability matters more than implementation details
  5. Rate limits are real - Test throttling behavior early, not during demos
  6. State machines are powerful - Step Functions provides elegant loop management with built-in retry logic

What's next for Agentic CFD Workflow

Immediate:

  • CLI interface with live progress visualization (Day 4)
  • Replace S3 with DynamoDB for structured queries
  • Add CloudWatch dashboards for monitoring

Real CFD Integration:

  • Swap generate_geometry with gmsh/Construct2D mesh generation
  • Replace run_cfd mock with SU2/OpenFOAM simulations
  • Integrate AWS Batch for parallel CFD runs
  • Add Docker containers for solver environments

Advanced Features:

  • Surrogate modeling for faster convergence
  • Multi-objective optimization (minimize drag AND cost)
  • Multi-fidelity workflows (coarse → fine mesh)
  • 3D geometry optimization
  • Integration with CAD systems

Production Readiness:

  • Cost optimization (spot instances, preemptible compute)
  • SNS notifications on completion/failure
  • Web dashboard for result visualization
  • Team collaboration features

The Vision: Make CFD optimization accessible to engineers who don't have weeks to manually iterate. Let AI handle the tedious orchestration while humans focus on high-level design decisions.

Built With

Share this project:

Updates