Skip to main content
The minimal Vibes agent: import, create, run.

What you’ll learn

  • Creating an Agent with a model and system prompt
  • Running the agent with agent.run()
  • Reading the output with result.output

Prerequisites

Complete example

Source: examples/hello-world.ts
import { Agent, tool } from "jsr:@vibesjs/sdk";
import { anthropic } from "npm:@ai-sdk/anthropic";
import { z } from "npm:zod";

const getCurrentTime = tool({
  name: "get_current_time",
  description: "Get the current date and time",
  parameters: z.object({}),
  execute: () => {
    return new Date().toISOString();
  },
});

const agent = new Agent({
  model: anthropic("claude-haiku-4-5-20251001"),
  systemPrompt: "You are a helpful assistant.",
  tools: [getCurrentTime],
});

const result = await agent.run("What is the capital of France and what time is it?");
console.log(result.output);
// "The capital of France is Paris. The current time is 2025-01-15T10:30:00.000Z."

Run it

deno run --allow-net --allow-env hello-world.ts

How it works

Model: anthropic("claude-haiku-4-5-20251001") creates a model instance using the Vercel AI SDK Anthropic provider. Any Vercel AI SDK-compatible model works here. System Prompt: Sets the agent’s persona. Vibes supports both static strings and dynamic functions - see the Agents concept page. tool(): Defines a type-safe tool with Zod parameter validation. The agent automatically calls tools when relevant. parameters: z.object({}) means this tool takes no arguments. result.output: For agents without outputSchema, output is a string. Add outputSchema with a Zod schema to get structured output - see the Weather Agent example.

Next steps