<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/the-architecture-behind-an-ai-tutor-four-months-in-uqjo9alxn" -->

---
title: The architecture behind an AI tutor, four months in
description: A founder describes the architecture of an AI tutoring product built over four months, organized around four principles: many single-purpose agents instead of...
canonical: https://daily.dev/posts/the-architecture-behind-an-ai-tutor-four-months-in-uqjo9alxn
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: The architecture behind an AI tutor, four months in | daily.dev
og:description: A founder describes the architecture of an AI tutoring product built over four months, organized around four principles: many single-purpose agents instead of...
og:url: https://daily.dev/posts/the-architecture-behind-an-ai-tutor-four-months-in-uqjo9alxn
og:image: https://api.daily.dev/og/posts/UqjO9alXn.png
og:image:alt: The architecture behind an AI tutor, four months in
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# The architecture behind an AI tutor, four months in

**[Medium](https://daily.dev/sources/medium_js)** · 9 min read · 4 upvotes · 0 comments

## Summary

A founder describes the architecture of an AI tutoring product built over four months, organized around four principles: many single-purpose agents instead of one giant prompt (with structured outputs via tool calls replacing fragile JSON parsing); AI gives a first grade but a human confirms anything that affects a real outcome; long-term memory lives in pgvector embeddings with semantic search and a fallback to recency when retrieval fails; and model selection is split by task (strong model for judgment, cheap model for conversation) behind a router with per-customer cost ceilings and telemetry. Also covers smaller production gotchas, like reasoning models returning a 'thinking' block instead of the answer in the first content slot, and using AI agents (planner, implementer, reviewer) to help build the system itself.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://medium.com/@lvoliveiratec/the-architecture-behind-an-ai-tutor-four-months-in-c8ff20dad904>

## Questions this post answers

### Why does parsing JSON out of an LLM's free-text response keep breaking in production?

Free-text JSON parsing breaks because models embed stray sentences, markdown fences, or trailing commas around the JSON, requiring fragile regex cleanup. Switching agents to tool calls, where the model returns data in a predefined shape, eliminates this entire class of bug and is described as one of the highest-leverage changes a team can make.

_Developers hardening LLM output parsing can find more real-world fixes like this on daily.dev._

### Why would a reasoning model's API response parser suddenly break after upgrading models?

A reasoning model does not place its final answer in the first content block the way earlier model generations did; that first block can instead hold the model's internal thinking. Code that grabs the first content block out of habit will silently extract the thinking instead of the answer, breaking parsing in a way that is easy to miss and time-consuming to debug.

_Teams migrating between LLM model generations track gotchas like this on daily.dev._

### How can an AI product keep personalization memory working when a vector database embedding call fails?

Build a fallback to plain recency: if a semantic search against embeddings stored in pgvector errors out or times out, grab the most recent context instead of crashing the session. This lets the system degrade gracefully rather than taking down the whole interaction when retrieval fails, which happens in production and often at the worst time.

_Engineers designing resilient memory systems for AI products follow patterns like this on daily.dev._

## Similar posts on daily.dev

- [The AI Agent Layer: Architecture, Implementation, and the Future of Intelligent Enterprise Systems](https://daily.dev/posts/the-ai-agent-layer-architecture-implementation-and-the-future-of-intelligent-enterprise-systems-lhtkevh6k) · Planet PostgreSQL · 1 upvotes · 0 comments
- [A Simple Guide to Building AI Agents Correctly](https://daily.dev/posts/a-simple-guide-to-building-ai-agents-correctly-5qo2tas6f) · DigitalOcean Community · 2 upvotes · 0 comments
- [Stop Letting Your AI Reinvent the Wheel](https://daily.dev/posts/stop-letting-your-ai-reinvent-the-wheel-s9hvd1rfu) · Medium · 0 upvotes · 0 comments
- [How AI-Powered Applications Work](https://daily.dev/posts/how-ai-powered-applications-work-grq72v3b9) · Telerik · 1 upvotes · 1 comments

---

Tags: [#career](https://daily.dev/tags/career), [#llm](https://daily.dev/tags/llm), [#ai-agents](https://daily.dev/tags/ai-agents), [#embeddings](https://daily.dev/tags/embeddings), [#pgvector](https://daily.dev/tags/pgvector)

[View this post on daily.dev](https://daily.dev/posts/the-architecture-behind-an-ai-tutor-four-months-in-uqjo9alxn)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"The architecture behind an AI tutor, four months in","url":"https://daily.dev/posts/the-architecture-behind-an-ai-tutor-four-months-in-uqjo9alxn","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/the-architecture-behind-an-ai-tutor-four-months-in-uqjo9alxn"},"datePublished":"2026-10-03T23:48:26.745Z","dateModified":"2026-10-04T00:14:29.637Z","description":"A founder describes the architecture of an AI tutoring product built over four months, organized around four principles: many single-purpose agents instead of...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/e69b7898b658014314ffc1b96164188f?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/e69b7898b658014314ffc1b96164188f?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Medium","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Medium","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/medium","url":"https://daily.dev/sources/medium_js"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/the-architecture-behind-an-ai-tutor-four-months-in-uqjo9alxn","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":4},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"career,llm,ai-agents,embeddings,pgvector","timeRequired":"PT9M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Medium","item":"https://daily.dev/sources/medium_js"},{"@type":"ListItem","position":3,"name":"The architecture behind an AI tutor, four months in"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/the-architecture-behind-an-ai-tutor-four-months-in-uqjo9alxn#faq","mainEntity":[{"@type":"Question","name":"Why does parsing JSON out of an LLM's free-text response keep breaking in production?","acceptedAnswer":{"@type":"Answer","text":"Free-text JSON parsing breaks because models embed stray sentences, markdown fences, or trailing commas around the JSON, requiring fragile regex cleanup. Switching agents to tool calls, where the model returns data in a predefined shape, eliminates this entire class of bug and is described as one of the highest-leverage changes a team can make. Developers hardening LLM output parsing can find more real-world fixes like this on daily.dev."}},{"@type":"Question","name":"Why would a reasoning model's API response parser suddenly break after upgrading models?","acceptedAnswer":{"@type":"Answer","text":"A reasoning model does not place its final answer in the first content block the way earlier model generations did; that first block can instead hold the model's internal thinking. Code that grabs the first content block out of habit will silently extract the thinking instead of the answer, breaking parsing in a way that is easy to miss and time-consuming to debug. Teams migrating between LLM model generations track gotchas like this on daily.dev."}},{"@type":"Question","name":"How can an AI product keep personalization memory working when a vector database embedding call fails?","acceptedAnswer":{"@type":"Answer","text":"Build a fallback to plain recency: if a semantic search against embeddings stored in pgvector errors out or times out, grab the most recent context instead of crashing the session. This lets the system degrade gracefully rather than taking down the whole interaction when retrieval fails, which happens in production and often at the worst time. Engineers designing resilient memory systems for AI products follow patterns like this on daily.dev."}}]}
```

