Summary
agents/chat is a useful runtime seam, but browser clients still need a stable HTTP surface. The frontend-agent-chat migration had to implement its own REST adapter that translates @extrachill/chat requests into the canonical agents/chat ability.
That adapter proves the seam works, but every frontend agent widget should not need to recreate it.
Current State
Agents API provides:
agents/chat ability
wp_agent_chat_handler filter
agents_chat_permission filter
But it does not provide a generic REST controller for browser clients.
Proposed Surface
Add a generic REST endpoint, ability-backed and handler-agnostic:
POST /wp-json/agents/v1/chat
Input should mirror agents/chat:
{
"agent": "site-assistant",
"message": "What changed today?",
"session_id": "optional-session-id",
"attachments": [],
"client_context": {
"source": "rest",
"client_name": "frontend-agent-chat",
"connector_id": "frontend-agent-chat"
}
}
Output should mirror the canonical ability output:
{
"session_id": "...",
"reply": "...",
"messages": [],
"completed": true,
"metadata": {}
}
Acceptance Criteria
- Browser clients can call
agents/chat without product-specific REST adapters.
- Permission checks go through the same
agents_chat_permission path as direct ability calls.
- Runtime selection remains host-owned via
wp_agent_chat_handler.
- The endpoint does not depend on Data Machine or any other product plugin.
Why It Matters
This lets two plugins that do not depend on each other both consume the same Agents API seam:
frontend-agent-chat -> Agents API REST -> agents/chat -> Data Machine handler
Related
Summary
agents/chatis a useful runtime seam, but browser clients still need a stable HTTP surface. Thefrontend-agent-chatmigration had to implement its own REST adapter that translates@extrachill/chatrequests into the canonicalagents/chatability.That adapter proves the seam works, but every frontend agent widget should not need to recreate it.
Current State
Agents API provides:
But it does not provide a generic REST controller for browser clients.
Proposed Surface
Add a generic REST endpoint, ability-backed and handler-agnostic:
Input should mirror
agents/chat:{ "agent": "site-assistant", "message": "What changed today?", "session_id": "optional-session-id", "attachments": [], "client_context": { "source": "rest", "client_name": "frontend-agent-chat", "connector_id": "frontend-agent-chat" } }Output should mirror the canonical ability output:
{ "session_id": "...", "reply": "...", "messages": [], "completed": true, "metadata": {} }Acceptance Criteria
agents/chatwithout product-specific REST adapters.agents_chat_permissionpath as direct ability calls.wp_agent_chat_handler.Why It Matters
This lets two plugins that do not depend on each other both consume the same Agents API seam:
Related