Agented.tech
  • Welcome
  • Manifesto
  • Use cases
  • Roadmap
  • Framework Architecture
  • AGNT Token
  • Main components
    • Main chat
    • Create agent
    • Functions Marketplace
    • Agents
    • AgentCore Library
  • Agent Builder
  • How it works
    • Creating an agent with code examples
    • Marketplace Guide
    • Agent Builder Guide
  • Links
    • Website
    • Github
Powered by GitBook
On this page
  • Basic Agent with RAG
  • Multi-Agent Workflow
  • Self-Reflecting Agent
  • Personal Assistant Agent
  • Support Agent
  • News Analysis Agent
Export as PDF
  1. How it works

Creating an agent with code examples

Basic Agent with RAG

Creating a simple research agent with a search function (vectorSearch).

const researchAgent = new AgentCore({
    name: 'research-bot',
    prompt: 'Analyze technical documents...',
    functions: [{
        func: vectorSearch,
        name: 'document_search',
        description: 'Search knowledge base',
        paramsToPass: {
            query: 'string'
        }
    }]
});

Multi-Agent Workflow

Creating a multi-agent system with a parent agent (editorAgent) and child agents (fact-checker, style-enforcer) for content editing tasks.

Self-Reflecting Agent

Example of an agent with a self-reflection function (selfReflectingAgent) that periodically analyzes its own performance.

const editorAgent = new AgentCore({
    name: 'content-editor',
    children: [{
            name: 'fact-checker',
            prompt: 'Verify factual accuracy...',
            functions: [webSearchTool]
        },
        {
            name: 'style-enforcer',
            prompt: 'Ensure AP Style guidelines...'
        }
    ]
});

Personal Assistant Agent

Creating a personal assistant agent (personalAssistant) with functions for calendar management, sending emails, and child agents for meeting preparation and travel planning.

const personalAssistant = new AgentCore({
    name: 'main-assistant',
    prompt: `Manage user's schedule and communications`,
    functions: [{
            func: checkCalendar,
            name: 'check_calendar',
            description: 'Access Google Calendar'
        },
        {
            func: sendEmail,
            name: 'send_email',
            description: 'Send messages via Gmail'
        }
    ],
    children: [{
            type: EAgentType.WORKER,
            name: 'meeting-preparer',
            prompt: `Prepare documents for upcoming meetings`,
            functions: [generateMeetingBrief]
        },
        {
            type: EAgentType.WORKER,
            name: 'travel-planner',
            prompt: `Handle travel arrangements`,
            functions: [bookFlights, reserveHotels]
        }
    ]
});

Support Agent

Example of a tech support agent (supportBot) with knowledge base search functions, ticket creation capabilities, and a child agent for log analysis. It also includes reflection for knowledge base updates.

const supportBot = new AgentCore({
    name: 'tech-support',
    prompt: `Handle technical support queries`,
    functions: [{
            func: searchKnowledgeBase,
            name: 'search_kb',
            description: 'Query internal documentation'
        },
        {
            func: createTicket,
            name: 'create_ticket',
            description: 'Generate Jira ticket'
        }
    ],
    children: [{
        type: EAgentType.WORKER,
        name: 'debug-helper',
        prompt: `Analyze error logs and suggest solutions`,
        functions: [parseLogs]
    }],
    reflections: [{
        type: EAgentType.REFLECTION,
        name: 'knowledge-update',
        prompt: `Identify gaps in knowledge base`,
        cronSchedule: '0 0 * * 1' // Weekly on Mondays
    }]
});

News Analysis Agent

Creating a news analysis agent (newsAnalyzer) with functions for news retrieval, sentiment analysis, a child agent for trend detection, and reflection for generating daily reports.

const newsAnalyzer = new AgentCore({
    type: EAgentType.PERMANENT,
    name: 'news-analyst',
    prompt: `Analyze financial news and identify market trends`,
    functions: [{
            func: fetchNewsAPI, // Local function
            name: 'get_latest_news',
            description: 'Fetch news from configured sources',
            params: {
                category: 'finance'
            }
        },
        {
            func: marketplaceSentimentAnalysis, // Marketplace function
            name: 'sentiment_analysis',
            description: 'Advanced NLP analysis (paid)',
        }
    ],
    children: [{
        type: EAgentType.WORKER,
        name: 'trend-spotter',
        prompt: `Identify emerging trends in news articles`,
        functions: [calculateTrendScore]
    }],
    reflections: [{
        type: EAgentType.REFLECTION,
        name: 'daily-summary',
        prompt: `Generate market summary report`,
        cronSchedule: '0 0 18 * * *' // 6PM daily
    }]
});
PreviousAgent BuilderNextMarketplace Guide

Last updated 3 months ago