Remote Agent

RemoteAgent Quickstart

Connect to an Agent that has already been exposed by Downcity over HTTP or by Agent RPC

RemoteAgent Quickstart

RemoteAgent is the remote session client.

It currently supports:

  • http://...
  • https://...
  • rpc://...

Expose a reachable server-side endpoint first

Option 1: publish HTTP through Downcity

downcity agent start

Option 2: start RPC on the server

import { Agent } from "@downcity/agent";
import { AgentRPC } from "@downcity/server";

const agent = new Agent({ id, path, model });
await agent.ready();

const rpc = new AgentRPC(agent);
await rpc.listen({ host: "127.0.0.1", port: 15314 });

Connect from the client

Connect over HTTP

import { RemoteAgent } from "@downcity/agent";

const agent = new RemoteAgent({
  url: "http://127.0.0.1:5314/agents/repo-helper",
});

const session = await agent.session_collection().create_session();
const turn = await session.prompt({
  query: "Summarize the current repository structure",
});

const result = await turn.finished;

Connect over RPC

import { RemoteAgent } from "@downcity/agent";

const agent = new RemoteAgent({
  url: "rpc://127.0.0.1:15314",
});

One important limitation

Remote sessions do not currently support:

await session.set({ model });

The model should stay on the server side.

If you are in pure SDK mode, configure the model on the server-side local Agent or local session.

If you are in Downcity integration mode, the model usually comes from:

  • downcity.json.execution.modelId
  • the connected Federation AIService

Good fit for

  • another process already owns the local Agent
  • you only want to consume agent capability through HTTP or RPC
  • you want to separate the caller from the executor