@usenaive-sdk/runtime is for code running inside a hosted agent. The agent boots with
its credentials injected as environment variables (never baked into the image, never on the
agent’s filesystem); this package reads them and hands back one root, self.
install
agent.ts
One root, six namespaces
Plus the identity it booted with:
self.id, self.company, self.tenant.
self.brain takes no scope identifier, and that is the enforced rule. The run’s view is
the run’s view, resolved from the credential the container injected — which is why “write
into someone else’s scope” is unwritable rather than merely refused.A company, a partition and a lane remain unnameable from anywhere on self: no
mounted route accepts a partition or a lane at all. A knowledge base is nameable, and
always was — the agent’s own governed toolset declares knowledge_base_id on
brain.recall, think, graph, timeline, query and documents, and ships
brain.list. self.brains gives that existing reach a typed accessor; it grants nothing
new.Reads may name another brain; writes may not
self.brains exposes exactly self.brain’s three reads — recall, think and the
graph/timeline pair — and no write. That line is not arbitrary: the agent’s shipped toolset
forwards knowledge_base_id on every read and on no write, so a remember on a ref
would hand the in-agent SDK reach the tool surface withholds. Writes stay on self.brain,
which writes where the credential says.
An agent cannot read its own brain connection from here, deliberately.
self.id comes
from NAIVE_AGENT_PROFILE_ID and a connection is keyed on agents.id — a connected()
here would query with an id from a different table and answer “not connected” for an agent
that is. And the connection does not move self.brain anyway: it is a default honoured by
the CLI’s --agent and by POST /v1/runs’s brain_knowledge_base_id.The brain is shared; self.memory is not the brain
self.brain is the company brain — the same trunk every agent on the company reads.
self.memory is the agent-level context that actually exists on this platform.
Workspace
WorkspaceError with code: "workspace_path_escape" — including via .. and symlink-shaped
inputs — so an escape is a typed error you can catch, not a silent read of the host
filesystem.
Teammates
delegate() is governed by the tasks primitive, because no teams.delegate action id
exists in the governance catalog. If a tenant’s Account Kit disables tasks, delegation is
denied.Testing without a runtime
The same handle shape is constructible in a plain test process — no environment, no credential, no network:transport and a toolset and assert the requests; production hands in nothing and
reads the injected environment. One shape, two carriers.
The environment it reads
A hosted agent is handedNAIVE_API_KEY, NAIVE_BASE_URL (the container’s governance proxy),
NAIVE_COMPANY_ID and NAIVE_ACTIVE_USER_ID. self resolves from those.
BYO runtime
Running the agent in your own harness (LangGraph, your own loop, anything else)? Don’t use this package — use@usenaive-sdk/server and pull op.tools() there instead.
Governance is identical either way; it is enforced server-side, not by which client you hold.
See also: Teams & the durable runtime for the same runtime seen from outside.