PHPackages                             ultimate-multisite/ai-agent - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ultimate-multisite/ai-agent

ActiveWordpress-plugin[Utility &amp; Helpers](/categories/utility)

ultimate-multisite/ai-agent
===========================

Agentic AI loop for WordPress — chat with an AI that can call WordPress abilities (tools) autonomously.

v1.18.0(5d ago)24146↓17.8%2[5 issues](https://github.com/Ultimate-Multisite/superdav-ai-agent/issues)GPL-2.0-or-laterPHPPHP &gt;=8.2CI passing

Since Mar 4Pushed 2w ago1 watchersCompare

[ Source](https://github.com/Ultimate-Multisite/superdav-ai-agent)[ Packagist](https://packagist.org/packages/ultimate-multisite/ai-agent)[ Docs](https://github.com/Ultimate-Multisite/superdav-ai-agent)[ RSS](/packages/ultimate-multisite-ai-agent/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (42)Versions (910)Used By (0)

SD AI Agent for WordPress
=========================

[](#sd-ai-agent-for-wordpress)

[![Download Plugin Now](https://camo.githubusercontent.com/1cf41ca65e70bf8e4554af8bf0e295a1fdb84582302e1dcd76feac5859844359/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f556c74696d6174652d4d756c7469736974652f73757065726461762d61692d6167656e743f7374796c653d666f722d7468652d6261646765266c6162656c3d446f776e6c6f61642b506c7567696e2b4e6f7726636f6c6f723d303037336161)](https://github.com/Ultimate-Multisite/superdav-ai-agent/releases/latest/download/superdav-ai-agent.zip) Upload the zip to WordPress like any other plugin

[![Tests](https://github.com/Ultimate-Multisite/sd-ai-agent/actions/workflows/tests.yml/badge.svg)](https://github.com/Ultimate-Multisite/sd-ai-agent/actions/workflows/tests.yml)[![Code Quality](https://github.com/Ultimate-Multisite/sd-ai-agent/actions/workflows/code-quality.yml/badge.svg)](https://github.com/Ultimate-Multisite/sd-ai-agent/actions/workflows/code-quality.yml)[![PHP 8.2+](https://camo.githubusercontent.com/1a9cfa11fa92cc87e3e433eb620749fe16de26bc22a29a651bc35decc47e4822/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e322d626c75652e737667)](https://www.php.net/)[![WordPress 7.0+](https://camo.githubusercontent.com/5723ab047e54c3bcc7b1ac4060d603126fd02b1878d225789be60286b43535b8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f576f726450726573732d253345253344253230372e302d626c75652e737667)](https://wordpress.org/)[![License: GPL v2+](https://camo.githubusercontent.com/ec6306119631a4bc812f4abc1b429674bd65410ae0ef38af01f43483fccc51ce/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d47504c25323076322532422d626c75652e737667)](https://www.gnu.org/licenses/gpl-2.0.html)[![Try in Playground](https://camo.githubusercontent.com/8b98783d5d13997b4aea34bb05675e37647e34821b555b377383df681387a4da/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f547279253230696e2d576f72645072657373253230506c617967726f756e642d3338353865393f6c6f676f3d776f72647072657373266c6f676f436f6c6f723d7768697465)](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/Ultimate-Multisite/sd-ai-agent/refs/heads/main/.wordpress-org/blueprints/blueprint.json)

[Documentation](https://github.com/Ultimate-Multisite/sd-ai-agent/wiki)

A universal AI agent for WordPress. It connects to every plugin on your site through WordPress's Abilities API, giving a single AI assistant the power to manage content, products, users, SEO, analytics, media, and more — across any plugin that registers abilities. Bring your own API key, choose any AI provider, and pay only what your provider charges.

How it works
------------

[](#how-it-works)

WordPress 7.0 introduced two core APIs that make this possible:

- **AI Client SDK** — A unified interface for AI providers. Any connector plugin (OpenAI, Anthropic, Google, Ollama, etc.) registered through the Connectors API works automatically. Switch providers or models at any time.
- **Abilities API** — A standard way for plugins to register actions an AI can take. AI Agent discovers every registered ability on your site and makes it available to the AI. Install a WooCommerce extension that registers abilities and the agent can manage orders without any extra configuration.

This means the agent gets more capable as your site grows. Every plugin that registers abilities expands what the AI can do — no glue code, no per-plugin setup.

What the agent can do out of the box
------------------------------------

[](#what-the-agent-can-do-out-of-the-box)

AI Agent ships with 28 built-in ability classes covering:

DomainExamples**Content**Create, edit, and manage posts, pages, and custom post types. Manage categories and tags.**Editorial**Review content, check readability, manage editorial workflows**WooCommerce**Manage products, orders, customers, and view sales analytics**Media**Upload, search, and manage images and files in the media library**SEO**Analyze pages, check meta tags, review structured data, find issues**Site Health**Run diagnostics, check plugin status, review security and performance**Users**List, create, and manage user accounts and roles**Blocks**Browse block types, patterns, and templates**Navigation**Manage WordPress navigation menus**Site Builder**Build and modify page layouts**Analytics**Query Google Analytics data and Google Search Console metrics**Knowledge**Search indexed content, PDFs, and external URLs (RAG)**AI Images**Generate images with AI and insert them into content**Stock Images**Search and download stock photography**Database**Run read queries against the WordPress database**Files**Read and search files on the server**Marketing**Review CDN, security headers, and performance settings**Memory &amp; Skills**Save and recall facts across sessions; load reusable instruction guidesAny plugin can register additional abilities through the WordPress Abilities API — the agent discovers and uses them automatically.

Bring Your Own Key
------------------

[](#bring-your-own-key)

Most WordPress AI plugins route calls through a proprietary proxy that marks up API costs. AI Agent talks directly to your provider:

- **Direct API calls** — Your site connects straight to OpenAI, Anthropic, Google, or any OpenAI-compatible endpoint. No middleman.
- **Full model choice** — GPT-4o, Claude Opus 4, Gemini, a local Ollama instance, or anything the WordPress AI Client connector supports. Switch models per session.
- **Transparent pricing** — You see exactly what you spend in your provider's dashboard. The plugin tracks token counts and estimated costs locally.
- **Privacy** — Conversations go directly to your chosen provider. Nothing routes through a third-party relay.

AI Provider Connectors
----------------------

[](#ai-provider-connectors)

AI Agent works with any connector plugin registered through the WordPress Connectors API. Install the ones that match your setup:

### Official WP.org connectors

[](#official-wporg-connectors)

ConnectorModelsAuth[AI Provider for OpenAI](https://wordpress.org/plugins/ai-provider-for-openai/)GPT-4o, GPT-4.1, o3, o4-mini, and moreAPI key[AI Provider for Anthropic](https://wordpress.org/plugins/ai-provider-for-anthropic/)Claude Opus 4, Sonnet 4, HaikuAPI key[AI Provider for Google](https://wordpress.org/plugins/ai-provider-for-google/)Gemini 2.5 Flash, Gemini 2.5 ProAPI key### Community connectors

[](#community-connectors)

ConnectorWhat it does[AI Provider for Anthropic Max](https://github.com/Ultimate-Multisite/ai-provider-for-anthropic-max)Use your Claude Max subscription instead of per-token API billing. Authenticates via OAuth tokens with automatic account pool rotation — ideal for teams or heavy usage where a flat-rate Max plan is cheaper than API credits.[Compatible Endpoints](https://github.com/Ultimate-Multisite/ultimate-ai-connector-compatible-endpoints)Connect to anything that speaks the OpenAI API format: Ollama (local models, zero cost), Azure OpenAI, Groq, Together AI, OpenRouter, and more.[WebLLM](https://github.com/Ultimate-Multisite/ultimate-ai-connector-webllm)Run models entirely in the browser using WebGPU. No API key, no server, no data leaves the machine. Good for demos and privacy-sensitive environments.All connectors are included in the [WordPress Playground demo](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/Ultimate-Multisite/sd-ai-agent/refs/heads/main/.wordpress-org/blueprints/blueprint.json).

### Managed Superdav AI service

[](#managed-superdav-ai-service)

The bundled **Superdav AI** connector uses a service-managed site token instead of a customer-provided provider key. For local Superdav AI Service testing, configure the OpenAI-compatible `/v1` base URL in `wp-config.php`:

```
define( 'SD_AI_AGENT_CLOUD_BASE_URL', 'http://127.0.0.1:3000/v1' );
```

When this base URL is set, plugin activation and the connector **Connect** action register the site at `POST /v1/site/installations`; model listing and chat use `GET /v1/models` and `POST /v1/chat/completions` with the stored site token as `Authorization: Bearer `. Override `SD_AI_AGENT_CLOUD_REGISTRATION_ENDPOINT` or `SD_AI_AGENT_CLOUD_REVOCATION_ENDPOINT` only when those endpoints live outside the configured base URL.

Features
--------

[](#features)

### Agentic chat

[](#agentic-chat)

- Autonomous tool-calling loop — the AI plans, executes tools, reads results, and iterates until the task is done
- Configurable max iterations (1-50) to control how many tool calls per request
- Tool confirmation — approve or reject destructive actions before they run, with "always allow" memory
- Full markdown rendering with syntax-highlighted code blocks
- Message actions: regenerate, edit and resend, delete

### Three chat interfaces

[](#three-chat-interfaces)

- **Full-page admin panel** (Tools &gt; AI Agent) — two-column layout with session sidebar, folder organization, search, and filtering
- **Floating widget** — draggable button on every admin page, expandable chat panel with multi-tab sessions
- **Screen meta panel** — collapsible panel in the WordPress screen meta area (alongside Screen Options and Help)

### Custom agents

[](#custom-agents)

Build specialized agents with the Agent Builder:

- Custom system prompts, greeting messages, and avatar icons
- Per-agent provider and model overrides
- Per-agent temperature and max iteration settings
- Enable or disable agents; users can switch between them in chat

### Session management

[](#session-management)

- Persistent conversation history in a dedicated database table
- Organize sessions into folders, pin favorites, archive old conversations
- Search across all sessions by title or content
- Export to JSON (reimportable) or Markdown (human-readable)
- Per-session token usage tracking with cost estimates

### Memory

[](#memory)

- Persistent knowledge base the AI retains across sessions
- Categories: site info, user preferences, technical notes, workflows, general
- Auto-memory mode — the AI proactively saves important facts it learns
- Full CRUD through the settings UI and through chat

### Skills

[](#skills)

- Reusable instruction guides the AI can load on demand
- Define complex workflows once ("how to optimize images", "content publishing checklist") and the agent follows them when relevant
- Enable or disable per skill

### Knowledge base (RAG)

[](#knowledge-base-rag)

- Index WordPress posts, pages, and custom post types into searchable collections
- Upload PDF documents and external URLs
- Automatic chunking with configurable size and overlap
- Full-text search across indexed content
- Auto-index on post publish/update (optional)
- The AI searches knowledge automatically when relevant context is needed

### Custom tools

[](#custom-tools)

Create tools the AI can use without writing plugin code:

- **HTTP tools** — Call any external API (weather, Zapier, Slack, etc.) with `{{placeholder}}` substitution in URLs, headers, and body
- **ACTION tools** — Fire any WordPress `do_action()` hook with arguments
- **CLI tools** — Run WP-CLI commands with argument schemas

5 example tools are seeded on first activation (Weather API, Zapier Webhook, Clear Object Cache, Maintenance Mode, Site Health Check).

### Scheduled automations

[](#scheduled-automations)

Cron-based AI tasks that run unattended:

- Define a prompt, pick a schedule (hourly / twice daily / daily / weekly), and let the agent work
- 5 quick-start templates: Daily Site Health Report, Weekly Plugin Update Check, Content Moderation, Broken Link Check, Database Optimization
- Per-automation max iteration limits
- Run any automation manually with "Run Now"
- Execution logs with duration, token usage, status, and full response

### Event-driven automations

[](#event-driven-automations)

React to WordPress hooks in real time:

- 20+ pre-registered triggers across WordPress core, WooCommerce, and form plugins
- **WordPress**: post status changed, user registered, login, comment posted, plugin activated, theme switched, media uploaded, and more
- **WooCommerce**: new order, order status changed, low stock, payment complete, refund created
- Prompt templates with `{{placeholder}}` substitution from hook arguments (e.g., `{{post.title}}`, `{{user.email}}`, `{{order.total}}`)
- Conditional execution — only fire when conditions match (post type, status, role, etc.)
- Shared logging infrastructure with scheduled automations

### Tool discovery

[](#tool-discovery)

When your site has many registered abilities (20+), the agent uses meta-tools to discover what's available instead of loading every tool definition into the system prompt:

- `list-tools` — Browse tools by category with pagination
- `execute-tool` — Run a discovered tool by name
- Configurable threshold and mode (auto / always / never)
- Reduces token usage on sites with dozens of tools

### Smart conversation trimming

[](#smart-conversation-trimming)

Prevents context window overflow in long agentic loops:

- Counts tool-call/response cycles and trims at safe boundaries
- Never cuts mid-tool-cycle or drops the first turn
- Configurable max history turns (default: 20)
- Transparent trimming marker so the AI knows context was compressed

### Suggestion chips

[](#suggestion-chips)

After each AI response, clickable follow-up suggestions appear:

- AI generates 2-4 contextual suggestions
- One click sends the suggestion as your next message
- Configurable count (0-5)

### Access and branding

[](#access-and-branding)

- Role-based permissions — control which WordPress roles can access the agent
- Custom branding — set a custom name, logo, and colors for the chat interface

### Usage dashboard

[](#usage-dashboard)

- Per-session and aggregate token counts (prompt + completion)
- Cost estimates based on current model pricing
- Breakdown by model and time period

### Provider trace

[](#provider-trace)

Debug mode that captures the raw HTTP traffic between WordPress and your AI provider. Useful for troubleshooting connection issues and inspecting the exact prompts and responses.

### Context providers

[](#context-providers)

The AI automatically receives relevant context about the current page:

- Current admin page URL and title
- Site information (name, URL, WordPress version)
- Extensible — plugins can register additional context providers

Requirements
------------

[](#requirements)

- WordPress 7.0+
- PHP 8.2+
- An AI provider connector plugin (see [AI Provider Connectors](#ai-provider-connectors) above)
- An API key from your chosen provider (or a Claude Max subscription, or a local Ollama instance)

Installation
------------

[](#installation)

1. Upload the `sd-ai-agent` folder to `/wp-content/plugins/`
2. Activate through the Plugins screen
3. Configure an AI provider in **Settings &gt; AI Credentials** (WordPress core Connectors API)
4. Go to **Tools &gt; AI Agent Settings** to select your default provider and model
5. Open **Tools &gt; AI Agent** to start chatting

Configuration
-------------

[](#configuration)

All settings live under **Tools &gt; AI Agent Settings** with these tabs:

TabWhat it controlsGeneralDefault provider, model, max iterations, system prompt, greeting messageMemory &amp; KnowledgeAuto-memory toggle, memory CRUD, RAG collections and sourcesSkillsCreate and manage instruction guidesToolsCustom HTTP/ACTION/CLI tools, per-ability permission controls (auto / confirm / disabled)AutomationsScheduled cron-based AI tasks and event-driven hook automationsAgentsCreate and manage custom agents with their own prompts, models, and settingsAccess &amp; BrandingRole permissions, custom name, logo, and colorsUsageToken counts and cost trackingProvider TraceDebug HTTP traffic between WordPress and AI providersAdvancedTemperature, max tokens, context window, tool discovery settingsArchitecture
------------

[](#architecture)

```
sd-ai-agent/
├── sd-ai-agent.php             # Bootstrap, requires, hooks
├── includes/
│   ├── Abilities/                   # 28 ability classes (tools the AI can call)
│   ├── Admin/                       # Admin pages, floating widget, screen-meta panel
│   ├── Automations/                 # Scheduled + event-driven automation system
│   ├── Benchmark/                   # Model benchmark runner and suite
│   ├── CLI/                         # WP-CLI command
│   ├── Core/                        # AgentLoop, Database, Settings, CostCalculator, etc.
│   ├── Enums/                       # PHP 8.1 enums (ToolType, Schedule, etc.)
│   ├── Knowledge/                   # RAG pipeline (collections, sources, chunks)
│   ├── Models/                      # Data models (Memory, Skill, Agent, Chunker, etc.)
│   ├── REST/                        # REST API, SSE streamer, MCP server, webhooks
│   └── Tools/                       # Custom tools, tool discovery
├── src/
│   ├── admin-page/                  # Full-page chat React app
│   ├── floating-widget/             # Draggable widget React app
│   ├── screen-meta/                 # Screen meta panel React app
│   ├── benchmark-page/              # Model benchmark React app
│   ├── unified-admin/               # Unified admin menu entry point
│   ├── settings-page/               # Settings React app
│   ├── abilities-explorer/          # Abilities browser
│   ├── changes-page/                # Changelog viewer
│   ├── components/                  # Shared React components
│   ├── store/                       # Redux store (actions, selectors)
│   └── utils/                       # Keyboard shortcuts, helpers
└── build/                           # Compiled assets

```

### REST API pattern

[](#rest-api-pattern)

The agent uses an **async job + polling** pattern to handle long-running inference:

1. `POST /sd-ai-agent/v1/run` — Starts a background job, returns `job_id`
2. `GET /sd-ai-agent/v1/job/{id}` — Poll until `status: completed` (or `awaiting_confirmation` for tool approval)
3. `POST /sd-ai-agent/v1/job/{id}/confirm` or `/reject` — Handle tool confirmations

This avoids HTTP timeout issues with multi-step agentic loops that can take 30+ seconds.

### Extending

[](#extending)

**Register custom abilities** that the agent can use:

```
add_action( 'wp_abilities_api_init', function() {
    wp_register_ability( 'my_custom_tool', [
        'label'       => 'My Custom Tool',
        'description' => 'Does something useful',
        'category'    => 'my-plugin',
        'callback'    => 'my_tool_callback',
        'schema'      => [
            'type'       => 'object',
            'properties' => [
                'param' => [ 'type' => 'string', 'description' => 'A parameter' ],
            ],
        ],
    ] );
} );
```

The agent discovers and uses any registered ability automatically.

**Add context providers:**

```
add_filter( 'ai_agent_context_providers', function( $providers ) {
    $providers[] = [
        'label'    => 'My Plugin Context',
        'priority' => 10,
        'callback' => function() {
            return "Current inventory count: " . get_inventory_count();
        },
    ];
    return $providers;
} );
```

Development
-----------

[](#development)

```
# Install dependencies
npm install
composer install

# Development build with watch
npm start

# Production build
npm run build

# Run linters
composer phpcs      # PHP CodeSniffer
composer phpcbf     # Auto-fix PHPCS issues
composer phpstan    # Static analysis
composer test       # PHPUnit tests
```

### WordPress Playground testing

[](#wordpress-playground-testing)

Test the plugin instantly in your browser without any local setup:

- **Latest release**: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/Ultimate-Multisite/sd-ai-agent/refs/heads/main/.wordpress-org/blueprints/blueprint.json) (login: `admin` / `password`)

The canonical blueprint lives at `.wordpress-org/blueprints/blueprint.json` — this is the path WordPress.org uses when displaying the plugin in the plugin directory.

License
-------

[](#license)

GPL-2.0-or-later

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance94

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 89.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Recently: every ~10 days

Total

24

Last Release

5d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.4

v1.3.0PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1534605?v=4)[David Stone](/maintainers/superdav42)[@superdav42](https://github.com/superdav42)

---

Top Contributors

[![superdav42](https://avatars.githubusercontent.com/u/1534605?v=4)](https://github.com/superdav42 "superdav42 (1181 commits)")[![actions-user](https://avatars.githubusercontent.com/u/65916846?v=4)](https://github.com/actions-user "actions-user (140 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ultimate-multisite-ai-agent/health.svg)

```
[![Health](https://phpackages.com/badges/ultimate-multisite-ai-agent/health.svg)](https://phpackages.com/packages/ultimate-multisite-ai-agent)
```

###  Alternatives

[illuminate/contracts

The Illuminate Contracts package.

706130.3M13.4k](/packages/illuminate-contracts)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[flow-php/etl

PHP ETL - Extract Transform Load - Abstraction

378604.0k104](/packages/flow-php-etl)[automattic/jetpack

Jetpack supercharges your self‑hosted WordPress site with the awesome cloud power of WordPress.com

3622.8k](/packages/automattic-jetpack)[shopware/app-php-sdk

Shopware App SDK for PHP

15109.8k3](/packages/shopware-app-php-sdk)[php-opcua/opcua-client

Pure PHP OPC UA client — binary protocol over TCP, 6 security policies, browse/read/write/subscribe/history, zero external dependencies

131.4k23](/packages/php-opcua-opcua-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
