Overview
Sprout’s intelligence comes from seven specialized AI agents powered by Claude. Each agent has a specific role in designing, personalizing, and delivering your learning experience. All agents run through a shared agent loop that handles multi-turn tool calling, retry logic, and reasoning visibility.Unlike traditional tutoring systems that follow pre-programmed rules, Sprout’s agents use Claude’s reasoning capabilities to make real-time decisions about your learning path.
Agent Loop Architecture
Every agent follows the same execution pattern:Key Features
Reasoning Visibility
The
onThinking callback captures Claude’s reasoning text between tool calls, streamed as SSE events so you can watch agents think.Retry with Backoff
429 rate limits are automatically retried with exponential backoff (2s, 4s, 8s) ensuring reliable execution.
Configurable Iterations
Default 15 iterations for complex tasks, tutor uses 5 for faster response times.
The Seven Agents
1. Topic Agent
Purpose: Design a complete learning path of 6-10 concepts for any topic.- Tools
- Flow
- Small Mode
| Tool | Description |
|---|---|
extract_all_concept_contexts | Batch-extract relevant document sections for all concepts |
save_concept | Create a concept node in the database |
save_concept_edge | Create a dependency edge between concepts |
2. Subconcept Bootstrap Agent
Purpose: Build the detailed learning structure for a single concept—diagnostic questions and a subconcept DAG.- Tools
- Flow
- Small Mode
| Tool | Description |
|---|---|
save_diagnostic_question | Create MCQ or open-ended diagnostic questions |
save_subconcept | Create a subconcept node |
save_subconcept_edge | Wire dependency edges between subconcepts |
Subconcept bootstrap agents run in parallel with a concurrency limit of 3 to balance speed and API rate limits.
3. Concept Refinement Agent
Purpose: Personalize the subconcept graph after you answer diagnostic questions. This is Sprout’s star feature.The Concept Refinement Agent follows an Observe-Reason-Act-Verify loop—the most sophisticated agent in the system.
- Tools
- ORAV Loop
- Adaptations
| Tool | Description |
|---|---|
grade_student_answers | Grade diagnostic answers via grading sub-agent |
get_current_subconcepts | View the existing subconcept graph structure |
check_student_history | Cross-concept performance (mastery, completed nodes, level) |
add_subconcept | Add bridge/remedial subconcepts for knowledge gaps |
remove_subconcept | Remove mastered subconcepts (reconnects edges) |
add_prerequisite_concept | Insert a concept BEFORE current in the topic path |
add_followup_concept | Insert a concept AFTER current for reinforcement |
validate_graph | BFS check for orphans, broken edges, unreachable nodes |
4. Tutor Agent
Purpose: Teach a subconcept interactively, chunk-by-chunk, with exercises and mastery tracking.- Tools
- Teaching Flow
- Question Types
| Tool | Description |
|---|---|
check_student_progress | Load diagnostic results for the parent concept |
check_prerequisite_mastery | Verify prerequisite subconcepts are complete |
generate_example | Create worked examples for illustration |
create_exercise | Generate practice problems (text, code, or drawing) |
visualize_concept | Create ASCII/text diagrams |
record_exercise_result | Persist attempts and update mastery scores |
The tutor uses only 5 agent loop iterations (vs. 15 default) for faster response times during interactive sessions.
5. Grade Answers Agent
Purpose: Grade diagnostic answers with scores, correctness flags, and detailed feedback. Flow:- Receives question prompt, correct answer, and student answer
- Evaluates correctness (boolean)
- Assigns score (0.0 to 1.0)
- Writes constructive feedback
- Returns results to Concept Refinement Agent
6. Generate Diagnostic Agent
Purpose: Create 5-10 diagnostic questions for a concept when questions aren’t available. Output:- Mix of multiple-choice and open-ended questions
- Varied difficulty levels
- Questions that probe conceptual understanding (not just memorization)
7. Review Learning Path Agent
Purpose: Post-completion enrichment—decide if additional concepts or subconcepts should be added. Triggers:- When you complete a major concept
- When overall topic progress exceeds 80%
- When mastery scores suggest readiness for advanced material
- Insert enrichment nodes for deeper exploration
- Add remediation if patterns suggest knowledge gaps
- Suggest related topics for continued learning
Agent Orchestration
Two-Phase Topic Pipeline
Concept Refinement Trigger
Interactive Tutoring
Real-Time Streaming
All multi-step agent operations stream progress via Server-Sent Events:| Event Type | Data | Description |
|---|---|---|
agent_start | { agent } | Agent has started execution |
agent_reasoning | { agent, text } | Claude’s reasoning between tool calls |
tool_call | { tool, input } | Tool invocation with parameters |
tool_result | { tool, summary } | Tool result (truncated to 200 chars) |
node_created | { node } | New node persisted to database |
edge_created | { edge } | New edge persisted |
node_removed | { nodeId } | Node deleted by refinement agent |
edge_removed | { sourceNodeId, targetNodeId } | Edge deleted |
agent_done | { agent, ... } | Agent completed successfully |
agent_error | { agent, message } | Agent failed with error |
The SSE writer in
src/utils/sse.ts tracks all active agents and auto-closes the stream when all resolve.Technical Details
Model
All agents use Claude 3.5 Sonnet (claude-3-5-sonnet-20241022) via the Anthropic SDK.
Tool Persistence Pattern
Agents never return data—they persist changes via tools:Reasoning Capture
TheonThinking callback extracts text content between tool calls:
Complete Learning Flow
Autonomous Design
Agents decide curriculum structure without human templates. Every learning path is custom-generated.
Self-Verification
The Concept Refinement Agent validates its own changes with BFS graph checks before committing.
Transparent Reasoning
Watch agents think in real-time via SSE reasoning events. Understand why decisions are made.
Tool-Based Actions
All graph mutations go through tools, ensuring database consistency and real-time UI updates.