[PR #10308] feat: add remote subagent protocol #13396

Closed
opened 2026-02-16 18:18:15 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10308

State: closed
Merged: No


Summary

Add support for invoking remote subagents via @domain.com or @domain.com/agent syntax. Remote subagents are fully self-contained services with their own LLM, tools, and execution environment that stream activity back to opencode for display.

This is missing a very important component: authentication. Before investing time into exploring different solutions, I wanted to see if there's an appetite at all for something like this.

To test:

  1. Open opencode
  2. Type @remote-subagent-example.vercel.app cowsay
  3. Validate sub-agent was called and output returned.

https://github.com/user-attachments/assets/5026ca1c-599f-4d86-98b7-1ef34e4360c0

Features

  • Discovery: Agents are discovered via /.well-known/agents/agents.json
  • Streaming: HTTP POST + SSE for real-time text, reasoning, and tool events
  • Trust: Session-scoped domain trust with optional config-based permanent trust
  • Integration: Remote agents display like local subagents in the TUI

Protocol

See the draft RFCs in the companion example project:

Changes

File Description
src/remote/discovery.ts Discovery protocol client, parses @domain/agent refs
src/remote/stream.ts SSE consumer, maps events to MessageV2.Part
src/remote/trust.ts Domain trust management
src/tool/task.ts Branch to remote execution for @domain refs
src/config/config.ts Add remoteAgents.domains config option
autocomplete.tsx Show remote domains in autocomplete

Usage

@localhost:3000 list files in current directory
@example.com/code-review review this function

Configuration

{
  "remoteAgents": {
    "domains": ["localhost:3000", "agents.example.com"]
  }
}
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10308 **State:** closed **Merged:** No --- ## Summary Add support for invoking remote subagents via `@domain.com` or `@domain.com/agent` syntax. Remote subagents are fully self-contained services with their own LLM, tools, and execution environment that stream activity back to opencode for display. * Example remote agent implementation: https://github.com/adriancooney/remote-subagent-example * Example transcript: https://gist.github.com/adriancooney/1a655e333723aa94f27c3b79f9b70f0a#file-opencode-transcript-md This is missing a very important component: authentication. Before investing time into exploring different solutions, I wanted to see if there's an appetite at all for something like this. To test: 1. Open opencode 2. Type `@remote-subagent-example.vercel.app cowsay` 3. Validate sub-agent was called and output returned. https://github.com/user-attachments/assets/5026ca1c-599f-4d86-98b7-1ef34e4360c0 ### Features - **Discovery**: Agents are discovered via `/.well-known/agents/agents.json` - **Streaming**: HTTP POST + SSE for real-time text, reasoning, and tool events - **Trust**: Session-scoped domain trust with optional config-based permanent trust - **Integration**: Remote agents display like local subagents in the TUI ### Protocol See the draft RFCs in the companion example project: - [RFC 001: Agent Discovery](https://gist.github.com/adriancooney/1a655e333723aa94f27c3b79f9b70f0a#file-001-agent-discovery-md) - [RFC 002: Agent Communication](https://gist.github.com/adriancooney/1a655e333723aa94f27c3b79f9b70f0a#file-002-agent-communication-md) - [RFC 003: OpenCode Integration](https://gist.github.com/adriancooney/1a655e333723aa94f27c3b79f9b70f0a#file-003-opencode-integration-md) ### Changes | File | Description | |------|-------------| | `src/remote/discovery.ts` | Discovery protocol client, parses @domain/agent refs | | `src/remote/stream.ts` | SSE consumer, maps events to MessageV2.Part | | `src/remote/trust.ts` | Domain trust management | | `src/tool/task.ts` | Branch to remote execution for @domain refs | | `src/config/config.ts` | Add `remoteAgents.domains` config option | | `autocomplete.tsx` | Show remote domains in autocomplete | ### Usage ``` @localhost:3000 list files in current directory @example.com/code-review review this function ``` ### Configuration ```json { "remoteAgents": { "domains": ["localhost:3000", "agents.example.com"] } } ```
yindo added the pull-request label 2026-02-16 18:18:15 -05:00
yindo closed this issue 2026-02-16 18:18:15 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13396