text
stringlengths
0
59.1k
- **Clear Best Practices:** We provide guidance and structure (see `agents` and `utils` docs) to help you build maintainable and scalable AI applications.
## Get Started in Minutes
Ready to ditch the black box? You can start building your first agent right now:
```bash
npm create voltagent-app@latest my-first-agent
cd my-first-agent
npm run dev # or yarn dev / pnpm dev
```
Dive into our **[Getting Started Guide](/docs/)** for a deeper look, and open the [VoltOps Platform](https://console.voltagent.dev/) to see your agent in action!
## Join the Community
VoltAgent is just beginning, and we're building it in the open. We believe in the power of community (check the `community` docs folder for ways to connect!).
- **Ask Questions & Share Ideas:** [Discord](http://s.voltagent.dev/discord)
- **Contribute:** [Contribution Guide](/docs/community/contributing)
- **Report Bugs & Request Features:** [GitHub Issues](https://github.com/VoltAgent/voltagent/issues)
We're incredibly excited to see what you build with VoltAgent. Let's redefine AI development for JavaScript together!
---
The VoltAgent Team
<|endoftext|>
# source: VoltAgent__voltagent/website/blog/2025-07-29-ts-ai-agent/index.md type: docs
---
title: TypeScript AI Agent Framework - Voltagent
description: A TypeScript AI agent framework built from the ground up. Offers type safety, modern patterns, and better developer experience.
slug: typescript-ai-agent-framework
image: https://cdn.voltagent.dev/2025-07-29-ts-ai-agent/social.png
authors: necatiozmen
tags: [typescript, frameworks, ai-agents]
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
## The TypeScript Developer's AI Dilemma
When our team started working on AI agent projects, we kept running into issues with how existing tools fit into the TypeScript ecosystem. Most frameworks were designed Python-first, with JavaScript/TypeScript support feeling like an afterthought.
Working with popular tools like LangChain or AutoGen meant spending time adapting Python documentation to TypeScript. This not only slowed down development but also prevented us from fully leveraging TypeScript's type safety, modern language features, and IDE support.
This experience led us to build a TypeScript AI agent framework designed natively for the TypeScript ecosystem. [VoltAgent](https://github.com/VoltAgent/voltagent) was born from this need.
## Why TypeScript Matters for AI Development
### Type Safety in AI Applications
One of the biggest challenges when building AI applications is the unpredictability of LLM responses. Consider building a chatbot:
```typescript
// ❌ Untyped approach - runtime surprises
const response = await fetch("/api/chat", {
method: "POST",
body: JSON.stringify({ message: userInput }),
});
const data = await response.json(); // any type
console.log(data.message); // Runtime error if API response changes
```
Same operation with VoltAgent:
```typescript
// ✅ Fully typed approach - compile-time safety
import { Agent } from "@voltagent/core";
import { VercelAIProvider } from "@voltagent/vercel-ai";
import { openai } from "@ai-sdk/openai";
const agent = new Agent({
name: "customer-support",
instructions: "Answer customer questions professionally",
llm: new VercelAIProvider(), // Type-safe provider
model: openai("gpt-4o"), // Type-safe model configuration
});
// generateText returns a fully typed response
const response = await agent.generateText("Where is my order?");
console.log(response.text); // Guaranteed to be string
```
### Structured Output with Zod Integration
An important feature in the framework is maintaining type safety when getting structured data from AI:
```typescript
import { z } from "zod";
// First, we define our schema
const customerSchema = z.object({
name: z.string().describe("Customer's full name"),
age: z.number().describe("Customer's age"),
city: z.string().describe("City they live in"),
preferences: z.array(z.string()).describe("Product preferences"),
});