Summary
Agent Ping is currently a standalone pipeline step type (AgentPingStep) that POSTs pipeline context to external webhook URLs. It shares the same structural pattern as system tasks (self-configuring, job-tracked, ability-backed) but exists outside the SystemTask / TaskRegistry / TaskScheduler framework. This means it's only usable as a pipeline step — not standalone via CLI, REST, or scheduled cron.
This issue proposes converting Agent Ping from a standalone step type into a registered SystemTask, making it a first-class citizen in the system task framework while preserving all existing functionality and UX.
Motivation
- Architectural consistency — Agent Ping is an operation (send HTTP POST). System tasks are registered, schedulable, trackable operations. These are the same concept.
- Standalone execution — Currently agent ping is pipeline-bound. As a system task it gets
wp datamachine system run agent_ping, REST POST /system/tasks/agent_ping/run, and scheduled cron for free.
- Fewer step types — The "Agent Ping" step type in the pipeline builder dropdown is replaced by the existing "System Task" step type with
agent_ping selected from the task dropdown. Same UX, one fewer concept.
- Shared infrastructure — Prompt overrides, batch scheduling, undo, admin UI "Run Now" — all inherited from
SystemTask base class.
- Extension ecosystem alignment — Third-party developers register tasks via
datamachine_tasks filter. Agent ping follows the same pattern.
Plan
Phase 1: Create AgentPingTask
New file: inc/Engine/AI/System/Tasks/AgentPingTask.php
- Extends
SystemTask
- Implements
execute(int $jobId, array $params): void
- Delegates to
SendPingAbility for the actual HTTP POST logic
- Moves webhook-specific config (URL, auth headers, reply_to) into task params
- Registers via
datamachine_tasks filter in SystemAgentServiceProvider::getBuiltInTasks()
class AgentPingTask extends SystemTask {
public function execute(int $jobId, array $params): void {
// Read params: webhook_url, prompt, auth_header_name, auth_token, reply_to
// Resolve prompt from queue or configured value
// Delegate to SendPingAbility
// Report success/failure via completeJob()/failJob()
}
public function getTaskType(): string {
return 'agent_ping';
}
public static function getTaskMeta(): array {
return [
'label' => 'Agent Ping',
'description' => 'Send context to external webhook endpoints (Discord, Slack, custom)',
'setting_key' => null,
'trigger_type' => 'manual',
'supports_run' => true,
];
}
}
Config params shape (stored in engine_data):
{
"webhook_url": "https://discord.com/api/webhooks/...",
"prompt": "Review this content",
"auth_header_name": "",
"auth_token": "",
"reply_to": "",
"from_queue": false
}
Phase 2: Add queue support to AgentPingTask
- Agent Ping currently uses
QueueableTrait in the step. As a system task, the prompt queue mechanism needs to be available.
- Option A:
AgentPingTask directly reads from the flow queue via QueueAbility::popFromQueue() when executed as a pipeline step (has flow_id and flow_step_id in params).
- Option B: Move queue popping into the task's
execute() method, checking for flow_step_id in params to determine if running in pipeline context.
Phase 3: Update SystemTaskStep for agent ping UX
File: inc/Core/Steps/SystemTask/SystemTaskStep.php
No changes needed. SystemTaskStep already handles any registered task type. When user selects "System Task" step type and picks agent_ping, it creates a child job and runs AgentPingTask::execute() synchronously. The existing SystemTaskSettings task dropdown will show "Agent Ping" automatically.
Phase 4: Remove standalone step type
Delete:
inc/Core/Steps/AgentPing/AgentPingStep.php
inc/Core/Steps/AgentPing/AgentPingSettings.php
inc/Core/Steps/AgentPing/ directory
Update data-machine.php:
- Remove
new AgentPingStep() from datamachine_load_step_types()
- Remove
AgentPingAbilities require/instantiation (ability moves to task delegation)
Phase 5: Keep existing surfaces intact
Keep as-is (no changes):
inc/Abilities/AgentPing/SendPingAbility.php — still the reusable HTTP layer
inc/Api/AgentPing.php — REST callback endpoints still work
inc/Api/Chat/Tools/SendPing.php — chat tool still works
inc/Abilities/AgentPingAbilities.php — may need adjustment since step no longer instantiates it, but the ability registration should persist for chat/REST/CLI use
Phase 6: Migration
File: inc/migrations.php
- Add migration to convert existing
agent_ping step types in flow configs to system_task step types with task: 'agent_ping' in handler_config.
- The migration should:
- Query all flows with steps where
step_type === 'agent_ping'
- Convert
step_type to 'system_task'
- Move handler config to use
task: 'agent_ping' key
- Preserve webhook_url, prompt, auth settings as task params
Files Changed
| Action |
File |
Notes |
| Create |
inc/Engine/AI/System/Tasks/AgentPingTask.php |
New SystemTask subclass |
| Delete |
inc/Core/Steps/AgentPing/AgentPingStep.php |
Replaced by SystemTaskStep |
| Delete |
inc/Core/Steps/AgentPing/AgentPingSettings.php |
Replaced by SystemTaskSettings |
| Update |
inc/Engine/AI/System/SystemAgentServiceProvider.php |
Register agent_ping in getBuiltInTasks() |
| Update |
data-machine.php |
Remove AgentPingStep registration |
| Update |
inc/migrations.php |
Flow config migration for existing agent_ping steps |
| Keep |
inc/Abilities/AgentPing/SendPingAbility.php |
Unchanged — reusable HTTP layer |
| Keep |
inc/Api/AgentPing.php |
Unchanged — REST callbacks |
| Keep |
inc/Api/Chat/Tools/SendPing.php |
Unchanged — chat tool |
New Capabilities Gained
After this change, agent ping can be triggered from:
| Surface |
How |
New? |
| Pipeline step |
System Task step → select "Agent Ping" |
Existing UX |
| CLI |
wp datamachine system run agent_ping --params='{"webhook_url":"..."}' |
New |
| REST |
POST /datamachine/v1/system/tasks/agent_ping/run |
New |
| Scheduled cron |
TaskScheduler::schedule('agent_ping', ...) via daily/event trigger |
New |
| Chat tool |
send_ping tool |
Existing |
| Ad-hoc ability |
wp_get_ability('datamachine/send-ping') |
Existing |
| Admin UI |
"Run Now" button on system tasks page |
New |
Blockers / Open Questions
- Queue support in system tasks —
QueueableTrait is currently a step-level concern. System tasks don't have a queue concept. Need to decide if AgentPingTask reads from the flow queue directly (coupling to pipeline context) or if queue support should be added to the SystemTask base class.
- Callback transients — The REST callback system (
AgentPing class) stores transients keyed by callback_id. This doesn't need to change, but we should confirm the callback flow still works when the ping originates from a system task job instead of a pipeline step job.
- Frontend config — The admin UI for configuring agent ping webhook URLs currently lives in
AgentPingSettings. After migration, this config needs to work within SystemTaskSettings's JSON params field, or we need a custom settings renderer for the agent_ping task type within the system task config modal.
- Prompt overrides — Agent ping doesn't currently have prompt definitions. As a system task it could optionally expose
getPromptDefinitions() for admin-editable prompt templates.
Definition of Done
Summary
Agent Ping is currently a standalone pipeline step type (
AgentPingStep) that POSTs pipeline context to external webhook URLs. It shares the same structural pattern as system tasks (self-configuring, job-tracked, ability-backed) but exists outside theSystemTask/TaskRegistry/TaskSchedulerframework. This means it's only usable as a pipeline step — not standalone via CLI, REST, or scheduled cron.This issue proposes converting Agent Ping from a standalone step type into a registered
SystemTask, making it a first-class citizen in the system task framework while preserving all existing functionality and UX.Motivation
wp datamachine system run agent_ping, RESTPOST /system/tasks/agent_ping/run, and scheduled cron for free.agent_pingselected from the task dropdown. Same UX, one fewer concept.SystemTaskbase class.datamachine_tasksfilter. Agent ping follows the same pattern.Plan
Phase 1: Create
AgentPingTaskNew file:
inc/Engine/AI/System/Tasks/AgentPingTask.phpSystemTaskexecute(int $jobId, array $params): voidSendPingAbilityfor the actual HTTP POST logicdatamachine_tasksfilter inSystemAgentServiceProvider::getBuiltInTasks()Config params shape (stored in
engine_data):{ "webhook_url": "https://discord.com/api/webhooks/...", "prompt": "Review this content", "auth_header_name": "", "auth_token": "", "reply_to": "", "from_queue": false }Phase 2: Add queue support to
AgentPingTaskQueueableTraitin the step. As a system task, the prompt queue mechanism needs to be available.AgentPingTaskdirectly reads from the flow queue viaQueueAbility::popFromQueue()when executed as a pipeline step (hasflow_idandflow_step_idin params).execute()method, checking forflow_step_idin params to determine if running in pipeline context.Phase 3: Update
SystemTaskStepfor agent ping UXFile:
inc/Core/Steps/SystemTask/SystemTaskStep.phpNo changes needed.
SystemTaskStepalready handles any registered task type. When user selects "System Task" step type and picksagent_ping, it creates a child job and runsAgentPingTask::execute()synchronously. The existingSystemTaskSettingstask dropdown will show "Agent Ping" automatically.Phase 4: Remove standalone step type
Delete:
inc/Core/Steps/AgentPing/AgentPingStep.phpinc/Core/Steps/AgentPing/AgentPingSettings.phpinc/Core/Steps/AgentPing/directoryUpdate
data-machine.php:new AgentPingStep()fromdatamachine_load_step_types()AgentPingAbilitiesrequire/instantiation (ability moves to task delegation)Phase 5: Keep existing surfaces intact
Keep as-is (no changes):
inc/Abilities/AgentPing/SendPingAbility.php— still the reusable HTTP layerinc/Api/AgentPing.php— REST callback endpoints still workinc/Api/Chat/Tools/SendPing.php— chat tool still worksinc/Abilities/AgentPingAbilities.php— may need adjustment since step no longer instantiates it, but the ability registration should persist for chat/REST/CLI usePhase 6: Migration
File:
inc/migrations.phpagent_pingstep types in flow configs tosystem_taskstep types withtask: 'agent_ping'in handler_config.step_type === 'agent_ping'step_typeto'system_task'task: 'agent_ping'keyFiles Changed
inc/Engine/AI/System/Tasks/AgentPingTask.phpinc/Core/Steps/AgentPing/AgentPingStep.phpinc/Core/Steps/AgentPing/AgentPingSettings.phpinc/Engine/AI/System/SystemAgentServiceProvider.phpagent_pingingetBuiltInTasks()data-machine.phpinc/migrations.phpinc/Abilities/AgentPing/SendPingAbility.phpinc/Api/AgentPing.phpinc/Api/Chat/Tools/SendPing.phpNew Capabilities Gained
After this change, agent ping can be triggered from:
wp datamachine system run agent_ping --params='{"webhook_url":"..."}'POST /datamachine/v1/system/tasks/agent_ping/runTaskScheduler::schedule('agent_ping', ...)via daily/event triggersend_pingtoolwp_get_ability('datamachine/send-ping')Blockers / Open Questions
QueueableTraitis currently a step-level concern. System tasks don't have a queue concept. Need to decide ifAgentPingTaskreads from the flow queue directly (coupling to pipeline context) or if queue support should be added to theSystemTaskbase class.AgentPingclass) stores transients keyed by callback_id. This doesn't need to change, but we should confirm the callback flow still works when the ping originates from a system task job instead of a pipeline step job.AgentPingSettings. After migration, this config needs to work withinSystemTaskSettings's JSON params field, or we need a custom settings renderer for theagent_pingtask type within the system task config modal.getPromptDefinitions()for admin-editable prompt templates.Definition of Done
AgentPingTaskregistered inTaskRegistryand executable standalonewp datamachine system run agent_pingworksPOST /system/tasks/agent_ping/runworksAgentPingStepandAgentPingSettingsdeleted