Downcity
API Reference

Agent Class

The core public interface of the local Agent SDK

Agent Class

The local Agent exposes these core public entry points:

  • new Agent(options)
  • agent.start(options?)
  • agent.stop()
  • agent.session(sessionId?)
  • agent.sessions()
  • agent.plugins

Constructor options

  • id
  • path
  • tools
  • instruction
  • services
  • plugins
  • platform
  • configureSession

Core semantics

  • Agent itself is the local execution shell
  • the real execution object is the session it creates

From an API-design perspective, it behaves more like a session factory plus a long-lived runtime entry point.

start() and stop()

agent.start() starts the long-lived runtime capabilities of the current agent.

Typical examples include:

  • starting the HTTP server
  • starting the local RPC server
  • starting service lifecycles

Recommended usage:

await agent.start({
  http: {
    host: "127.0.0.1",
    port: 15314,
  },
  rpc: true,
});

If you do not call agent.start():

  • you can still call await agent.session() and then session.prompt()
  • but no HTTP or RPC endpoint starts
  • and no background service lifecycle starts

agent.stop() closes whichever long-lived capabilities are currently running.

Lifecycle entry

But for most user scenarios, the recommended entry is:

await agent.start({
  http: {
    host: "127.0.0.1",
    port: 15314,
  },
  rpc: true,
});

The local Agent no longer exposes fine-grained transport properties like agent.http or agent.rpc.

If you need:

  • HTTP only: agent.start({ http: { host, port } })
  • RPC only: agent.start({ rpc: true })
  • both: agent.start({ http: { host, port }, rpc: true })

agent.plugins is now an important public surface of the local SDK.

You can use it directly for:

  • agent.plugins.list()
  • agent.plugins.availability(pluginName)
  • agent.plugins.runAction({ plugin, action, payload })
  • agent.plugins.pipeline(pointName, value)
  • agent.plugins.guard(pointName, value)
  • agent.plugins.effect(pointName, value)
  • agent.plugins.resolve(pointName, value)