Agent Basics
Learn how to create and manage agents in Gentic. This guide covers the fundamentals of agent creation, configuration, and management.
Creating Agents
Agents are the core building blocks of Gentic. They can be configured with specific capabilities and behaviors.
Basic Agent Creation
const agent = await client.createAgent({
name: 'Customer Support Agent',
description: 'An agent that helps with customer support queries',
capabilities: ['chat', 'ticket-management', 'knowledge-base']
});
Agent Capabilities
Agents can have various capabilities:
chat: Basic conversational abilitiesdocument-search: Search through connected knowledge sourcesticket-management: Handle support ticketsworkflow-execution: Execute defined workflowsdata-analysis: Analyze and process dataapi-integration: Connect with external APIs
Configuring Agents
Setting Agent Parameters
await client.updateAgent(agent.id, {
parameters: {
temperature: 0.7,
maxTokens: 1000,
model: 'gpt-4',
responseStyle: 'professional'
}
});
Adding System Prompts
await client.updateAgent(agent.id, {
systemPrompt: `You are a helpful customer support agent.
Always be polite and professional.
Use the knowledge base to provide accurate information.
If you're unsure, ask for clarification.`
});
Managing Agent Knowledge
Connecting Knowledge Sources
// Connect a knowledge base
await client.connectKnowledgeSource(agent.id, knowledgeBaseId);
// Connect a file collection
await client.connectKnowledgeSource(agent.id, fileCollectionId);
// Connect a knowledge graph
await client.connectKnowledgeSource(agent.id, knowledgeGraphId);
Managing Knowledge Access
// Set knowledge source priority
await client.updateKnowledgeSourcePriority(agent.id, {
[knowledgeBaseId]: 1,
[fileCollectionId]: 2
});
// Configure knowledge retrieval settings
await client.updateAgent(agent.id, {
knowledgeSettings: {
maxResults: 5,
relevanceThreshold: 0.7,
useReranking: true
}
});
Workflow Integration
Assigning Workflows
// Assign a workflow to an agent
await client.assignWorkflow(agent.id, workflowId);
// Configure workflow triggers
await client.updateAgent(agent.id, {
workflowTriggers: {
[workflowId]: {
trigger: 'on_message',
conditions: {
containsKeywords: ['support', 'help', 'issue']
}
}
}
});
Monitoring and Analytics
Viewing Agent Performance
// Get agent metrics
const metrics = await client.getAgentMetrics(agent.id);
// Get conversation history
const conversations = await client.getAgentConversations(agent.id, {
limit: 10,
offset: 0
});
// Get workflow execution history
const executions = await client.getWorkflowExecutions(agent.id, {
workflowId: workflowId,
limit: 10
});
Best Practices
- Start Simple: Begin with basic capabilities and add complexity gradually
- Monitor Performance: Regularly check agent metrics and user feedback
- Iterate and Improve: Update agent configuration based on usage patterns
- Test Thoroughly: Test agents with various scenarios before deployment
- Maintain Knowledge: Keep connected knowledge sources up to date
Next Steps
- Learn about Knowledge Sources
- Explore Workflows
- Check out Advanced Agent Configuration