DRILLS.ai · Chapter 02

The architecture

Worked on October 26, 2026 · 3 min read

A static Astro interface, a FastAPI API, an application AgentA program that uses a language model to decide what to do (search, call a tool, answer, refuse), in a loop, with stopping rules.See in the glossary →, and Python code that checks what the model returns. The candidate’s dossier stays in their browser.

The concept

The component is called ApplicationAgent, but the application drives the WorkflowA sequence of steps decided by code: the model steps in at set points, but does not choose what comes next.See in the glossary →. The model analyses and drafts; code splits the texts, checks the references and computes the score. It is not an autonomous loop that decides to browse the web, run code or apply.

The diagram

Architecture of the DRILLS.ai MVPBROWSERCandidateAstro · TypeScriptDossierin the browserFastAPI APIRenderPublic GitHubmetadataApplicationAgentOpenAI ResponsesPython validationreferences · scorePublic job boardsGreenhouse · AshbyMCP clientexternal, if linked
What runs in the MVP. The plum arrow: the result goes through Python validation before it returns to the API. Dotted: the MCP surface, which shares the job boards and the score but cannot see the dossier.
  • No account. No sync across devices, no server memory of the dossier, no vector database of CVs.
  • Job search does not depend on the profile. The CV is not sent to the job boards.
  • The MCPModel Context Protocol: a standard for exposing tools and data sources to any agent. An MCP tool is discovered by its name, description and schema.See in the glossary → surface shares the job-board adapters and the score rules, but it cannot read a browser’s dossier.

Who does what

Component Responsibility Nature
ApplicationAgent.import_pdf() Read the text; use OpenAI if local extraction fails Classic extraction, then AI if needed
ApplicationAgent.assess() Identify role, scope and requirements; link the evidence Structured AI call
ApplicationAgent.draft() Draft CV and pitch from the kept assessment Separate structured AI call
source_excerpts() Split the texts into numbered excerpts Deterministic code
resolve_selection() Replace the chosen IDs with the original passages Deterministic code
validate_requirements(), validate_analysis() Check the references and some consistency rules Deterministic code
calculate_match() Compute the score and the decision Deterministic code
prepare() / POST /api/application Produce the old full result Compatibility with older clients

Three rows out of eight call the model. The other five are code you can test without a network.

The stack

Layer Tool Role
Frontend Astro, TypeScript, HTML, CSS Static bilingual pages; interactions in the browser
Editor Tiptap Structured, editable CV with a word-processor toolbar
Frontend validation ZodA TypeScript library that validates data at runtime, for example a dossier read back in the browser.See in the glossary → Response contracts and the browser dossier
API FastAPI, Uvicorn, Python Candidate operations and integrations
Backend validation PydanticA Python library that validates data against typed classes; with extra="forbid", an unexpected field is rejected.See in the glossary → v2 Typed inputs and outputs; unexpected fields rejected
AI OpenAI Python SDK, Responses API, Structured outputAsking the model to answer in a fixed format (JSON), so the interface always shows the same thing, in the same place.See in the glossary → PDF fallback, profile / posting comparison, drafting
Default model in the code gpt-4o-2024-08-06 Overridable with OPENAI_APPLICATION_MODEL; the actual value on Render was not checked
PDF pypdf==6.21.2 Text extraction in a bounded subprocessThe Python module that launches another program (git, a CLI) and gets back its exit code and output.See in the glossary →
Network httpx Reading the Greenhouse and Ashby boards
Limits SlowAPI, asyncio SemaphoreA counter that limits how many operations run at the same time. When it is full, the next request is refused or waits.See in the glossary → Per-route limits; two candidate operations at a time per process
MCP mcp[cli]==2.3.0 Optional stateless Streamable HTTPMCP's HTTP transport: the client sends its requests to a single address, here /mcp/.See in the glossary → server
State sessionStorage; localStorage when opted in Dossier in the browser, no account database
Tests pytest, Node tests, jsdom Offline mocked backend, contracts, DOM interactions
Delivery GitHub Actions, GitHub Pages, Render Checks; frontend and backend hosted separately

The declared versions are ranges (Astro ^7.4.1, Zod ^4.6.7, OpenAI SDK >=2,<4). The npm lockfile is the reference for the frontend. Render installs from the requirements files, which do not pin every dependency: uv.lock alone does not make this Python deployment reproducible.

A dependency in the repository is not necessarily used by the MVP. Pyodide, the old agents, the lessons and the exercises are the legacy of the first version.

Where to read the code

Path To understand
src/pages/[lang]/apply.astro The profile, opportunities, assessment and documents screens
src/scripts/application.ts Navigation, import, API calls, candidate actions
src/lib/application-state.ts Validating and keeping the dossier
src/ai_generator/application.py Active agent, references, score, generation
src/ai_generator/pdf_text.py Bounded PDF extraction
src/integrations/jobs.py Job sources and cache
api/main.py, api/mcp_app.py HTTP routes, errors, limits, MCP tools
src/ai_generator/orchestrator.py, agents/ The historical phase 1 architecture
render.yaml, .github/workflows/ Deployment and CI

What I keep

  • Calling a component an “agent” does not make it autonomous. I can say what it decides: analysing and drafting, inside a frame set by code.
  • What the model produces goes through code before it reaches the screen.
  • Present in the repository does not mean used by the product.

The Python mechanisms

The defense question

Do you have several agents?

Yes in the initial prototype. The current candidate journey mostly uses ApplicationAgent and checks in Python.

Do you use RAGRetrieval-Augmented Generation: search for passages in a base, then answer from them, citing them.See in the glossary →?

No. No vector database and no semantic search over a CorpusThe set of documents the agent is allowed to rely on.See in the glossary →. The texts the candidate provides are split into numbered excerpts, which the model references.