Plugin API Reference
Complete reference for all gRPC services, messages, and enums in the AgentPlatform plugin system.
Plugin Service (required)
Every plugin must implement this service. It handles registration, health checks, and manifest discovery.
Proto file: proto/plugin.proto
Register
Called by the platform when a workspace starts and the plugin is loaded. The platform sends configuration values and environment variables; the plugin returns its name and capabilities.
rpc Register(RegisterRequest) returns (RegisterResponse)
RegisterRequest
| Field | Type | Description |
|---|---|---|
config |
map<string, string> |
Plugin configuration from the workspace HCL config {} block |
env_vars |
map<string, string> |
Workspace environment variables. For local plugins these are set in the subprocess env; for remote plugins they are sent here. |
RegisterResponse
| Field | Type | Description |
|---|---|---|
name |
string |
Plugin name (must match the HCL plugin block name) |
capabilities |
repeated Capability |
List of capabilities this plugin provides |
metadata |
map<string, string> |
Arbitrary metadata (e.g. version) |
Health
Health check polled periodically by the platform.
rpc Health(HealthRequest) returns (HealthResponse)
HealthResponse
| Field | Type | Description |
|---|---|---|
status |
Status |
SERVING or NOT_SERVING |
GetManifest
Returns the plugin's manifest HCL so remote plugins can be discovered from just a network address.
rpc GetManifest(GetManifestRequest) returns (GetManifestResponse)
GetManifestResponse
| Field | Type | Description |
|---|---|---|
manifest_hcl |
string |
The plugin manifest in HCL format (see Manifest Reference) |
Enums
Capability
| Value | Number | Description |
|---|---|---|
CAPABILITY_UNSPECIFIED |
0 | |
LLM_PROVIDER |
1 | Plugin provides LLM completions |
TOOL_PROVIDER |
2 | Plugin provides tools for the agent |
LIFECYCLE_HOOK |
3 | Plugin intercepts agent lifecycle events |
VIEW_PROVIDER |
4 | Plugin provides UI views |
Status
| Value | Number |
|---|---|
STATUS_UNSPECIFIED |
0 |
SERVING |
1 |
NOT_SERVING |
2 |
Settings API (HTTP)
Per-workspace plugin settings with form-driven UI. These values override manifest defaults but are overridden by workspace HCL config {} blocks.
Config Merge Order
When a workspace starts, plugin configuration is merged in this order (later wins):
- Plugin manifest defaults —
defaultvalues fromFieldDefin the manifest - Workspace settings — values saved via the Settings API
- Workspace HCL config —
config {}block in workspace HCL (highest priority)
GET /api/v1/workspaces/{id}/settings
Returns all plugin settings for the workspace, along with config schemas.
Response: Array of plugin setting objects:
[
{
"name": "anthropic",
"schema": [
{"name": "api_key_env", "type": "string", "required": true, ...}
],
"settings": {"api_key_env": "ANTHROPIC_API_KEY", "default_model": "claude-sonnet-4-6"}
}
]
PUT /api/v1/workspaces/{id}/settings/{plugin}
Save settings for a single plugin in a workspace. Validates values against the plugin's manifest schema.
Request:
{"settings": {"api_key_env": "ANTHROPIC_API_KEY", "default_model": "claude-sonnet-4-6"}}
Success response: {"status": "saved"}
Validation error response:
{"error": "validation failed", "fields": {"api_key_env": "required"}}
GET /api/v1/workspaces/{id}/settings/{plugin}/options/{field}?q=
Proxy endpoint for dynamic select options. Forwards the request to the field's api_source URL and returns the result. Used by searchable select components to avoid CORS issues.
Expected upstream response format:
[{"value": "us-east-1", "label": "US East (N. Virginia)"}]
ToolProvider Service
Provides custom tools that the agent can call during conversations.
Proto file: proto/tool.proto
ListTools
Returns the list of tools this plugin provides. Called once after Register.
rpc ListTools(ListToolsRequest) returns (ListToolsResponse)
ListToolsResponse
| Field | Type | Description |
|---|---|---|
tools |
repeated ToolDefinition |
List of available tools |
ToolDefinition
| Field | Type | Description |
|---|---|---|
name |
string |
Tool name (used by the agent to invoke it) |
description |
string |
Human-readable description (shown to the LLM) |
parameters_json_schema |
string |
JSON Schema describing the tool's parameters |
ExecuteTool
Called when the agent invokes a tool. The platform sends the tool name and JSON arguments; the plugin executes the tool and returns the result.
rpc ExecuteTool(ExecuteToolRequest) returns (ExecuteToolResponse)
ExecuteToolRequest
| Field | Type | Description |
|---|---|---|
name |
string |
Name of the tool to execute |
arguments_json |
string |
JSON string of tool arguments (matches the JSON Schema) |
ExecuteToolResponse
| Field | Type | Description |
|---|---|---|
result_json |
string |
JSON string result returned to the agent |
is_error |
bool |
If true, the result is treated as an error |
LLMProvider Service
Provides LLM completions with streaming support. The platform sends a conversation and the plugin streams back tokens and events.
Proto file: proto/llm.proto
Complete
Runs a completion request and streams back response events.
rpc Complete(CompleteRequest) returns (stream CompleteResponse)
CompleteRequest
| Field | Type | Description |
|---|---|---|
model |
string |
Model identifier |
messages |
repeated Message |
Conversation history |
available_tools |
repeated ToolDefinition |
Tools the LLM can call |
temperature |
optional float |
Sampling temperature |
max_tokens |
optional int32 |
Maximum tokens to generate |
Message
| Field | Type | Description |
|---|---|---|
role |
string |
"system", "user", or "assistant" |
content |
string |
Message content |
tool_calls |
repeated ToolCall |
Tool calls made by the assistant |
tool_call_id |
optional string |
If set, this is a tool result message |
ToolCall
| Field | Type | Description |
|---|---|---|
id |
string |
Unique tool call identifier |
name |
string |
Tool name |
arguments_json |
string |
JSON arguments |
CompleteResponse (streamed)
A oneof event containing one of:
| Event | Type | Description |
|---|---|---|
delta |
Delta |
Text content chunk (content field) |
tool_call_delta |
ToolCallDelta |
Tool call streaming chunk |
usage |
Usage |
Token usage (input_tokens, output_tokens) |
finish |
FinishEvent |
Stream complete |
ToolCallDelta
| Field | Type | Description |
|---|---|---|
id |
string |
Tool call ID |
name |
string |
Tool name (set on first chunk) |
arguments_chunk |
string |
Partial JSON arguments |
FinishReason
| Value | Number | Description |
|---|---|---|
FINISH_REASON_UNSPECIFIED |
0 | |
STOP |
1 | Natural end of response |
TOOL_USE |
2 | Model wants to call a tool |
MAX_TOKENS |
3 | Hit token limit |
ViewProvider Service
Provides UI views rendered in the workspace dashboard. Views are described using HCL components — plugins never produce HTML.
Proto file: proto/view.proto
ListViews
Returns the views this plugin provides. Called once after Register.
rpc ListViews(ListViewsRequest) returns (ListViewsResponse)
ListViewsResponse
| Field | Type | Description |
|---|---|---|
views |
repeated ViewDefinition |
List of views |
ViewDefinition
| Field | Type | Description |
|---|---|---|
name |
string |
Unique view identifier (e.g. "chat", "dashboard") |
label |
string |
Display label for nav/tab |
icon |
string |
Icon identifier (e.g. "chat", "calendar", "terminal") |
scope |
string |
"workspace" (tab on workspace page) or "global" (own nav section) |
routes |
repeated RouteDefinition |
API routes this view handles |
RouteDefinition
| Field | Type | Description |
|---|---|---|
method |
string |
HTTP method (GET, POST, PUT, DELETE) |
path |
string |
URL path pattern (e.g. "/api/tasks") |
RenderView
Returns HCL component definitions for a view. Called when the user navigates to the view.
rpc RenderView(RenderViewRequest) returns (RenderViewResponse)
RenderViewRequest
| Field | Type | Description |
|---|---|---|
view_name |
string |
Which view to render (matches ViewDefinition.name) |
workspace_id |
string |
Current workspace ID |
params |
map<string, string> |
Additional parameters |
RenderViewResponse
| Field | Type | Description |
|---|---|---|
component_hcl |
string |
HCL component definitions (see HCL Component Reference) |
HandleRoute
Handles a proxied HTTP request. The platform forwards matching HTTP requests to this RPC.
rpc HandleRoute(RouteRequest) returns (RouteResponse)
RouteRequest
| Field | Type | Description |
|---|---|---|
method |
string |
HTTP method |
path |
string |
Request path |
body |
bytes |
Request body |
headers |
map<string, string> |
Request headers |
query |
map<string, string> |
Query parameters |
RouteResponse
| Field | Type | Description |
|---|---|---|
status_code |
int32 |
HTTP status code |
body |
bytes |
Response body |
headers |
map<string, string> |
Response headers |
HandleStream
Bidirectional streaming RPC for WebSocket communication. The platform bridges browser WebSocket connections to this RPC. The platform never inspects the data — it acts as a dumb relay.
rpc HandleStream(stream StreamMessage) returns (stream StreamMessage)
StreamMessage
| Field | Type | Description |
|---|---|---|
data |
bytes |
Opaque payload (JSON, binary, etc.) |
metadata |
map<string, string> |
Set by the platform on the first message |
The first message from the platform contains metadata:
| Key | Description |
|---|---|
workspace_id |
Current workspace ID |
user_id |
Authenticated user's ID |
user_email |
Authenticated user's email |
After the initial metadata message, subsequent messages carry data only — the raw bytes from the browser's WebSocket.
LifecycleHook Service
Intercepts agent lifecycle events. Hooks can observe, modify, or cancel events as they flow through the agent runtime.
Proto file: proto/lifecycle.proto
OnEvent
Called for each lifecycle event. The plugin can continue, modify, or cancel the event.
rpc OnEvent(LifecycleEvent) returns (LifecycleEventResponse)
LifecycleEvent
| Field | Type | Description |
|---|---|---|
type |
EventType |
The lifecycle event type |
agent_name |
string |
Name of the agent that triggered the event |
payload_json |
bytes |
Event-specific payload as JSON |
EventType
| Value | Number | Description |
|---|---|---|
EVENT_TYPE_UNSPECIFIED |
0 | |
AGENT_START |
1 | Agent is starting a conversation |
AGENT_END |
2 | Agent finished a conversation |
TURN_START |
3 | Agent is starting a turn (one LLM call + tool execution cycle) |
TURN_END |
4 | Agent finished a turn |
LLM_REQUEST |
5 | About to send a request to the LLM |
LLM_RESPONSE |
6 | Received a response from the LLM |
TOOL_CALL |
7 | Agent is about to call a tool |
TOOL_RESULT |
8 | Tool returned a result |
HANDOFF |
9 | Agent is handing off to another agent |
LifecycleEventResponse
| Field | Type | Description |
|---|---|---|
action |
Action |
What to do with the event |
modified_payload_json |
optional bytes |
Modified payload (only used with MODIFY) |
Action
| Value | Number | Description |
|---|---|---|
ACTION_UNSPECIFIED |
0 | |
CONTINUE |
1 | Let the event proceed unchanged |
MODIFY |
2 | Replace the event payload with modified_payload_json |
CANCEL |
3 | Cancel the event (e.g. block a tool call) |
Lifecycle Event Payloads
Each event type has a specific JSON payload shape:
AGENT_START / AGENT_END
{
"agent_name": "triage",
"input": "user's message"
}
TURN_START / TURN_END
{
"agent_name": "triage",
"turn_number": 1
}
LLM_REQUEST
{
"model": "claude-sonnet-4-6",
"messages": [...],
"tools": [...]
}
LLM_RESPONSE
{
"content": "assistant response text",
"tool_calls": [{"id": "...", "name": "...", "arguments_json": "..."}],
"finish_reason": "stop"
}
TOOL_CALL
{
"tool_name": "get_weather",
"arguments_json": "{\"city\":\"SF\"}"
}
TOOL_RESULT
{
"tool_name": "get_weather",
"result_json": "{\"temperature\":72}",
"is_error": false
}
HANDOFF
{
"from_agent": "triage",
"to_agent": "specialist",
"context": "..."
}
PlatformHost Service (callback)
A callback service provided by the platform to plugins. Plugins call into this service to invoke platform capabilities like running agent conversations. The platform passes the address via the PLATFORM_HOST_ADDR environment variable (local plugins) or RegisterRequest.env_vars (remote plugins).
Proto file: proto/platform.proto
RunConversation
Runs an agent conversation in the workspace. The plugin sends input and optional history, and the platform streams back events.
rpc RunConversation(ConversationRequest) returns (stream ConversationEvent)
ConversationRequest
| Field | Type | Description |
|---|---|---|
workspace_id |
string |
Workspace to run the conversation in |
input |
string |
User's input message |
history |
repeated ChatMessageProto |
Previous conversation turns |
ChatMessageProto
| Field | Type | Description |
|---|---|---|
role |
string |
"user" or "assistant" |
content |
string |
Message content |
ConversationEvent (streamed)
| Field | Type | Description |
|---|---|---|
type |
string |
Event type (see below) |
agent |
string |
Agent name that produced this event |
content |
string |
Text content (for content events) |
tool |
string |
Tool name (for tool_call/tool_result) |
args |
string |
Tool arguments JSON (for tool_call) |
result |
string |
Tool result (for tool_result) |
is_error |
bool |
Whether tool result is an error |
target |
string |
Target agent (for handoff) |
error_message |
string |
Error details (for error) |
Event types:
| Type | Description |
|---|---|
content |
Streaming text content from the agent |
tool_call |
Agent is calling a tool |
tool_result |
Tool returned a result |
handoff |
Agent is handing off to another agent |
finish |
Conversation turn complete |
error |
An error occurred |