AWS Builder Center
AIdeas: AI Immigration Compliance Copilot

AIdeas: AI Immigration Compliance Copilot

AI Immigration Compliance Copilot is an interactive tool that helps international students on OPT and STEM OPT understand their timelines, assess compliance risk, and explore “what if” scenarios safely. It combines a Timeline Generator, Compliance Risk Analyzer, and Scenario Simulator into one clear dashboard, turning complex immigration rules into actionable insights and reducing uncertainty through real-time feedback.

My Vision

AI Immigration Compliance Copilot is an interactive suite designed to help F-1 OPT and STEM OPT students stay compliant with U.S. immigration regulations. The app consists of four connected workflows:
1. Timeline Generator - calculates your OPT/STEM OPT timelines, including start/end dates, grace periods, and current status.
2. Compliance Risk Analyzer - evaluates hypothetical scenarios, determines risk levels (Low/Medium/High), and provides recommended actions.
3. Scenario Simulator - allows students to experiment interactively with “what if” scenarios (like job loss or unemployment), immediately updating timelines, risk indicators, and suggested actions.
  1. AI Chat Assistant - conversational AI powered by Amazon Bedrock
By combining calculation, analysis, and simulation, students can understand cause-and-effect relationships in OPT compliance without risking their actual status.

Why This Matters

Navigating OPT and STEM OPT compliance is complex and stressful. Missing key dates or mismanaging unemployment days can lead to serious consequences. The app empowers students by:
  • Providing clear visualizations of timelines and status
  • Highlighting risk levels before violations occur
  • Offering recommended actions aligned with USCIS and DSO guidelines
  • Allowing safe, interactive scenario experimentation
This increases awareness, reduces compliance errors, and gives students actionable insight into their immigration status.

How I Built This

The app is built as a fully serverless TypeScript application leveraging multiple AWS services:
Architecture & AWS Services

Frontend (Amazon S3 Static Website Hosting)

  • Two interactive web pages: Timeline Generator and Scenario Simulator
  • Real-time UI updates with TypeScript
  • Responsive design for mobile and desktop

Backend (AWS Lambda + Node.js 20.x)

Six Lambda functions handling:
  1. Timeline calculation and status assessment
  2. Scenario analysis and risk classification
  3. Interactive simulation with parameter adjustments
  4. AI-powered explanations (3 functions: explain, chat, assist)
Serverless execution with automatic scaling

API Layer (Amazon API Gateway)

REST API with seven endpoints:

  • POST /timeline - Generate OPT timelines
  • POST /scenarios - Analyze compliance scenarios
  • POST /simulator - Run interactive simulations
  • GET /sessions/{sessionId} - Retrieve saved sessions
  • POST /ai/explain - AI risk explanations
  • POST /ai/chat - What-if Q&A
  • POST /ai/assist - General compliance questions
CORS-enabled for browser access
Integrated with Lambda via proxy integration


Data Persistence (Amazon DynamoDB)

  • Single-table design for session storage
  • Automatic TTL (Time To Live) for 30-day cleanup
  • Stores timeline results, risk assessments, and user inputs
  • Session retrieval via unique sessionId
  • On-demand capacity for cost optimization

Key Development Milestones

1. Built Timeline Generator and verified correctness with unit and property tests.
2. Developed Compliance Risk Analyzer, integrating risk logic and recommended actions.
3. Implemented Scenario Simulator MVP, including:
Baseline entry and reset
Parameter adjustment (job loss date, unemployment days, OPT start date)
Real-time timeline and risk updates
Integration with Timeline Generator and Scenario Analyzer
Educational disclaimers and DSO guidance
  1. Deployed serverless backend with AWS Lambda and API Gateway
  2. Added DynamoDB persistence for session management and historical tracking
  3. Configured automatic cleanup with DynamoDB TTL to stay within AWS Free Tier
  4. Integrated Amazon Bedrock with Claude 3 Haiku for conversational AI assistance
  • Natural language explanations of risk assessments
  • What-if scenario Q&A with context awareness
  • Safety guardrails to prevent legal advice
  • Cost-effective implementation (~$3-5/month after free trial)

Future Enhancements

The current MVP focuses on deterministic compliance logic and real-time scenario simulation. Future iterations could extend the system using additional AWS services:
• Amazon EventBridge to trigger compliance reminders for key OPT deadlines
These services were intentionally excluded from the MVP to maintain clarity, cost efficiency, and explainability during early validation.

Demo

Here’s how the app flows in practice:
1. Timeline Generator - Students enter their OPT/STEM OPT start dates and current status. The timeline displays all key dates and current status (Pre-OPT, Active OPT, Grace Period, Expired). Results are automatically saved to DynamoDB with a unique session ID.
2. Compliance Risk Analyzer - Input a scenario, e.g., losing a job or reaching unemployment limits. The analyzer calculates risk levels and outputs recommended actions, like reporting to the DSO or documenting job search activities.
3. Scenario Simulator - Students can adjust parameters interactively:
  • Change unemployment days or add a job loss date
  • Adjust current date or OPT start date
  • Reset to baseline to restore original values
  • Sessions persist in DynamoDB for 30 days
4. AI Chat Assistant - Students can ask natural language questions:
  • "What happens if I lose my job?"
  • "How many unemployment days do I have?"
  • "Can I work part-time on OPT?"
  • AI provides educational explanations with safety disclaimers
  • Responses are context-aware based on user's situation
All updates happen in real-time, with risk indicators and recommended actions dynamically reflecting changes.
  1. Session Retrieval - Students can retrieve previous calculations using their session ID, enabling continuity across visits.
Demo Video (under 5 minutes):

Screenshots:

Timeline Generator interface
Timeline
Risk Analyzer output
Risk
Scenario Simulator interactive controls
Scenario Simulator

What I Learned

Serverless architecture simplifies deployment
  • Integration is key - connecting Timeline Generator and Risk Analyzer to the simulator provided a cohesive experience and reduced duplicated logic.
  • No infrastructure management means faster iteration and deployment cycles.
  • Real-time feedback improves usability - students can experiment and immediately see consequences of hypothetical decisions through Lambda's fast response times.
  • Validation matters - carefully handling edge cases (negative unemployment, invalid dates, non-compliance scenarios) ensures trust in the tool.
  • Data persistence adds value - DynamoDB session storage enables students to track their compliance journey over time.
  • AWS Free Tier is powerful - A fully functional, production-ready application can run entirely within free tier limits.
  • Clear communication - risk levels, recommended actions, and disclaimers must be visually distinct and easy to understand.
  • AI integration enhances user experience - Amazon Bedrock provides natural language explanations that make complex regulations more accessible
  • Cost-effective AI is achievable - Claude 3 Haiku delivers quality responses at ~$0.01-0.05 per conversation
  • Safety guardrails are essential - System prompts prevent AI from giving legal advice while maintaining educational value
This project reinforced best practices in modular design, state management, and user-centered interactive design.
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