Two years ago, if you wanted to build AI applications, you learned Python. That made sense when AI engineering meant training models or fine-tuning them. The ML tools were in Python, the tutorials were in Python, the jobs were for Python.
Not anymore.
AI engineering in 2025 means building on top of foundation models through their APIs. You don't need to train models - you need to wire them together, build UIs around them, and make them reliable. Sounds like web development, right? This is where JavaScript shines.
What is AI engineering?
So what exactly is AI engineering?
AI engineering is building agents and applications that use LLMs as their brain, but with a lot of advanced capabilities on top: interfacing with users, storing memory, calling external services, reasoning step-by-step, and executing reliable workflows. It's systems programming with unreliable components.
If you're a fullstack JavaScript developer, you may be surprised that already know a lot of what you need. Your web development and backend skills translate directly. You just need the AI-specific knowledge.
I've picked four open-source JavaScript libraries that can give you a good overview of the landscape.
Library | GitHub Stars | Focus |
---|---|---|
Vercel AI SDK | 13.6k | Model Routing |
Mastra | 12.1k | Agent Framework |
Langfuse | 10.5k | Observability |
Stagehand | 10.8k | Web Browsing |
Vercel's AI SDK
If you've tried to build a chat interface with streaming responses, you know it's surprisingly annoying. Vercel's AI SDK handles this headache for you, especially in React and Next.js apps.
What's great is how it makes models completely swappable. The import syntax is simple, and switching between them requires minimal code changes. (I'll show a code example in the next section.)
What you get:
- Model Routing: Switch between OpenAI and Anthropic without rewriting code
- Streaming Primitives: No more manually chunking response streams
- UI Components: Drop-in chat UI that looks pretty good
mastra
I'm obviously biased here, but we built Mastra to be a complete framework for AI engineering. It works WITH the AI SDK and builds on top of it, so you get the best of both worlds.
What we've seen is that for most folks, the hardest thing about AI engineering is the delicate dance between you and the LLM. You're building a harness around a tremendously powerful but unpredictable, non-deterministic engine.
We wanted to make that dance more intuitive, so Mastra put tracing directly in your local dev console. You can chat with the agent you're building, tab over to tracing, and see the full stack trace -- every input and output for every step in your every workflow and agent.
For a lot of people, this is the aha moment. You build something, and of course it doesn't work the first time. Then, you look at the trace, and suddenly you can see that the LLM is hallucinating a tool call, or that the structured output response is not what you're expecting. That kind of visibility is game-changing.
Here's an example of a mastra agent that highlights AI SDK syntax as well:
import { Agent } from "@mastra/core/agent";
import { openai } from "@ai-sdk/openai";
export const myAgent = new Agent({
name: "My Agent",
instructions: "You are a helpful assistant.",
model: openai("gpt-4o-mini"),
});
Mastra covers all the bases of AI engineering: agents, workflows, RAG, tracing, evals, tool calling, memory, plus the local dev environment.
You can run an agent in a loop, you run wild with multi-agent capabilities, or go more precise with structured workflow graphs. With Mastra, AI engineering is a bit magical and a lot of fun...
Langfuse
We were just talking about tracing and how much it matters for AI engineering. Langfuse continues that conversation. It's observability designed specifically for LLMs - think Datadog but for AI, with an open-source core.
We've talked to dozens of teams using various observability platforms, and people consistently rate Langfuse as one of the most complete feature sets. And it's completely free and open source.
What we like it for:
- Tracing: See which prompts take forever and why they're failing
- Cost Monitoring: Find out which feature is burning through your API budget
- Prompt Management: Version control for your prompts
The killer feature is the trace visualization. Seeing your entire AI app call graph in one view is ridiculously helpful for debugging. You can literally see where the flow breaks down and focus your effort there.
Stagehand
Stagehand solves a specific problem really well: making JavaScript agents that can browse the web. It runs on top of Playwright but with a MUCH more approachable syntax.
A lot of AI engineering involves scraping the web to collect various sorts of data for LLM processing. If you've tried to do browser automation with raw Playwright, you probably experienced the pain by your third .click()
. Stagehand is a higher-level abstraction and a great step in the right direction.
Key capabilities:
- Browser Automation: Simpler API than Playwright for common tasks
- Memory Systems: Maintains history across multiple page loads
- Context Management: Keeps track of what the agent has seen and done
I appreciate stagehand's focus. It handles this one core use case and does it well. The API is clean, the documentation is solid, and the team are enthusiastic.
Putting It All Together
Two years ago, the JavaScript AI ecosystem barely existed. Today, it's thriving. (I didn't even get to my honorable mentions: Assistant UI and Copilot Kit.)
More, they complement each other. You could use Vercel's AI SDK for model routing, Mastra for agents and workflows, Langfuse to monitor everything, and Stagehand for your web-browsing capabilities.
These libraries are battle-tested, used in prod, and all open-source. No vendor lock-in, just code you can read, modify, and deploy.
As models get better (and they will), these libraries help take care of the plumbing so you can focus on building features users want.
In 2025, you don't need a PhD to build AI apps. If you can build a decent web app, you can build a solid AI application. These libraries handle the AI-specific complexities so you can focus on your domain expertise.