AgentForge

Example: WooCommerce Bot

Build an e-commerce support bot with WooCommerce integration.

Overview

An agent that helps customers check order status, find products, and handle common e-commerce queries.

Implementation

import {
  defineAgent, createLLM, createWooCommerceTools,
} from '@ahzan-agentforge/core';

const wcTools = createWooCommerceTools({
  url: process.env.WOOCOMMERCE_URL!,
  consumerKey: process.env.WC_CONSUMER_KEY!,
  consumerSecret: process.env.WC_CONSUMER_SECRET!,
});

const agent = defineAgent({
  name: 'shop-assistant',
  description: 'Helps customers with their e-commerce queries',
  tools: wcTools,
  llm: createLLM({ provider: 'anthropic', model: 'claude-sonnet-4-20250514' }),
  systemPrompt: `You are a friendly shop assistant for an online store.
You can look up orders, check product availability, and help with common questions.
Always be helpful and provide specific details from the store data.`,
  maxSteps: 8,
  budget: { maxCostUsd: 0.20 },
  policy: {
    tools: [
      { pattern: 'update-order-status', permission: 'escalate', reason: 'Order modification' },
    ],
  },
});

const result = await agent.run({
  task: 'Customer asks: What is the status of order #1056?',
});

Key Features

  • Pre-built integration — WooCommerce tools with zero boilerplate
  • Autonomy policy — order modifications require approval
  • Budget control — capped at $0.20 per interaction

Next Steps