Help us shape the future of Go! Take the 2026 Go Developer Survey

basic-agents-remote

command
v1.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

This sample demonstrates a sub-agent that runs in another process. An orchestrator delegates research to a researcher agent that a second Genkit app (./researcher) serves over HTTP, and the delegation works the way it does for an agent in the same process, background tasks included.

The researcher is an ordinary Genkit app serving an agent. This program registers it with genkitx.DefineRemoteAgent and gives it to the agents middleware by name, exactly as it would a local agent.

Run it from this directory (the Google AI plugin reads GEMINI_API_KEY). It starts the researcher on 127.0.0.1:8081 and serves the orchestrator on 127.0.0.1:8080:

go run .

Chat with the orchestrator in the Dev UI, and read the trace of every delegation at http://localhost:4000/traces:

genkit start -- go run .

Or over HTTP, streaming the turn:

curl -N -X POST 'http://localhost:8080/agents/orchestrator?stream=true' \
  -H "Content-Type: application/json" \
  -d '{"data": {"message": {"role": "user", "content": [{"text": "Compare the history of Tokyo and Kyoto as capitals of Japan."}]}}}'

The orchestrator starts one researcher task per part of the question in the background, waits for them, and combines the answers.

Directories

Path Synopsis
Command researcher serves the researcher agent of the basic-agents-remote sample on 127.0.0.1:8081.
Command researcher serves the researcher agent of the basic-agents-remote sample on 127.0.0.1:8081.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL