Agents
Agents are the core building blocks of Deeployd. Each agent is an AI worker with a specific role, personality, and capabilities.
What is an Agent?
An agent is an AI assistant configured to:
- Have a specific role and personality
- Use certain tools and integrations
- Remember context through memory
- Work with other agents in teams
Think of agents as AI employees that you hire, train, and deploy.
Creating an Agent
Via Dashboard
- Go to Dashboard → Agents → + Create Agent
- Fill in the required fields
- Click Create
Via API
import { DeepLoyd } from '@deeployd/sdk';
const client = new DeepLoyd({ apiKey: process.env.DEEPLOYD_API_KEY });
const agent = await client.agents.create({
name: 'Support Agent',
description: 'Handles customer support inquiries',
systemPrompt: `You are a helpful customer support agent.
Be friendly, professional, and solution-oriented.`,
model: 'claude-3-5-sonnet-20241022',
tools: ['memory', 'http_request']
});
console.log('Created agent:', agent.id);
Agent Configuration
Basic Settings
| Field | Description | Required |
|---|---|---|
name | Display name | Yes |
description | What the agent does | No |
systemPrompt | Personality and rules | Yes |
model | AI model to use | No (default: Sonnet) |
Model Options
| Model | ID | Best For |
|---|---|---|
| Claude 3.5 Sonnet | claude-3-5-sonnet-20241022 | General use |
| Claude 3 Opus | claude-3-opus-20240229 | Complex reasoning |
| Claude 3 Haiku | claude-3-haiku-20240307 | Fast, simple tasks |
Advanced Settings
const agent = await client.agents.create({
name: 'Advanced Agent',
systemPrompt: '...',
// Model settings
model: 'claude-3-5-sonnet-20241022',
temperature: 0.7, // 0-1, higher = more creative
maxTokens: 4096, // Max response length
// Capabilities
tools: ['memory', 'calculator', 'http_request'],
// Memory
memory: {
enabled: true,
userMemory: { enabled: true, retention: '90d' },
teamMemory: { enabled: true }
},
// Security
systemPromptProtected: true, // Prevent prompt injection
// Team placement
teamId: 'team-123'
});
Managing Agents
Get Agent
const agent = await client.agents.get('agent-123');
Update Agent
await client.agents.update({
agentId: 'agent-123',
name: 'Updated Name',
systemPrompt: 'Updated prompt...'
});
List Agents
const agents = await client.agents.list({
teamId: 'team-123', // Optional: filter by team
limit: 10,
offset: 0
});
Delete Agent
await client.agents.delete('agent-123');
Chatting with Agents
Basic Chat
const response = await client.agents.chat({
agentId: 'agent-123',
message: 'Hello, how can you help me?'
});
console.log(response.content);
With Conversation Context
// Start a conversation
const response1 = await client.agents.chat({
agentId: 'agent-123',
message: 'My name is Sarah'
});
// Continue the conversation
const response2 = await client.agents.chat({
agentId: 'agent-123',
conversationId: response1.conversationId,
message: 'What is my name?'
});
// Response: "Your name is Sarah"
With User Context
// Associate with a user for memory persistence
const response = await client.agents.chat({
agentId: 'agent-123',
userId: 'user-456',
message: 'Remember that I prefer bullet points'
});
Streaming Responses
const stream = await client.agents.chat({
agentId: 'agent-123',
message: 'Tell me a story',
stream: true
});
for await (const chunk of stream) {
process.stdout.write(chunk.content);
}
Agent States
Agents can be in different states:
| State | Description | Can Chat? |
|---|---|---|
active | Normal operation | Yes |
paused | Temporarily disabled | No |
maintenance | Being updated | No |
archived | Soft deleted | No |
// Pause an agent
await client.agents.pause('agent-123');
// Resume an agent
await client.agents.resume('agent-123');
// Archive an agent
await client.agents.archive('agent-123');
Agent Relationships
Parent-Child (Escalation)
// Create child agent with parent
const childAgent = await client.agents.create({
name: 'Tier 1 Support',
systemPrompt: '...',
parentAgentId: 'tier-2-agent-id',
escalationRules: {
conditions: ['user requests escalation', 'issue too complex'],
message: 'Let me transfer you to a senior support agent.'
}
});
Team Membership
// Add agent to team
await client.agents.addToTeam({
agentId: 'agent-123',
teamId: 'team-456'
});
// Move agent to different team
await client.agents.move({
agentId: 'agent-123',
toTeamId: 'team-789'
});
Agent Templates
Save and reuse agent configurations:
Save as Template
const template = await client.templates.createFromAgent({
agentId: 'agent-123',
name: 'IT Support Template',
description: 'Template for IT support agents'
});
Create from Template
const agent = await client.agents.createFromTemplate({
templateId: 'template-123',
name: 'New IT Support Agent',
customizations: {
// Override template values
systemPrompt: 'Custom additions...'
}
});
Best Practices
Agent Design
- Single Responsibility - Each agent should have one clear purpose
- Clear Boundaries - Define what the agent can and cannot do
- Descriptive Names - Use names that indicate the agent's role
- Test Thoroughly - Test with realistic scenarios before deploying
System Prompts
✅ Good: Specific, actionable instructions
You are an IT Helpdesk agent for Acme Corp.
Your responsibilities:
- Answer IT questions
- Guide troubleshooting
- Create tickets when needed
Your boundaries:
- Don't access production systems
- Verify identity for password resets
- Escalate security concerns
❌ Bad: Vague, no boundaries
You are a helpful assistant.
Help users with their problems.
Error Handling
try {
const response = await client.agents.chat({
agentId: 'agent-123',
message: 'Hello'
});
} catch (error) {
if (error.code === 'AGENT_PAUSED') {
console.log('Agent is temporarily unavailable');
} else if (error.code === 'RATE_LIMITED') {
console.log('Too many requests, retry later');
} else {
throw error;
}
}
Analytics
View agent performance:
const analytics = await client.agents.getAnalytics({
agentId: 'agent-123',
startDate: '2024-01-01',
endDate: '2024-01-31'
});
console.log('Total conversations:', analytics.conversations);
console.log('Messages handled:', analytics.messages);
console.log('Avg response time:', analytics.avgResponseTime);
console.log('Token usage:', analytics.tokensUsed);
Next: Learn about System Prompts to master agent personality design.