PHPackages                             gtstudio/module-ai-agents - 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. [Admin Panels](/categories/admin)
4. /
5. gtstudio/module-ai-agents

ActiveMagento2-module[Admin Panels](/categories/admin)

gtstudio/module-ai-agents
=========================

Agent and tool registry for Magento 2. Provides admin CRUD for AI agents and tools, cron-based scheduled execution, and an execution log.

1.0.2(1mo ago)08↓100%3BUSL-1.1PHPPHP &gt;=8.1

Since Mar 9Pushed 1mo agoCompare

[ Source](https://github.com/gabrielgts/module-ai-agents)[ Packagist](https://packagist.org/packages/gtstudio/module-ai-agents)[ RSS](/packages/gtstudio-module-ai-agents/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (3)Used By (3)

Gtstudio\_AiAgents
==================

[](#gtstudio_aiagents)

Agent and tool registry for Magento 2. Provides a full admin UI to define, store, and execute AI agents backed by `Gtstudio_AiConnector`.

Preview
-------

[](#preview)

[![AiAgents — creating an agent, attaching tools, and running it on-demand](docs/images/aiagents-preview.gif)](docs/images/aiagents-preview.gif)

AI Studio Ecosystem
-------------------

[](#ai-studio-ecosystem)

Part of the **AI Studio** suite for Magento 2. See all modules:

ModuleRepositoryDescription**Gtstudio\_AiConnector**[module-aiconnector](https://github.com/gabrielgts/module-aiconnector)Core AI provider abstraction**Gtstudio\_AiAgents***(this module)*Agent &amp; tool orchestration, cron scheduling, execution log**Gtstudio\_AiWidgets**[module-ai-widgets](https://github.com/gabrielgts/module-ai-widgets)Floating admin chat widget + PageBuilder AI generator**Gtstudio\_AiDataQuery**[module-ai-data-query](https://github.com/gabrielgts/module-ai-data-query)Natural-language store analytics (privacy-first)**Gtstudio\_AiKnowledgeBase**[module-ai-knowledge-base](https://github.com/gabrielgts/module-ai-knowledge-base)Document upload &amp; RAG retrieval for agents**Gtstudio\_AiDashboard**[module-ai-dashboard](https://github.com/gabrielgts/module-ai-dashboard)AI-powered KPI dashboard with ML insightsWhat It Does
------------

[](#what-it-does)

- Admin CRUD for **Agents** — each agent has a system prompt (background, steps, output instructions), a list of tools it can call, and optional cron scheduling
- Admin CRUD for **Tools** — reusable tool definitions that the NeuronAI framework exposes to agents
- **Run Immediately** — execute any agent from its edit page with a custom input and see the result in a modal
- **Cron Scheduling** — enable a cron expression per agent so it runs automatically on a schedule
- **Execution Log** — every run is recorded with status, input, output, token counts, and trigger source
- **Auto-pruning** — execution log entries are deleted after a configurable number of days

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

[](#requirements)

- Magento 2.4.4+
- PHP 8.1+
- `Gtstudio_AiConnector` enabled and configured

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

[](#installation)

```
composer require gtstudio/module-ai-agents
php bin/magento module:enable Gtstudio_AiAgents
php bin/magento setup:upgrade
```

Admin UI
--------

[](#admin-ui)

*AI Studio → Agents &amp; Tools*

### Agents

[](#agents)

FieldDescriptionCodeUnique machine-readable identifier, e.g. `customer_support`DescriptionInternal label — not sent to the LLMBackgroundAgent identity (maps to NeuronAI `SystemPrompt::$background`)StepsInternal reasoning steps (`SystemPrompt::$steps`)Output InstructionsResponse format rules (`SystemPrompt::$output`)ToolsMulti-select of registered toolsAdditional ConfigsOptional JSON for advanced NeuronAI overrides**Scheduling**

FieldDescriptionEnable CronToggle to activate scheduled executionCron ExpressionStandard 5-field expression, e.g. `0 * * * *`Cron Input TemplateInput sent to the agent on each scheduled run. Supports `{{date}}`, `{{datetime}}`, `{{timestamp}}`, `{{store_name}}`, `{{store_url}}`### Execution Log

[](#execution-log)

*AI Studio → Agents &amp; Tools → Execution Log*

Lists every agent run with status, token counts, trigger source (manual / cron), and error messages.

Log retention is controlled by: *Stores → Configuration → aiagents → Execution → Log Retention Days* (default: 30)

Running an Agent Programmatically
---------------------------------

[](#running-an-agent-programmatically)

```
use Gtstudio\AiAgents\Api\AgentRunInterface;

class MyService
{
    public function __construct(private readonly AgentRunInterface $agentRunner) {}

    public function run(): void
    {
        $result = $this->agentRunner->run('customer_support', 'How do I reset my password?');

        echo $result['content'];        // agent reply
        echo $result['tokens'];         // total tokens used
        echo $result['input_tokens'];   // input tokens
        echo $result['output_tokens'];  // output tokens
        echo $result['model'];          // model used
        echo $result['provider'];       // provider key
    }
}
```

Extensibility
-------------

[](#extensibility)

### Registering a Tool Executor

[](#registering-a-tool-executor)

Tools define what the agent *can* call; executors contain the actual PHP logic that runs when an agent chooses a tool.

1. Create the tool record in *AI Studio → Agents &amp; Tools → Tools* with a unique `code` (e.g. `get_order_status`).
2. Implement `Gtstudio\AiAgents\Api\ToolExecutorInterface`:

```
namespace Vendor\Module\Model\Tool;

use Gtstudio\AiAgents\Api\ToolExecutorInterface;

class GetOrderStatusExecutor implements ToolExecutorInterface
{
    /**
     * @param array $parameters  Parameters chosen by the LLM from the tool's property definitions.
     * @return string|array      Result shown to the LLM (string) or returned as data (array).
     */
    public function execute(array $parameters): string|array
    {
        $orderId = $parameters['order_id'] ?? null;
        // ... fetch order, return status string
        return "Order #{$orderId} is currently: Shipped.";
    }
}
```

3. Register it in `etc/di.xml`:

```

                Vendor\Module\Model\Tool\GetOrderStatusExecutor

```

The key (`get_order_status`) must match the `code` field stored in the `gtstudio_ai_tools` table.

### Using AgentExecutionService Directly

[](#using-agentexecutionservice-directly)

For advanced use-cases (custom trigger sources, post-processing), inject `AgentExecutionService`:

```
use Gtstudio\AiAgents\Model\AgentExecutionLogModel;
use Gtstudio\AiAgents\Model\Service\AgentExecutionService;

$log = $this->executionService->execute(
    'my_agent_code',
    'Input text here',
    AgentExecutionLogModel::TRIGGERED_MANUAL  // or TRIGGERED_CRON
);

if ($log->getData('status') === AgentExecutionLogModel::STATUS_SUCCESS) {
    $output = $log->getData('output');
}
```

### Cron Expression Syntax

[](#cron-expression-syntax)

The built-in matcher supports the five standard fields (minute, hour, day, month, weekday):

PatternMeaning`* * * * *`Every minute`0 * * * *`Every hour`0 0 * * *`Daily at midnight`*/15 * * * *`Every 15 minutes`0 9 * * 1-5`Weekdays at 09:00`0 6,18 * * *`06:00 and 18:00 daily### Template Variables in Cron Input

[](#template-variables-in-cron-input)

TokenReplaced With`{{date}}``2026-03-08``{{datetime}}``2026-03-08 14:00:00``{{timestamp}}`Unix timestamp`{{store_name}}`Default store view name`{{store_url}}`Default store base URLExample: `Generate a daily sales summary for {{date}} on {{store_name}}.`

Database Tables
---------------

[](#database-tables)

TablePurpose`gtstudio_ai_agent`Agent definitions`gtstudio_ai_tools`Tool definitions`gtstudio_ai_agent_execution_log`Execution history

###  Health Score

40

—

FairBetter than 87% of packages

Maintenance96

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

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 ~1 days

Total

2

Last Release

59d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab1f0030c21bebf4e87187df361e770ffaa2c0d3cdcd0cd45c77a79db5836156?d=identicon)[gtstudio](/maintainers/gtstudio)

### Embed Badge

![Health badge](/badges/gtstudio-module-ai-agents/health.svg)

```
[![Health](https://phpackages.com/badges/gtstudio-module-ai-agents/health.svg)](https://phpackages.com/packages/gtstudio-module-ai-agents)
```

###  Alternatives

[kiwicommerce/module-cron-scheduler

Easily set up and manage cron jobs from the backend with a beautiful and managed timeline feature. Find the actual load on CPU/Memory by cron job execution.

74603.3k](/packages/kiwicommerce-module-cron-scheduler)[mage-os/theme-adminhtml-m137

M137 Admin Theme

35116.7k](/packages/mage-os-theme-adminhtml-m137)[markshust/magento2-module-ordergrid

The Order Grid module adds more details to the order grid in the admin.

9181.2k](/packages/markshust-magento2-module-ordergrid)[smile/module-seller

Smile Retailer Suite - Seller Module

13528.3k3](/packages/smile-module-seller)[kiwicommerce/module-customer-password

Magento 2 - Customer Password

1356.3k](/packages/kiwicommerce-module-customer-password)[magevision/module-admin-category-product-thumbnail

Admin Category Product Thumbnail Extension for Magento 2

115.2k](/packages/magevision-module-admin-category-product-thumbnail)

PHPackages © 2026

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