Your First Agent
Build and configure your first autonomous AI agent.
Now that you have Lattice installed, let's create a more sophisticated agent that can actually perform useful tasks.
Understanding Agent Types
- Task Agents - Execute specific, defined tasks
- Conversational Agents - Handle customer interactions
- Research Agents - Gather and analyze information
- Workflow Agents - Orchestrate multi-step processes
Creating a Task Agent
javascript
import { Agent } from '@lattice/sdk';
const agent = new Agent({
name: 'DataAnalyzer',
type: 'task',
model: 'gpt-4-turbo',
instructions: `You are a data analysis expert.
Analyze provided datasets and generate insights.
Always provide actionable recommendations.`,
tools: ['data-visualization', 'spreadsheet-parser'],
});
await agent.deploy();Testing Your Agent
javascript
const result = await agent.run({
task: 'Analyze Q4 sales data and identify trends',
data: salesDataUrl
});
console.log(result.insights);