# A Song of Types and Agents

Roberto Stagi, Ratel

AI Engineer World's Fair 2026

[Talk page](https://ai.engineer/talks/UlFB6efYN5Q-song-types-agents) · [Video](https://www.youtube.com/watch?v=UlFB6efYN5Q)

## A Song of Types and Agents

As AI moves from training models to shipping applications, TypeScript offers a practical way to connect agent loops, tools, backend services and interfaces through shared code and schemas.

Basic familiarity with TypeScript, backend services and model APIs will help with the shared-schema example.

### Who owns the AI language throne?

[0:02](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=2s)

If Python became the leading language on GitHub as AI expanded, why would TypeScript become its challenger? Roberto Stagi opens with a contest for the AI language throne. For years, Python was the obvious choice for AI development. ChatGPT’s release in 2022 brought AI beyond its specialist audience, expanding both the ambitions of applications and the reach of Python.

In the GitHub report Stagi cites, Python ranked first in 2024 by broad contribution activity; JavaScript still led code pushes. That distinction matters: a language can lead one measure without dominating every kind of development. TypeScript enters the story as the challenger whose strength lies in building applications.

![Slide showing Python on a throne and an orange TS TypeScript emblem beneath text introducing another contender.](https://ai.engineer/api/talk-essay-media/e10c4d6d08f15159cad353402acac673abddd6ae422e0d501e29b390d969528b)

TypeScript emerges as the challenger to Python’s throne.

Stagi brings an application developer’s perspective to that contest. He introduces himself as Ratel’s CTO and co-founder, an EU ambassador for AI Socratic, and a longtime JavaScript developer who moved to TypeScript. His interest is where agents fit into the software that developers ship.

### From training models to shipping applications

[2:38](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=158s)

**The relevant shift is from model infrastructure to the application layer.** AI becomes something developers ship inside a product, rather than only something they train. A model call now sits alongside the interface, backend logic and other features that make an application useful. That brings AI development into territory where TypeScript already has a strong presence.

This leaves substantial work in Python. In Stagi’s division of responsibilities, research, training and GPU serving remain its domain. What changes is the language needed to build the application around those capabilities: TypeScript can cover the UI, backend and increasingly the agentic layer that calls models and coordinates work.

Stagi cites TypeScript overtaking Python in GitHub’s August 2025 ranking by monthly contributors. He juxtaposes two reports that both associated AI with the rise of their leading language—Python in 2024, then TypeScript in 2025. The 2025 report also described GitHub signups averaging more than one new developer per second over September 2024–August 2025. These are platform activity measures, not proof that coding agents caused developers to switch languages. They set up the next question: what changed in how people were building applications?

### Coding agents create demand for TypeScript integrations

[5:42](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=342s)

Stagi’s proposed explanation is that coding agents matured. Lovable, Claude Code, Cursor and Codex became established ways to build applications. He characterizes TypeScript as their default application language—a description of the development pattern he sees, rather than a universal rule about what these tools can generate.

![Slide titled “The coding agents grew up,” listing Lovable, Claude Code, Cursor and Codex as the default way to build apps.](https://ai.engineer/api/talk-essay-media/1fc3065c93d9aaa66f3cf3aad8dcd77dc77e69250a34fd6ed97764611867a15d)

Coding agents grew up and became the default way to build apps.

The next link is demand for AI inside those applications. If a product is already written in TypeScript, adding an agent creates pressure for model integrations and agent tooling in the same ecosystem. Stagi describes this expansively, treating agentic features as an increasingly ordinary part of new applications. He points to [Anthropic’s acquisition of Bun](https://www.anthropic.com/news/anthropic-acquires-bun-as-claude-code-reaches-usd1b-milestone) in December 2025 as a concrete signal of an AI lab investing in a JavaScript runtime.

But adoption does not settle the engineering choice. An application may already use TypeScript, and coding tools may make it convenient, without that alone establishing where its agent should live. The useful question becomes: what does keeping the agent in TypeScript actually buy?

### A possible feedback loop in generated code

[7:38](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=458s)

The first benefit is prospective. More TypeScript applications could provide more training material for future coding agents. Deeper native integrations between those agents and TypeScript tooling could also improve the quality of generated applications. Together, these changes could reinforce the initial preference for TypeScript.

Stagi presents this as an expectation, not a measured improvement in coding accuracy. Its relevance to agent development follows from his broader premise: if an agent is part of an application, improvements in the tools that build applications should benefit the agent code too.

### The application around the model call

[8:28](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=508s)

The next benefit is already familiar to application developers: npm supplies packages for authentication, payments, interfaces and infrastructure. Stagi calls it probably the richest package ecosystem available. The practical point is the breadth of surrounding product capabilities, rather than an ecosystem ranking.

As AI moves into applications, it must integrate with those capabilities. Building the agent in TypeScript puts it in the same package ecosystem as the rest of the product, making existing application integrations available alongside the model-facing code.

### One language, one shared contract

[9:09](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=549s)

TypeScript can cover the agent loop, its tools, the backend service and the UI within one codebase. Stagi contrasts this with a Python service using FastAPI or Pydantic AI alongside a separate React application. That is a common architecture, not a mandatory consequence of choosing Python, but it introduces a contract between the services that must be maintained.

| Concern | Shared TypeScript codebase | Python service and React or Vue UI |
|---|---|---|
| Agent and interface code | One language | Two language ecosystems |
| Type definitions | Can be shared directly | Must stay synchronized across a boundary |
| Application contract | Shared schema can define it | Separate representations must agree |

The boundary becomes especially visible in types. A Python agent and backend may have internally consistent definitions, while the frontend has another set. Changing a record means keeping both representations aligned.

[Zod](https://zod.dev/basics) provides a concrete way to share that contract. Define a schema once, infer its TypeScript type, and reuse it in the backend, model-facing code and UI. For example, a proposed task can have one definition throughout the application:

```typescript
import { z } from "zod";

export const ProposedTask = z.object({
  title: z.string().min(1),
  status: z.enum(["pending", "approved"]),
});

export type ProposedTask = z.infer<typeof ProposedTask>;

export function validateProposal(input: unknown) {
  const result = ProposedTask.safeParse(input);
  if (!result.success) {
    return { ok: false as const, issues: result.error.issues };
  }
  return { ok: true as const, task: result.data };
}

export function taskLabel(task: ProposedTask): string {
  return `${task.title} (${task.status})`;
}

const result = validateProposal({
  title: "Review invoice",
  status: "pending",
});

if (result.ok) {
  console.log(taskLabel(result.task));
} else {
  console.error(result.issues);
}
```

Here, `ProposedTask` supplies both runtime validation and the type consumed by `taskLabel`. The record remains a pending proposal; validation does not approve or execute it. **Shared types do not automatically make external model output valid.** Incoming data still needs to pass through the schema, and the application must handle validation failures.

### An expanding AI ecosystem

[10:48](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=648s)

This is the practical meaning of a type checked end to end: the same definition can connect the model-facing boundary to backend logic and interface code. Stagi then broadens the argument from shared types to the growth of TypeScript’s AI tooling.

Stagi reports that [Vercel AI SDK](https://github.com/vercel/ai) weekly downloads rose from 1.6 million to 15.1 million in one year, roughly nine to ten times. This is his download-growth example, not a count of unique users or production applications. It supports the picture of a growing ecosystem without measuring the quality of applications built with it.

![Orange growth curve from 1.6M in June 2025 to 15.1M per week in June 2026, with a source note identifying npm weekly downloads.](https://ai.engineer/api/talk-essay-media/18cb5e2649b0dd19dcde98c99e53d28759e1a0d9c1ec93724bc46c38e93a7bea)

The TypeScript-only AI SDK’s roughly ninefold growth in one year.

The combined case joins five considerations: coding-agent preferences, one language throughout the codebase, a growing AI ecosystem, consistent types and npm’s existing application integrations. Their practical force comes from working together. A team can build agent behavior in the same environment that supplies its product dependencies and defines its application contracts.

### Atwood’s law reaches agents

[11:59](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=719s)

The closing analogy comes from [Jeff Atwood’s JavaScript maxim](https://blog.codinghorror.com/the-principle-of-least-power/): applications that can be written in JavaScript eventually will be. Stagi follows it with a TypeScript corollary: applications that could be written in JavaScript will eventually be written in TypeScript.

Agentic applications fall into that category too. This is a rhetorical extension of the application-layer argument, not a technical inevitability: as agents become ordinary application components, they become candidates for the same languages, dependencies and development tools as the rest of the product.

### Models on pip, agents on npm

[12:43](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=763s)

Stagi forecasts that TypeScript’s advantage at the application layer will widen. His packaging analogy separates the roles: a model can remain in the Python and pip ecosystem while the agent that calls it ships through npm. In that picture, Python continues to handle model and inference infrastructure, while TypeScript handles the surrounding application. The distinction describes ecosystem responsibilities, not a deployment procedure.

His recommendation follows that division: keep training in Python, but consider TypeScript for agents and applications. The warning about falling behind is directed at developers who overlook TypeScript entirely. The choice concerns how to build and maintain the product around the model—and whether its agent should share the language, packages and contracts already used by the application.

## Resources

- [Anthropic's Bun acquisition announcement](https://www.anthropic.com/news/anthropic-acquires-bun-as-claude-code-reaches-usd1b-milestone) — The December 2025 acquisition announcement explains Bun's role in Claude Code infrastructure.
- [Zod schema validation basics](https://zod.dev/basics) — Define schemas, validate runtime data and infer TypeScript types.
- [Vercel AI SDK](https://github.com/vercel/ai) — Open-source TypeScript toolkit for building AI-powered applications and agents.
- [The Principle of Least Power](https://blog.codinghorror.com/the-principle-of-least-power/) — Jeff Atwood's original essay introducing his maxim about applications eventually being written in JavaScript.
- [Roberto Stagi on context engineering](https://risorseartificiali.com/2026/06/10/context-engineering-per-agenti-ai-roberto-stagi/) — An Italian-language interview covering Ratel, context management, open-source development and AI Socratic.

## Slides

### A Song of Types and Agents

Roberto Stagi frames AI programming languages as rivals for a throne and suggests TypeScript may be winning.

[0:00](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=0s) [Title slide introducing a talk about TypeScript and AI agents by Roberto Stagi.](https://assets.ai.engineer/sites/aiecode2025/sha256/7d56686aad39804ae04b8218d96ebe001b91ddefbb28964ebc9564c3c5431563.webp)

AI ENGINEER WORLD’S FAIR · ONLINE

A Song of Types and Agents

How TypeScript is taking the AIron Throne

Roberto Stagi · CTO, Ratel

?

Caption: Hello, and thank you for being

### The Iron King

Stagi depicts Python on the AI throne, with seven other languages bowing below it, to illustrate his view of Python’s earlier dominance in AI.

[0:31](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=31s) [Python occupies a throne above several other programming languages.](https://assets.ai.engineer/sites/aiecode2025/sha256/fb2f9cff13f9cfa6ca7acb6208cc81e4a687eb2cbd02fb7b0eb4f8df9de2acf6.webp)

BOOK I
The Iron King

A few years ago, whenever the subject was AI the throne was Python’s, and Python’s alone.

Py

JS
Java
C++
R
Go
Rust
Julia

FOLIO 02 / 29

Interface text:
someone was building in AI, they

### ChatGPT and Python

The speaker casts ChatGPT’s 2022 release as AI moving beyond its old bubble, with Python’s ambitions growing alongside it. A Python banner sits on a throne.

[0:54](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=54s) [A Python throne accompanies a statement about ChatGPT's 2022 release and Python's growing ambitions.](https://assets.ai.engineer/sites/aiecode2025/sha256/1629f60c211ed0cb610afa65338711d158acdf87d7a5ef5cfa5294712b535a34.webp)

BOOK I
The Iron King

Then in 2022, ChatGPT was released, and Python became more ambitious.

Py

FOLIO 03 / 29

Interface text:
going outside of the bubble that it

### Python reaches first place on GitHub

A Python throne marks its first-place position on GitHub. The 2024 GitHub Octoverse quote credits AI with leading Python to the top.

[1:22](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=82s) [A Python throne and a 2024 GitHub Octoverse quotation accompany a claim that Python reached first place.](https://assets.ai.engineer/sites/aiecode2025/sha256/1c065dd819ac5b1f926520c4a7cad7f270b52fa69a0eea35365261b955059f63.webp)

BOOK I
The Iron King

So it conquered GitHub too, claiming the first place.

Py

GITHUB OCTOVERSE, 2024
“AI leads Python to top language”

FOLIO 03 / 29

Interface text:
top, but little did they know that

### A challenger to the throne

A question mark beside Python’s throne introduces TypeScript as the rising contender.

[1:44](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=104s) [A question mark appears beside the Python throne as the slide introduces another contender.](https://assets.ai.engineer/sites/aiecode2025/sha256/2c4c305cc573d62b085c8f181a867a482e133c7d9b1bffaa787e70248d7448f7.webp)

BOOK I
The Iron King

But little did they know, another contender was rising to challenge their claim to the throne...

Py
?

FOLIO 04 / 29

Interface text:
to challenge the claim that Python

### About Roberto Stagi

Roberto Stagi co-founded Ratel, a context layer for AI agents, and is AI Socratic’s EU ambassador. He brings a JavaScript-to-TypeScript developer’s perspective to the talk.

[2:04](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=124s) [Roberto Stagi's introduction describes his roles at Ratel and AI Socratic and his move from JavaScript to TypeScript.](https://assets.ai.engineer/sites/aiecode2025/sha256/a37a9b458dc0305d17e2b526bab8d3c79a53fcdd33182aa650e632837371540d.webp)

ABOUT ME

Roberto Stagi
Co-founder & CTO
@ Ratel, a context layer for AI agents
Also, EU Ambassador @ AI Socratic

Long-time JavaScript → TypeScript developer

JS
House JavaScript
THE OLD KING
→
TS
House TypeScript
THE RISER

Ratel
AI Socratic

ratel.sh · aisocratic.org · in/rstagi · @rstagi_

### AI moves to the application layer

Stagi describes AI moving from model infrastructure into the application layer, where developers ship AI-powered features.

[2:36](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=156s) [Slide stating that AI moved up the stack to the application layer.](https://assets.ai.engineer/sites/aiecode2025/sha256/6e691c81be694669fc02f2dfe9d6f2680ffa5e6a22403c72b35f84b862776e09.webp)

BOOK II
The Shift in the Stack

THE THROUGHLINE
AI moved up the stack, to the application layer.

FOLIO 06 / 29

Interface text:
As we said, AI started moving up

### An app that thinks

The speaker describes AI moving from something developers train to features they ship inside applications, creating applications that think.

[3:16](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=196s) [Slide stating that AI became something you ship, followed by the phrase “An app that thinks.”](https://assets.ai.engineer/sites/aiecode2025/sha256/86ae907d009ac715db4c0f11d3aaeef9232b19f9e38a7c23d2ff5b0bc268ee55.webp)

BOOK II
The Shift in the Stack

AI stopped being something you train. It became something you ship.

An app that thinks

FOLIO 07 / 29

Interface text:
The application layer has been

### TypeScript and the application layer

As applications ship AI features, the speaker argues that TypeScript owns the application layer, while Python remains central to the AI brain.

[3:26](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=206s) [Slide asserting that the application layer is owned by TypeScript rather than Python.](https://assets.ai.engineer/sites/aiecode2025/sha256/7e74d97e6cf0fdcf59526b59614c8618b8cbb31df0b586e6045b51674a524181.webp)

BOOK II
The Shift in the Stack

And the application layer is owned by TypeScript, not Python.

FOLIO 08 / 29

Interface text:
Don't get me wrong, like, I still

### Python's brain and TypeScript's app

The speaker places training, research and GPU serving in Python, while TypeScript increasingly handles the surrounding app: the agent, UI and deployment.

[3:31](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=211s) [Two-column slide associates Python with training, research and GPU serving, and TypeScript with the agent, UI and deployment.](https://assets.ai.engineer/sites/aiecode2025/sha256/a8912d2166aae3746370e8b7ddcacc8f5c3c264c9a45d4c493e4b1650cca9d22.webp)

BOOK III
The Overtake

Python owns the brain; TypeScript increasingly owns the app around it.

HOUSE PYTHON
The brain
— training
— research
— GPU serving

HOUSE TYPESCRIPT
The app
— the agent
— the UI
— the deploy

FOLIO 10 / 29

Interface text:
layer of our application.

### TypeScript passes Python on GitHub

GitHub’s Octoverse chart shows TypeScript overtaking Python by August 2025, with a lead of ~42k (≈1.6%). The 2024 points are derived from year-over-year rates.

[4:29](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=269s) [Line chart states that TypeScript passed Python in August 2025, showing 2.64 million for TypeScript, 2.59 million for Python and 2.17 million for JavaScript.](https://assets.ai.engineer/sites/aiecode2025/sha256/9c6cbdb417458df1485c4c96b0ac4c1b215cdf9e2e439b37d1bc78245a0198aa.webp)

BOOK III
The Overtake

In August 2025, TypeScript passed Python to become GitHub’s most-used language.

~42k ahead
≈ 1.6%

TS 2.64M
Python 2.59M
JS 2.17M

Timeline: Aug ’24, Aug ’25

SOURCE · GITHUB OCTOVERSE 2024 + 2025 · 2024 POINTS DERIVED FROM YOY RATES

FOLIO 10 / 29

Interface text:
reason that the GitHub report gave

### AI tools running on TypeScript

The speaker argues that demand for AI integrations falls on TypeScript, pointing to tools from Vercel AI SDK and Claude Code to Cursor and Lovable.

[6:45](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=405s) [Slide lists AI tools including Vercel AI SDK, Claude Code, Cursor, Mastra and Cloudflare Agents.](https://assets.ai.engineer/sites/aiecode2025/sha256/167caa8e08730e926f80da11b9aa8bbd3c06bb600ace2b36900fc1c6284dfac7.webp)

BOOK IV
The Bannermen

The tools you actually build AI with already run on TypeScript.

Vercel AI SDK
Claude Code
Cursor
Mastra
Cloudflare Agents
v0
Bolt
Lovable
CopilotKit

FOLIO 15 / 29

Interface text:
run on TypeScript.

### Anthropic acquires Bun

Anthropic acquired Bun, a JavaScript runtime, as Claude Code reached a $1B milestone. The speaker uses the acquisition to illustrate AI’s ties to the TypeScript ecosystem.

[6:56](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=416s) [Slide says an AI lab acquired a JavaScript runtime and shows an Anthropic announcement about acquiring Bun.](https://assets.ai.engineer/sites/aiecode2025/sha256/1ea3bd670ad66958c16d1037cddc7fdb9bd287361c8f88c22603de842bdd75ba.webp)

BOOK IV
The Bannermen

A RAVEN ARRIVES

An AI lab even acquired a JavaScript runtime.

Announcements
Anthropic acquires Bun as Claude Code reaches $1B milestone
Dec 3, 2025

FOLIO 16 / 29

Interface text:
do it? Like, this is a fair question.

### Does TypeScript make sense for AI agents?

As demand grows to embed AI in TypeScript applications, the speaker asks whether building agents in TypeScript makes sense. In his opinion, the answer can be yes for several reasons.

[7:24](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=444s) [Slide asks whether building AI agents in TypeScript makes sense.](https://assets.ai.engineer/sites/aiecode2025/sha256/4748b19ab64b505869bc918707bd4b266380bbce3c7e98cc1f8402c67970f0e8.webp)

BOOK IV
The Bannermen

THE HONEST QUESTION
But does building AI agents in TypeScript actually make sense?

FOLIO 17 / 29

Interface text:
reasons.

### AI builds in TypeScript by default

The speaker expects TypeScript’s use by coding agents to create a feedback loop: more generated TypeScript could feed future models, improving their output.

[7:37](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=457s) [Slide claims AI tools build in TypeScript by default and suggests generated code could feed into future models.](https://assets.ai.engineer/sites/aiecode2025/sha256/5df38d1f3abecd91fed1d63c0e2a0829bdda0dd07245f7e488f010aa2d477178.webp)

BOOK IV
The Bannermen

WHY YES

AI already scaffolds and builds in TypeScript by default.

More code in the world plausibly feeds back into the next models. A loop you would expect.

SOURCE · DEFAULTS: V0 · LOVABLE · BOLT, 2026

FOLIO 18 / 29

Interface text:
And also, if you use TypeScript,

### PyPI and npm

The slide favors PyPI for models and npm for app integrations such as auth and payments, citing roughly 3M npm packages versus 820K on PyPI in 2026.

[8:40](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=520s) [Slide contrasts PyPI for models with npm for application integrations, citing authentication, payments, UI, SaaS and infrastructure.](https://assets.ai.engineer/sites/aiecode2025/sha256/f96c544a2ee1c91a9c16d561ceea76a9114ffa8a515439ad6578de29ed7a7d98.webp)

BOOK IV
The Bannermen

AND THE REGISTRY BEHIND THEM

For the model, PyPI wins. For everything around it, you reach into npm.

Auth, payments, UI, SaaS, infra: the deepest app-layer tail there is.

npm ~3M packages vs PyPI ~820K. Not better code, broader reach: the integrations an app glues together treat JS as first-class.

SOURCE · NPM REGISTRY + PYPI, DISTINCT PACKAGES, 2026

FOLIO 19 / 29

Interface text:
Also, you have, by building in

### One codebase or two services

TypeScript can put the agent, tools, API route and UI in one deployment. The Python setup shown splits the agent and React app into two services with a contract to maintain.

[9:07](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=547s) [Slide compares a TypeScript agent, tools, API route and UI in one codebase with a Python service and separate React app.](https://assets.ai.engineer/sites/aiecode2025/sha256/985ee6fe7dd4cd645d9bfbb773d194cfc7ef2dc5da604653ad361092acd840c3.webp)

BOOK IV
The Bannermen

In TypeScript the whole agent is one codebase and one deploy; in Python it is usually two.

HOUSE TYPESCRIPT
One codebase, one deploy
— the agent loop
— the tools
— the API route
— the UI

HOUSE PYTHON
Two services, two deploys
— FastAPI + the agent
— a separate React app
— a hand-kept contract

FOLIO 20 / 29

Interface text:
synchronize.

### Types from model to browser

The TypeScript path carries one type from schema through the tool and stream to the browser. The Python agent and JavaScript UI have separate type sets that can drift apart.

[9:55](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=595s) [Diagrams contrast a TypeScript type flowing from schema to browser with a Python server type ending at the browser boundary.](https://assets.ai.engineer/sites/aiecode2025/sha256/362eb52112c667fc14e5da6bbe71bf5da59ca73167c0618a6b57eb45ed2cbe69.webp)

BOOK IV
The Bannermen

One type runs from the model’s tool call to the browser, while Python’s stops at the boundary.

HOUSE TYPESCRIPT · ONE TYPE, MODEL → BROWSER
schema → tool → stream → <Component/> → the browser

HOUSE PYTHON · TYPED TO THE BOUNDARY
schema → tool → typed server | browser JS, untyped

PydanticAI is genuinely typed. This is about crossing the browser: a Python agent and a JS UI are two type sets that can drift apart.

FOLIO 21 / 29

Interface text:
typing.

### One Zod schema across the application

A Recipe schema defines the tool’s input, flows through a streamed model call, and types the input rendered by the UI component.

[10:31](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=631s) [Code example defines a recipe schema, uses it in a streamed tool and renders its typed input in a UI component.](https://assets.ai.engineer/sites/aiecode2025/sha256/7cc798e048012b46e32da2c1643c3ffb0ca8e97ea308cb3e6e60139e406c1ca7.webp)

BOOK IV
The Bannermen

One Zod schema becomes the tool, the stream, and the typed UI, checked end to end.

// 1 · define the type once
const Recipe = z.object({
  title: z.string(),
  steps: z.array(z.string()),
})

// 2 · the model fills it, as a streamed tool
const recipe = tool({ inputSchema: Recipe })
streamText({ model, tools: { recipe } })

// 3 · the browser renders it, fully typed
function Card({ part }: {
  part: UIToolInvocation<typeof recipe>
}) {
  return <RecipeCard {...part.input} />
}

defined once · checked everywhere

FOLIO 22 / 29

Interface text:
and in the model, and you can use

### AI SDK download growth

Vercel’s AI SDK grew from 1.6M to 15.1M npm downloads per week in the year to 14 June 2026—about ninefold.

[10:51](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=651s) [Chart reports weekly npm downloads rising from 1.6 million in June 2025 to 15.1 million in June 2026.](https://assets.ai.engineer/sites/aiecode2025/sha256/4269862bbd15d1b3c446c6c12804df05b3ff6b0e9a16bdfd16ac40cfd51134be.webp)

BOOK IV
The Bannermen

The TypeScript-only AI SDK grew about 9× in a single year.

1.6M
15.1M / week
~9× in a year
Timeline: Jun ’25, Jun ’26

SOURCE · NPM WEEKLY DOWNLOADS · YEAR TO 14 JUN 2026

FOLIO 23 / 29

Interface text:
So it makes sense to build in

### Why the app layer is TypeScript

The speaker argues for TypeScript across AI apps: one language keeps types consistent from the model to the browser, while app-builder defaults and a growing AI ecosystem support the choice.

[11:21](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=681s) [Slide lists five reasons for TypeScript: app-builder defaults, one language, AI ecosystem growth, shared types and npm packages.](https://assets.ai.engineer/sites/aiecode2025/sha256/7eeddbd732f97848792172ee39664fd95667bd0ac5edf8efd63942b351628f85.webp)

BOOK IV
The Bannermen

WHY THE APP LAYER IS TYPESCRIPT

Put it together, and the app layer keeps landing on TypeScript.

01 The web app-builders scaffold it by default
02 One language for your whole app
03 A fast-growing AI ecosystem in TypeScript
04 Types that hold from the model to the browser
05 npm’s deep app-layer package tail

FOLIO 24 / 29

Interface text:
Typescript, you have like a...

### The JavaScript prophecy

The speaker extends Jeff Atwood’s 2007 JavaScript prediction to TypeScript, arguing that even agentic applications will be written in it.

[11:57](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=717s) [Slide attributes a prediction that applications writable in JavaScript will eventually be written in JavaScript to Jeff Atwood, then adds that TypeScript is coming for everything.](https://assets.ai.engineer/sites/aiecode2025/sha256/f4d2844ff326e8644cfa1b10c0efe8aa88fd5c424b09aa5cd1c379806dc3b668.webp)

BOOK V
The Prophecy

“Any application that can be written in JavaScript will eventually be written in JavaScript.

Jeff Atwood · Coding Horror · 2007

And now TypeScript is coming for everything.

FOLIO 25 / 29

Interface text:
So you might ask, was all this

### The future of the application layer

The speaker predicts that agents will write most of the application layer within a few years, widening the gap between Python’s model layer and TypeScript’s application layer.

[12:50](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=770s) [The slide predicts agents will write most of the application layer and that the gap between Python and TypeScript will widen.](https://assets.ai.engineer/sites/aiecode2025/sha256/14285de6f0c75d896743dcadc241709122826ee0bec77a4c16f821433a72b3a5.webp)

BOOK V
The Prophecy

AND WE’RE JUST GETTING STARTED

This is just the beginning.

Picture the app layer a few years from now, with agents writing most of it.

The gap between Python’s brain and TypeScript’s app layer only widens from here.

FOLIO 26 / 29

Interface text:
actually going to widen from here.

### Models on pip, agents on npm

The speaker expects agents that call models to ship on npm. The slide describes the vast majority of open-model inference as Python-led, naming vLLM and SGLang.

[13:02](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=782s) [The slide contrasts Python-led model inference with agents shipped through npm.](https://assets.ai.engineer/sites/aiecode2025/sha256/7ba8345a6ccfccc1b690894c70132a2d1ee22bffd9c0887b7293d5013cf1f170.webp)

BOOK V
The Prophecy

The model runs on pip. The agent that calls it ships on npm.

vLLM · SGLang · the vast majority of open-model inference, Python-led.

FOLIO 27 / 29

Interface text:
So, as I said, the model can still

### Train in Python, build in TypeScript

Stagi recommends keeping model training in Python while building agents and applications in TypeScript. He warns that overlooking TypeScript could leave developers behind.

[13:30](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=810s) [A recommendation to train in Python and build in TypeScript, beside a stylized TypeScript throne.](https://assets.ai.engineer/sites/aiecode2025/sha256/48f35afdcd6de007c61ee6ce4d090269072a26419ee1c5ba77f5891a4a290e97.webp)

BOOK V
The Prophecy

Train in Python, Build in TypeScript.

TS

FOLIO 28 / 29

Interface text:
if you overlook Typescript, you are

### Thank you

Roberto Stagi closes with a warning about falling behind on TypeScript and invites viewers to scan the QR code for the slides.

[13:58](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=838s) [The closing slide repeats the TypeScript recommendation and includes a thank-you message and a QR code for the slides.](https://assets.ai.engineer/sites/aiecode2025/sha256/410291a7641d330ca73712ed103e414f474088c0e78283c2ba400c7af312bade.webp)

Skip TypeScript now, and you might fall behind.

Thank you.

Roberto Stagi · Ratel · ratel.sh

TS

Get the slides

## Full transcript

[0:02](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=2s) Hello, and thank you for being here. I'm Roberto, and today I'm going to tell you this song of types and agents. Uh, basically a song that speaks about languages that fight each other to conquer what's the throne in the AI realm, and how I think that TypeScript might actually be winning this war.

[0:28](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=28s) But let's start from the beginning. A few years ago, whenever someone was building, uh, in AI, they were certainly using Python. Like, there was no doubt. All the other languages were bowing to Python because, um, because of its, uh, dominion, uh, over the AI world.

[0:51](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=51s) And then when in twenty twenty-two ChatGPT was released, everybody started wondering and starting understanding that AI was becoming something more, was going outside of the bubble that it lived for years and started to becoming something more ambitious.

[1:14](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=74s) And together with it, Python, which was the standard language for AI, became more ambitious as well.

[1:22](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=82s) And that's how in twenty twenty-four, uh, Python actually claim- climbed the ladder and became the most popular language on GitHub. So, you know, everybody was happy. Python finally reached the top.

[1:40](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=100s) But little did they know that there was another contender for the throne, another contender that was rising to challenge the claim that Python had on the throne. And this contender, as you may have guessed by now, was indeed TypeScript.

[2:01](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=121s) But before talking about this, let me present myself. My name is, uh, Roberto. I'm the CTO and co-founder of Ratel, a context layer for AI agents, and I'm also the EU ambassador for AI Socratic, a global community of AI builders meeting once per month to discuss the latest news in AI.

[2:23](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=143s) I'm also a longtime JavaScript then turned TypeScript, uh, developer, and that's basically why I am, um, talking about TypeScript today. So let's begin.

[2:38](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=158s) As we said, AI started moving up to the stack. It was moving from the infrastructure layer of these, um, models, machine learning, and all related ecosystem towards the application layer.

[2:54](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=174s) This means that AI, uh, stopped being something that you train, and it started being something that you ship inside your application. Applications started featuring AI, started having features powered by AI, which basically means that we started having applications that think.

[3:19](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=199s) And the application layer was not Python's. The application layer has been TypeScript's for pretty long time now.

[3:32](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=212s) Don't get me wrong, like, I still think that Python has its own, um, application. Like, I still think that the brain of the, of the agent and all the, of all the AI world is actually still owned by Python.

[3:50](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=230s) All the training, the research, the GPU serving is all Python's. Uh, has been Python's all along and it's going to be Python's for a long time yet. And, um, what's changing is actually the application layer.

[4:05](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=245s) Like, few years ago, if you wanted to build something with AI built in the application, you had to use Python. But today, that's not the case anymore, and that's all, uh, the shift is about.

[4:20](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=260s) TypeScript doesn't just own, you know, the UI or the back end. It started owning also the agentic layer of our application.

[4:31](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=271s) And that's why in August twenty twenty-five, types three-- TypeScript actually passed Python as the most used language on GitHub. And the funny thing is that the reason that the GitHub report gave was the same.

[4:48](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=288s) Like in twenty twenty-four, it said AI leads Python to top language, while in twenty twenty-five it said AI leads TypeScript as the first language. And in both cases, as you can see, the global developers, the number of global developers were surging.

[5:10](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=310s) In twenty twenty, twenty twenty-five, we even have one new developer joining GitHub every second.

[5:18](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=318s) So what actually changed in this year? Like, yeah, we were flooded from, like, new developers. In twenty twenty-four, these newcomers were reaching for Python or even maybe existing developers were reaching for Python, and in twenty twenty-five they reached for TypeScript instead.

[5:42](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=342s) What changed between twenty twenty-four and twenty twenty-five was actually coding agents. The coding agents grew up. Like we saw established, um... We saw the players establishing themselves like Lovable, Glo- Claude Code, Cursor, Codex.

[6:00](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=360s) They became the default way to build applications. And the default way to, uh, to which these coding agents actually build the applications was TypeScript. And, you know,

[6:17](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=377s) since every new app, pretty much every new app is an agent today because they ship this AI and agentic capabilities, they are hungry to embed AI inside themselves, the demand to have more AI integrations, more and more AI integrations doesn't fall onto Python, it

[6:41](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=401s) falls on TypeScript. And pretty much all the tools that we use to build AI today already run on TypeScript. We even saw an AI lab acquiring a JavaScript runtime, like last December, Anthropic acquired Bun.

[7:05](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=425s) But still, you know, okay, everybody us- is using TypeScript because of the coding agents, and we are having

[7:15](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=435s) more and more demand to build, uh, a, to embed the AI inside TypeScript application. But does this mean that we should do it? Like, this is a fair question.

[7:26](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=446s) Like, it's an honest question, and it's a question worth answering.

[7:32](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=452s) And the answer, in my opinion, can be yes, like for several reasons.

[7:38](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=458s) The first one is that since TypeScript is the default language for coding agents today, we can expect that they will become better and better in, in TypeScript because we are having more and more application in TypeScript, which are going to field the training of next coding agents.

[7:58](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=478s) And then we are having, uh, deeper integrations and more native integrations from these coding agents towards TypeScript, and we can expect that the quality of the output in TypeScript is going to be better and better from these coding agents.

[8:14](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=494s) Since we're building applications and, uh, we want to have like the highest quality of these applications, might make sense to build agents which are the new kind of applications in TypeScript.

[8:28](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=508s) And also, if you use TypeScript, you're actually tapping into what is probably the richest package manager out there. NPM comes with everything, uh, pretty much everything like authentication, payments, UI, infra.

[8:48](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=528s) Like it's, uh, the deepest app layer tail that there is. So

[8:54](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=534s) since, again, AI is coming towards the application layer, we need to integrate with all this right now, and tapping inside NPM is a very convenient way to do that.

[9:09](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=549s) Also, you have... By building in TypeScript, you can have one single language throughout all your codebase. You can have one single codebase for the whole application because you can use TypeScript for your agent loop, for the tools, for the backend service, for the UI.

[9:28](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=568s) While if you use Python, you probably have to split, uh, split it at least into two services, which means, you know, one service with FastAPI, Pydantic AI, and whatever.

[9:41](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=581s) And then another, um, separate React application that you need to sync betwe- between these two with a, uh, with a contract which you have to maintain and synchronize.

[9:55](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=595s) And speaking of contract, with TypeScript, you can have one single consistent typing across all your ap- all your application. While if you use Python instead, you at some point will stop at a boundary because you will have your agent, maybe your backend, et cetera, with one consistent typing, and then you will have your React

[10:20](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=620s) application or Vue or whatever with, um, another set of typing at which you need to synchronize between the two.

[10:31](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=631s) So if you use TypeScript, you can use Zod as a single schema throughout all your application, which is very convenient. You can define the type once. You can use this type in the backend and, uh, in the model, and you can use the same type in your UI.

[10:48](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=648s) One type checked end-to-end. Also, like it makes sense to build in TypeScript today, uh, also in the AI ecosystem because we are seeing a very surge in, in the AI ecosystem as well.

[11:05](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=665s) Like take the Vercel AI SDK, for example. You can see that in just one year it went from one point six million to fifteen point one million downloads per week, which is between nine and ten X in just one year.

[11:22](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=682s) So finally, like to put everything together, in my opinion, yes, it makes sense to build AI agents in TypeScript because you have like, um, uh, you can leverage the de facto default language for coding agent.

[11:37](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=697s) You can have one single language for your whole application and your whole codebase. You can tap into a fast-growing AI ecosystem. You can have consistent typing, uh, across all your application, and you can tap into the richest package manager that there is, NPM.

[11:59](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=719s) So, um, you might ask, was all this unpredictable? And the answer is actually no. Someone predicted this, uh, many years ago, almost, uh, twenty years ago. Jeff Atwood said any application that can be written in JavaScript will eventually be written in JavaScript.

[12:21](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=741s) And, you know, as you, as you probably know, in the last few years, we have a corollary of this that any application that could be written in JavaScript will eventually be written in TypeScript.

[12:33](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=753s) And so basically, we can say that any application, even the agentic ones, will be written in TypeScript.

[12:43](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=763s) And be mindful that what I showed you today is just the beginning, like we're just getting started. You can project this in a few years, and you can see that on the application layer, the difference between TypeScript and Python is actually going to widen from here.

[13:02](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=782s) So, um, as I said, the model can still run on pip, but the agents, which is the application layer today, so the agent that call the models will probably ship on npm.

[13:20](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=800s) So everything on the inference layer, you know, is going to be Python, but everything ver- everything else, probably all TypeScript.

[13:31](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=811s) Let me leave you with one recommendation then. Um, keep training in Python. As I said, I don't see that one going away, uh, soon. But please consider building the agents and the applications in TypeScript, 'cause if you don't do that now, if you overlook TypeScript, you are probably going to fall behind.

[13:56](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=836s) That was all on my side today. Um, I thank you all for, uh, your listening, and please, uh, scan the QR code for the slides. Reach out to me if you agree or if, if you disagree, if you have any feedback, and let's get in touch.

[14:11](https://www.youtube.com/watch?v=UlFB6efYN5Q&t=851s) Thank you. Bye-bye.
