A local-first multi-agent app development platform, built on PenguinHarness
External programs can talk to an Agent: the Agent API, the AMSP stream and the amsp client
- Date: 2026-10-16
- Type: feature
- Scope:
server,web,cli,amsp,docs
Ported from upstream PenguinHarness (#1000, commit 473c9470).
A Project owner could open one agent to programs outside Adelie. A program sent its input to POST /api/amsp/v1/agents/:projectId/:agentId/runs, read the run as it happened as an AMSP event stream, and continued the conversation by its Session id. The runs used the Project's models and credentials, were recorded like any conversation, and appeared in the sidebar's Background folder. A new package, @adelie/amsp, carried the protocol's types and a TypeScript client for Node and browsers.
The Agent API
- Each agent got its own switch, off by default, an optional keyless access switch, also off by default, and an API approval mode,
allow-allby default. They were stored in the server's database, in the newagent_apiandagent_api_keystables, outside the agent's state and outside the Project file, so an agent could neither expose itself nor loosen its own approvals. - Keys were minted per agent, named, and shown once:
penguin_followed by 43 base64url characters, stored as SHA-256 and listed by their first 16 characters. A key ran its own agent and read, aborted and answered the approvals of that agent's API conversations, and opened nothing else. Each run that presented a key stamped its last use. - The public routes were mounted under
/api/amsp/v1, outside the sign-in cookie:GET /agents/:projectId/:agentId,POST /agents/:projectId/:agentId/runs,GET /sessions/:sessionId,POST /sessions/:sessionId/abortandPOST /sessions/:sessionId/approvals/:toolCallId. Any other path under the prefix answered a JSON404not_found. The key and the switches were checked before the body was read. - A run without
session_idcreated a conversation withsession_meta.sourceapiand the index row'sclientapi, using the Project's default model, the server's new-chat sandbox and the agent's API approval mode, copied onto the conversation when it was created.session_idcontinued an API conversation of the same agent; any other id was404session_not_found. A conversation whose first run had not written its Trace read asapifrom its row, in the list and when it was rebuilt after a restart. - When the approval mode asked, the request streamed to the caller as
approval.requested, and the conversation in the Web App could answer it too; the first answer counted. A caller that disconnected aborted its run, and its pending approvals were denied.POST …/abortaborted while keeping the stream open for the finalrun.done. - A busy conversation answered
409; a fifth concurrent run of one agent answered429too_many_runswithRetry-After: 2. - The CORS preflight was answered for any origin.
Access-Control-Allow-Origin: *went only on a request carryingAuthorization, the server-wide413and415refusals included, so a page on another origin could not drive an agent through keyless access. - The administrator's
agentApiEnabledsetting in/api/admin/settings, on by default, refused every Agent API request with403agent_api_disabledwhen off, keeping the agents' settings and keys. - The routes under
/api/projects/:projectId/agents/:agentId/apilet any member read an agent's settings, the administrator's switch included asserverEnabled, and let the owner change them and create and delete keys;POST …/api/tryran the agent for the owner's sign-in and streamed the same AMSP response. The agents list carriedapiEnabled. - Changing an agent's exposure took a person's sign-in. The local API token, which every tool subprocess of a server-driven Session holds, could read an agent's settings and keys, but
PUT …/api,POST …/api/keys,DELETE …/api/keys/:keyId,POST …/api/tryand aPUT /api/admin/settingscarryingagentApiEnabledrefused it with403human_required, the code the agent browser already gave the token, and wrote nothing, so an agent could not switch on its own exposure from its shell. This narrowed the credential the harness handed an agent; the sandbox remained the boundary.
The AMSP stream
- AMSP (Agent Message Stream Protocol) streamed one run of an agent, one Task, the way MMSP streams one model call: SSE
data:lines,data: [DONE]at the end,: keep-aliveafter 15 seconds of silence, bytes as base64. Events were flat objects named<subject>.<phase>:run.*,context.opened,mcp_connect.*,tools.ready,request.*,K.delta/K.doneitems,approval.*,compaction.*andhook.fired. - The server translated the Session's live stream into it: OmniMessage records and server events. Fragments and complete items were forwarded as the engine produced them,
partial_*stopwas not sent, and OmniMessage gained no field. run.donewas the single terminal event and always arrived, errors included, with the run's status, error, Request count, token usage and the Session's running total. Errors before the stream used the server's error envelope with fixed status codes.- New event types and optional fields were to be added within
/v1, and a change to a field's meaning would be/v2; clients were required to ignore event types they did not know.
The amsp client
@adelie/amspwas a new public package with no runtime dependencies, for Node 24 and browsers. It exported the AMSP wire types, which the server imported, andAgentClient.client.run()returned a run to iterate for its events, withsession,result()andabort();client.ask()returned the result alone.onApprovalanswered approval requests, and without it they were denied. The client also offeredagent(),session(),abort()andapprove(), theAmspHttpErrorandAmspStreamErrorerrors,parseArgumentsfor a tool call's JSON arguments,readSse, the SSE reader, andRunCollector, which folded the events a program read itself into the same result.
The Web App
- The agent settings page gained an API tab: Enable API access, the approval mode for API conversations, the Base URL and Agent ID to copy, keys created with a one-time display and deleted from a list, Allow keyless access, which asked for confirmation with a warning before it went on, and curl and TypeScript examples. While the administrator had the Agent API off, the tab disabled its switch and said why, to every member.
- The API tab ended with Try it, for the owner: an input prefilled with "What time is it now?" and a Run button that sent one real API run through
POST /api/projects/:projectId/agents/:agentId/api/try— the owner's sign-in standing in for a key, the same handler behind it — and showed the stream as a program would receive it in one output box: a header with thesession_idand a Rendered / Raw switch — numbered rows with each item's fragments merged into what they add up to (the answer is thetextrow), or the numbered rawdata:lines — over a strip with therun.donestatus, Request count, tokens (cache reads and writes when there were any) and elapsed time; running again continued that conversation, Stop aborted it through the Session's abort route, and an approval the mode asked for was answered inline. - The Agents page marked an agent whose API was on with an API icon. Settings › Server gained an Agent API page with the administrator's Allow the Agent API switch, which asked before turning off.
- Rows in the sidebar's Background folder (API, scheduled, subagent and CLI conversations) no longer showed the green unread dot after a run; only a person's own conversations did. They still showed the hourglass while running.
The CLI
penguin agent apishowed and changed an agent's API from a terminal:status,enable,disableandset(with--open/--no-openand--approve <mode>),keys ls,keys create(the key alone on stdout),keys rm, andserver on|offfor the administrator's switch.--agent-idwas required, with no default, andstatusshowed the administrator's switch to any member. Turning keyless access on with--openprinted a warning on stderr.- The CLI still authenticated with
PENGUIN_API_TOKEN, else theapi-tokenfile. When the server refused a request to that token with403human_required, the CLI sent the same request once more with the person's stored sign-in, the<root>/cli-session.jsonsession written bypenguin auth loginorpenguin auth token, as the session cookie. It did so only for a loopback server, only with a sign-in to a loopback server, and never from inside a Session. Thepenguin agent apiwrites therefore worked afterpenguin auth login; with no sign-in, or one the server no longer accepted, they printed the command to run and exited 1.
Docs
- Two new reference pages: Agent API, on turning an agent's API on, the approval mode, keys, keyless access, the routes, errors, curl, the client in Node and browsers, and the CLI; and AMSP, the protocol's transport, grammar, every event, examples, errors, the mapping from OmniMessage and the versioning rule.
- Server API gained the agent API settings routes,
agentApiEnabled,apiEnabled,clientapiand the CORS exception for/api/amsp/v1; CLI Reference gainedpenguin agent api; Agents gained the API tab; Settings gained the Agent API page; OmniMessage said that AMSP is a projection of it and changed nothing in it. - Agent API, Server API, CLI Reference and Security Model said that changing an agent's exposure took a person's sign-in and was refused to the local API token with
human_required, that this was not a boundary, and when the CLI sent a stored sign-in instead. - The
penguin-sdk,penguin-orchestrationandagent-initializationskills said that the server refused thepenguin agent apiwrites to an agent's token, told the agent never to sign in to get past that, and putpenguin auth loginfirst in the steps for the user. Theagent-tuningplugin moved to2026.10.09.2.
Compatibility
No compatibility code was added; these changes were accepted as they are:
- Two new tables,
agent_apiandagent_api_keys(migration 14). An earlier server never reads them and serves no/api/amsproute, so after a rollback callers get404until a build that knows the tables is back. Rolling the migration back deletes every agent's API settings and keys. - Conversations the API creates store
clientapiin the Session index, a column that takes new values without a migration.