Skip to content

Agent Documentation — Storybook for Kids

Most agents use Google ADK v1.0 (LlmAgent + FunctionTool) with Gemini 2.5 Pro on Vertex AI, traced via OpenTelemetry (lib/observability/tracer.ts).

Exception: Illustrator and Narrator bypass ADK entirely — they call GCP services (generateImage, synthesizeSpeech) directly as plain async functions. This eliminates ~3–5s of LLM routing overhead per page since their tool selection is 100% deterministic.


Agents

AgentDocFileTriggered by
SafetyGuardiansafety-guardian.mdlib/agents/safetyGuardian.tsEvery story generation
StoryWriterstory-writer.mdlib/agents/storyWriter.tsAfter safety approved
Illustratorillustrator.mdlib/agents/illustratorAgent.tsPer-page image generation
Narratornarrator.mdlib/agents/narratorAgent.tsPer-page audio narration
QuizMasterquiz-master.mdlib/agents/quizMasterAgent.tsQuiz generation (×5 parallel)
QuizFeedbackquiz-feedback.mdlib/agents/quizMasterAgent.tsQuiz answer feedback
LearningAdvisorlearning-advisor.mdlib/agents/learningAgent.tsDashboard recommendation (on load)
ParentInsightsparent-insights.mdlib/agents/parentInsightsAgent.tsParent Insights page + email report
StoryAdaptationstory-adaptation.mdlib/agents/adaptationAgent.tsParent Insights → AI Story tab (on load)

Pipeline flow

For the full step-by-step pipeline with timing, credit logic, and caching details, see How KidStory Works.

Summary:

[SafetyGuardian] → [StoryWriter] → [Illustrator × N] + [Narrator × N] → [Cover] → Firestore

                               [QuizMaster × 5 parallel] + [QuizFeedback]  ← child taps Quiz

         Dashboard: [LearningAdvisor]  ← RAG from quiz history
Parent Insights: [ParentInsights] + [StoryAdaptation]  ← RAG from quiz history

Simulation

bash
npm run simulate

Runs 22 scenarios across SafetyGuardian, StoryWriter, and QuizMaster. See scripts/simulate.ts.

Released under the MIT License.