Building IndentAI: Scaling Differentiated CS Education with Amazon Bedrock and Nova Pro
DEV Community

Building IndentAI: Scaling Differentiated CS Education with Amazon Bedrock and Nova Pro

  1. The Pedagogical Dilemma in Computer Science Classrooms Teaching computer science to a classroom of thirty students presents a fundamental structural challenge: skill distribution is rarely uniform. In any single introductory programming session, a subset of students struggles with foundational syntax and indentation semantics, while advanced learners complete the base prompt in minutes and require immediate algorithmic extension. When educators manually hand-craft differentiated exercises, diagnose abstract syntax errors, and scaffold problem sets in real time, cognitive overload inevitably causes a bottleneck. Generic, consumer-grade large language models frequently fail in classroom environments because they act as "answer dispensers," outputting copy-paste solutions that circumvent the cognitive friction required for true mastery. We engineered IndentAI to solve this problem: an autonomous, agentic curriculum differentiation engine powered by Amazon Bedrock and Amazon Nova Pro (us.amazon.nova-pro-v1:0 ). IndentAI diagnoses student code misconceptions via Abstract Syntax Tree (AST) inspection and dynamically synthesizes three tiered levels of pedagogical scaffolding, all governed through a real-time, human-in-the-loop Teacher Review Desk. 2. Architectural Blueprint IndentAI couples deterministic local evaluation with generative foundation model orchestration across three decoupling layers: - Deterministic Static Analysis Layer: Performs syntax parsing, node extraction, and execution safety checks via app/interpreter/engine.py andapp/interpreter/evaluator.py before invoking generative models[cite: 2]. - Generative Agent Layer: Uses Bedrock Foundation Models through streaming runtime protocols and containerized entrypoints in agentcore/ to synthesize contextual curriculum variants[cite: 2]. - Control & Oversight Layer: Exposes a FastAPI dashboard in app/main.py where teachers monitor real-time student sessions, verify AST diffs, and authorize agent-generated modifications[cite: 2]. +-------------------------------------------------------+ | Student Code Attempt | +---------------------------+---------------------------+ | v +-------------------------------------------------------+ | AST Evaluation & Diagnosis Engine | +---------------------------+---------------------------+ | +----------------+----------------+ | | (Syntax/Logic Flag) (Clean Parse) | | v v +-----------------------+ +-----------------------+ | Teacher Review Desk | | Amazon Bedrock (Nova) | +-----------+-----------+ +-----------+-----------+ | | +---------------+---------------+ | v +-------------------------------------------------------+ | 3-Tier Scaffolded Generation | | * Tier 1: Foundational (Syntax & Variable Scoping) | | * Tier 2: Intermediate (Algorithmic Edge-Cases) | | * Tier 3: Advanced (Complexity & Optimization) | +-------------------------------------------------------+ 3. Integrating Amazon Bedrock & Amazon Nova Models Why Amazon Nova Pro? IndentAI uses Amazon Nova Pro (us.amazon.nova-pro-v1:0 ) as its primary reasoning engine. Differentiated instructional design requires strict adherence to schema output formats (JSON test fixtures, assertion suites, and hint progressions) while retaining conversational empathy. Nova Pro delivers low token-to-first-byte latency along with the logical depth required to dissect broken Python loops without inventing hallucinations. The Bedrock Runtime Client Our runtime integration communicates with Bedrock through the ConverseStream and InvokeModel APIs: import json import os import boto3 from botocore.exceptions import ClientError class BedrockCurriculumProvider: def init(self): self.region = os.getenv("AWS_REGION", "us-east-1") self.model_id = os.getenv("BEDROCK_MODEL_ID", "us.amazon.nova-pro-v1:0") self.client = boto3.client( service_name="bedrock-runtime", region_name=self.region ) def generate_differentiated_scaffold(self, student_code: str, error_context: dict) -> dict: system_prompt = ( "You are an expert Computer Science Pedagogical Agent. " "Analyze the student's code and runtime error context. " "Generate three distinct pedagogical exercise tiers: Foundational, Core, and Advanced. " "Never give away the final solution outright. Adhere strictly to the requested JSON schema." ) prompt_body = ( f"Student Code:\n{% endraw %} python\n{student_code}\n {% raw %}\n" f"Diagnosis: {json.dumps(error_context)}" ) messages = [ { "role": "user", "content": [{"text": prompt_body}] } ] try: response = self.client.converse( modelId=self.model_id, messages=messages, system=[{"text": system_prompt}], inferenceConfig={"temperature": 0.2, "maxTokens": 2048} ) output_text = response["output"]["message"]["content"][0]["text"] return json.loads(output_text) except ClientError as err: return self._handle_runtime_fallback(err, student_code, error_context) 4. Resilience by Design: Dual-Engine Architecture School district IT infrastructure is notoriously brittle: proxy firewalls, bandwidth bottlenecks, or intermittent cloud outages cannot be allowed to disrupt an active programming lesson. To solve this, IndentAI incorporates a Dual-Engine Architecture: - Cloud Mode ( MODEL_PROVIDER=bedrock ): Connects to Amazon Bedrock Nova Pro to generate custom, unbounded classroom exercises in real time. - Deterministic Local Mode ( MODEL_PROVIDER=mock ): An offline AST fallback generator that evaluates student code structures and selects verified, pre-computed scaffolding tiers from a local SQLite repository atdata/lessons.db [cite: 2]. This approach guarantees that if network connectivity drops or account-level service quarantines occur, the educator's dashboard and student test runner continue operating with zero downtime. 5. Human-in-the-Loop: The Teacher Review Desk A foundational rule of the Agents for Humans paradigm is that autonomous agents must empower people rather than replace them. In IndentAI, generative outputs are never blindly pushed to a student's terminal: - Escalation Triggers: When a student fails a test assertion three consecutive times, the autonomous engine flags the session and routes the diagnostic state to the Teacher Review Desk[cite: 2]. - Pedagogical Inspection: The teacher sees the student’s current code, the AST node breakdown, and Nova Pro’s recommended 3-tier scaffolding plan. - Granular Intervention: With a single click, the educator can approve the agent’s suggestion, edit the hint parameters, or trigger an in-person conference. 6. Verification and Containerized Deployment To ensure production stability, the repository includes a self-contained container runtime defined in agentcore/Dockerfile , automated pre-flight checks in verify.py , and an end-to-end integration test suite[cite: 2]: # Verify local AST engine and pipeline assertions python verify.py pytest tests/ # Execute containerized runtime test docker build -t indentai-agentcore agentcore/ docker run -p 8000:8000 indentai-agentcore 7. Looking Forward Generative AI in education must move beyond generic chatbots. By anchoring high-performance foundation models like Amazon Nova Pro behind deterministic AST parsers and educator review desks, systems can deliver individualized instruction at scale while protecting the classroom's pedagogical integrity. - GitHub Repository: https://github.com/Mounirho22/IndentAI - Built For: AWS Agents for Humans Hackathon (Devpost) Top comments (0)
Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.