Agent Class
The core public API of the local Agent SDK
Agent Class
Agent is the reusable execution subject of the local SDK. It owns a stable ID, visible name, capability description, instruction, model, custom Tools, and its Session collection. It owns neither Plugins nor a permanent Workspace.
Public API
new Agent(options)agent.idagent.nameagent.descriptionagent.sessions.create({ workspace })agent.set_instruction(input)agent.get_instructions()agent.get_logger()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.name: optional user-visible name; defaults toid.description: optional concise capability profile used for display and semantic Group dispatch.tools: custom Tools available to Sessions created by this Agent.instruction: static Agent-level base instruction.model: defaultModelClient; a local Session may override it.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.
One Agent may create Sessions in multiple Workspaces. The Workspace is supplied to each Session and
does not become an Agent-owned public object. City provides Plugins, and every City Plugin is
automatically available to every City Agent. Callers create an explicit execution view with
city.plugins.scope({ agent_id: agent.id, workspace_id: workspace.id }). agent.dispose() releases Sessions and the current City binding. Network
transports remain owned by the host.