API Reference

Agent Class

The core public API of the local Agent SDK

Agent Class

Agent is the reusable subject of the local SDK. It owns identity, instruction, model, custom Tools, Plugin instances, and its Session collection. It does not own a permanent Workspace.

Public API

  • new Agent(options)
  • agent.sessions.create({ workspace })
  • agent.set_instruction(input)
  • agent.get_instructions()
  • agent.get_logger()
  • agent.plugins
  • agent.dispose()

Sessions are created by the Agent and select the Workspace explicitly:

const session = await agent.sessions.create({ workspace });

Constructor options

  • id: stable Agent identity and private data partition key.
  • tools: custom Tools shared by every AgentWorkspace.
  • instruction: static Agent-level base instruction.
  • model: default AgentModel; a local Session may override it.
  • plugins: Plugin objects registered once on the Agent.
  • session_class: optional custom local Session class.

There is no workspace constructor option. The host creates Workspace independently and selects it when creating a Session.

AgentWorkspace

AgentWorkspace is an internal runtime scope used by City and transport. It is not part of the public Agent API.

One Agent may create Sessions in multiple Workspaces. agent.dispose() leaves every active runtime scope, closes its Shell and storage resources, and then unregisters Agent-level Plugins. Network transports created by @downcity/agent remain owned by the host.