Create Your First Agent
Let’s build a simple AI agent that can answer questions and perform tasks.
Step 1: Initialize Your Project
If you haven’t already, create a new project:
mkdir my-first-agent && cd my-first-agent
npm init -y
npm install zod-framework
npx zod init
Step 2: Define an Agent
Create a file agents/assistant.js:
import { Agent } from 'zod-framework';
export const assistant = new Agent({
name: 'Assistant',
description: 'A helpful AI assistant',
model: 'gpt-4',
skills: ['conversation', 'reasoning'],
tools: ['filesystem'],
systemPrompt: `You are a helpful assistant. Be concise and friendly.`,
});
Step 3: Run the Agent
Start the agent harness:
npx zod run
This will start the harness and your agent will be ready to receive messages.
Step 4: Interact with Your Agent
Open another terminal and send a message:
npx zod message assistant "Hello, what can you do?"
Adding Skills
Enhance your agent’s capabilities by adding skills:
import { conversation, reasoning, coding } from 'zod-framework/skills';
export const assistant = new Agent({
name: 'Assistant',
model: 'gpt-4',
skills: [conversation, reasoning, coding],
tools: ['filesystem', 'terminal'],
});
Adding Tools
Connect your agent to external tools:
import { filesystem, webSearch, database } from 'zod-framework/tools';
export const assistant = new Agent({
name: 'Assistant',
model: 'gpt-4',
skills: ['conversation', 'reasoning'],
tools: [filesystem, webSearch, database],
});
What’s Next?
- Learn about Core Concepts to understand how Zod works
- Explore the Agents documentation for advanced agent patterns
- Check out Skills & Tools for a complete list of available capabilities