Downcity
Remote Agent

Remote Session API

The core session methods available under RemoteAgent and their capability boundaries

Remote Session API

After you obtain a session from RemoteAgent, the most common methods are:

  • prompt()
  • subscribe()
  • history()
  • system()
  • fork()

These APIs stay intentionally close to the local session surface so you can reuse nearly the same mental model across local and remote modes.

Get a session

const session = await agent.session();

You can also pass an existing sessionId.

That lets you continue an existing remote conversation instead of always starting over.

Prompt a turn

const turn = await session.prompt({ query: "Continue" });
await turn.finished;

Subscribe to future events

const unsubscribe = session.subscribe((event) => {
  console.log(event);
});

unsubscribe();

Message history

const messages = await session.history();

System prompts

const system = await session.system();

Fork

const next = await session.fork();