Skip to main content

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 abilities
  • document-search: Search through connected knowledge sources
  • ticket-management: Handle support tickets
  • workflow-execution: Execute defined workflows
  • data-analysis: Analyze and process data
  • api-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

  1. Start Simple: Begin with basic capabilities and add complexity gradually
  2. Monitor Performance: Regularly check agent metrics and user feedback
  3. Iterate and Improve: Update agent configuration based on usage patterns
  4. Test Thoroughly: Test agents with various scenarios before deployment
  5. Maintain Knowledge: Keep connected knowledge sources up to date

Next Steps