GroveAI
Examples

AI Agent Examples

Examples of AI agents that plan, reason, and execute multi-step tasks autonomously — from research assistants to code generation agents and process automation.

Research Agent with Web Search and Synthesis

advanced

An AI agent that takes a research question, plans a search strategy, executes multiple web searches, evaluates source credibility, and synthesises findings into a structured report with citations.

// Research agent with planning
async function researchAgent(question) {
  // Step 1: Plan research strategy
  const plan = await llm.chat({
    messages: [{ role: "system", content: "Create a research plan with 3-5 search queries to answer this question thoroughly." }],
    tools: [searchWeb, evaluateSource, synthesise]
  });

  // Step 2: Execute searches in parallel
  const results = await Promise.all(
    plan.queries.map(q => searchWeb(q))
  );

  // Step 3: Evaluate and filter sources
  const credibleSources = results.flat().filter(
    r => evaluateSource(r).credibilityScore > 0.7
  );

  // Step 4: Synthesise into report
  return await synthesise(question, credibleSources);
}

Key takeaway: Research agents need explicit source evaluation criteria — without them, they tend to treat all sources as equally reliable.

Data Analysis Agent with Code Execution

advanced

An agent that accepts natural language analysis requests, writes Python code to query databases and perform analysis, executes the code in a sandboxed environment, interprets results, and generates visualisations.

// Data analysis agent
async function dataAnalysisAgent(request, dataContext) {
  // Generate analysis code
  const code = await llm.chat({
    messages: [{
      role: "system",
      content: `Write Python code to analyse the data. Available tables: ${dataContext.tables}. Use pandas and matplotlib.`
    }, { role: "user", content: request }]
  });

  // Execute in sandbox
  const result = await sandbox.execute(code, {
    timeout: 30000,
    memoryLimit: "512MB",
    allowedModules: ["pandas", "numpy", "matplotlib"]
  });

  // Interpret results
  const interpretation = await llm.chat({
    messages: [{ role: "user", content: `Interpret these results for a business audience: ${result.output}` }]
  });

  return { code: code, output: result.output, charts: result.files, interpretation };
}

Key takeaway: Sandboxed code execution is non-negotiable for data analysis agents — never let an LLM-generated query run directly against a production database.

Customer Onboarding Agent

intermediate

An agent that guides new customers through setup by checking account status, configuring integrations, running diagnostics, and resolving common issues — all through a conversational interface with tool access to internal systems.

// Onboarding agent with tool use
const onboardingTools = [
  { name: "checkAccountStatus", description: "Check what setup steps are complete" },
  { name: "configureIntegration", description: "Set up a third-party integration" },
  { name: "runDiagnostic", description: "Test that an integration is working" },
  { name: "sendWelcomeEmail", description: "Send personalised welcome resources" },
];

async function onboardingAgent(customerId) {
  const status = await checkAccountStatus(customerId);
  const pendingSteps = status.steps.filter(s => !s.complete);

  for (const step of pendingSteps) {
    const result = await executeStep(step, customerId);
    if (!result.success) {
      await escalateToCSM(customerId, step, result.error);
    }
  }
}

Key takeaway: Onboarding agents reduce time-to-value by 60% compared to documentation-only onboarding, as they proactively handle steps customers would otherwise skip.

Multi-Agent Workflow for Content Production

advanced

A system of specialised agents — researcher, writer, editor, SEO optimiser — that collaborate to produce long-form content. Each agent has a defined role and passes work to the next stage with structured handoffs.

// Multi-agent content pipeline
const agents = {
  researcher: { role: "Research the topic and gather key facts and sources" },
  writer: { role: "Write a draft article based on the research brief" },
  editor: { role: "Review for clarity, accuracy, and tone. Suggest edits." },
  seoOptimiser: { role: "Optimise headings, meta description, and keyword density" },
};

async function contentPipeline(topic, targetKeywords) {
  const research = await agents.researcher.run({ topic, targetKeywords });
  const draft = await agents.writer.run({ brief: research.output });
  const edited = await agents.editor.run({ draft: draft.output });
  const final = await agents.seoOptimiser.run({
    article: edited.output,
    targetKeywords
  });
  return final.output;
}

Key takeaway: Multi-agent systems work best when each agent has a narrow, well-defined role with clear input/output contracts between them.

IT Operations Agent with Runbook Execution

advanced

An agent that monitors alerts, diagnoses issues by querying logs and metrics, selects the appropriate runbook, and executes remediation steps. Escalates to on-call engineers when automated fixes fail.

// IT ops agent with graduated permissions
async function opsAgent(alert) {
  // Diagnose
  const logs = await queryLogs(alert.service, alert.timeRange);
  const metrics = await queryMetrics(alert.service, alert.timeRange);
  const diagnosis = await llm.diagnose({ alert, logs, metrics });

  // Select runbook
  const runbook = await findRunbook(diagnosis.category);
  if (!runbook) return escalate(alert, diagnosis, "No matching runbook");

  // Execute with permission checks
  for (const step of runbook.steps) {
    if (step.requiresApproval && !agent.hasPermission(step.action)) {
      return escalate(alert, diagnosis, "Requires human approval for: " + step.action);
    }
    await executeStep(step);
  }
}

Key takeaway: Operations agents should start with read-only actions and gradually earn write permissions as they prove reliability — never give full production access from day one.

Procurement Agent for Vendor Comparison

intermediate

An agent that gathers vendor proposals, extracts key terms and pricing, normalises data for comparison, scores vendors against weighted criteria, and produces a recommendation report for the procurement team.

// Vendor comparison agent
async function compareVendors(proposals, criteria) {
  const normalised = await Promise.all(
    proposals.map(async (p) => ({
      vendor: p.vendor,
      extracted: await extractProposalData(p.document),
    }))
  );

  const scored = normalised.map(v => ({
    ...v,
    scores: criteria.map(c => ({
      criterion: c.name,
      score: evaluateCriterion(v.extracted, c),
      weight: c.weight,
    })),
    totalScore: criteria.reduce((sum, c) =>
      sum + evaluateCriterion(v.extracted, c) * c.weight, 0
    ),
  }));

  return scored.sort((a, b) => b.totalScore - a.totalScore);
}

Key takeaway: Procurement agents save weeks of analyst time on RFP evaluation — but the scoring criteria and weights must be set by humans to avoid bias.

Patterns

Key patterns to follow

  • Agents work best with clearly defined tool sets — too many tools creates confusion, too few limits capability
  • Always implement guardrails: sandboxed execution, permission levels, and human-in-the-loop for high-stakes actions
  • Multi-agent systems outperform single agents on complex tasks by enabling specialisation
  • Graduated trust models (read-only first, then write access) reduce risk in production agent deployments
  • Explicit planning steps before execution improve agent reliability on multi-step tasks

FAQ

Frequently asked questions

A chatbot responds to messages in a conversation. An AI agent can plan, use tools, execute code, and take actions across systems autonomously. Agents are goal-directed and can break complex tasks into steps, while chatbots typically handle single-turn interactions.

For well-defined tasks with clear guardrails, yes. The key is implementing proper sandboxing, permission models, monitoring, and fallback to human operators. Start with low-risk tasks and expand as you build confidence in the agent's performance.

Implement a graduated permission model, require human approval for irreversible actions, set spending limits, use sandboxed environments for code execution, add comprehensive logging, and start with read-only capabilities before granting write access.

Popular frameworks include LangGraph, CrewAI, and AutoGen for multi-agent systems. For simpler agents, the native tool-use capabilities of Claude or GPT-4 with a custom orchestration layer often work better than heavy frameworks. Choose based on your specific complexity needs.

Costs depend on the model, number of tool calls per task, and volume. A typical agent task might involve 5-15 LLM calls, costing £0.05-0.50 per task with mid-tier models. At scale, optimising prompt length and caching intermediate results significantly reduces costs.

Need custom AI implementation?

Our team can help you build production-ready AI solutions. Book a free strategy call.