Overview

The Agents API is the central surface for creating, configuring, running, and managing agents on the Allternit platform. Agents are persistent, user-owned entities that combine a brain (provider + model), a system prompt, a tool policy, a harness configuration, and a set of enabled surfaces. Once created, an agent can be run on demand, instantiated from a template, published to the marketplace, or wired as a subagent under an orchestrator. All agent routes are mounted under /api and require a valid bearer token via the platform auth middleware.

Base URL

Authentication

All requests must include a valid bearer token in the Authorization header. See Authentication for details.

Agent object

Agent creation checklist

Every creation flow enforces the same validation rules:
  • name must be at least 3 characters.
  • description must be at least 10 characters.
  • type is required.
  • model and provider are required.
  • harness_config.mode must be one of byok, cloud, local, or subprocess.
  • enabled_modes must contain at least one surface.
  • trust_tier is required.

Endpoints

List agents

Returns all agents owned by the authenticated user, newest first.

Query parameters

Example request

Example response

Create an agent

Creates a new agent. The request body is validated against the agent creation checklist.

Request body

Example request

Example response

Get an agent

Returns the full agent record.

Example request

Example response

Update an agent

Partial update using COALESCE semantics: omitted fields keep their current values. The same harness-mode and enabled-modes validations apply.

Example request

Example response

Delete an agent

Deletes the agent and its database row. Best-effort cleanup of related runtime state may happen asynchronously.

Example response

Subagents

Subagents are agents whose mode is subagent and whose parent_agent_id points to an orchestrator or the primary Companion. They are created through the same checklist as any other agent.

List subagents

Returns a compact view of all subagents under the parent agent.

Example response

Create a subagent

Creates a subagent under the parent. The route forces parent_agent_id to :id and mode to subagent. The parent must exist and belong to the caller.

Example request

Example response

Companion agent

Ensure Companion

Idempotently ensures the user has a primary “Allternit Companion” agent. If one already exists, the existing agent is returned; otherwise a new orchestrator is created using a runnable local brain fallback.

Example response (created)

Example response (existing)

Templates

Templates are persisted agent patterns (orchestrator + subagents) stored in the agent_templates table.

List templates

Returns all agent templates, built-ins first.

Example response

Instantiate a template

Creates a live orchestrator and its subagents from a template. The brain can be overridden; otherwise the user’s default model is used, falling back to a local Ollama brain.

Request body

Example request

Example response

Running agents

Run an agent

Sends input through the Gizzi runtime using the agent’s configured brain and system prompt. The call records a run, persists the outcome, and emits CommRails ledger events.

Request body

Example request

Example response (success)

Example response (brain error)

List agent runs

Returns up to 50 run records for the agent, newest first.

Example response

Stream agent events

Server-sent events (SSE) stream of CommRails ledger events scoped to the agent. Replays up to 50 recent matching events on connect, then polls for new events every 2 seconds.

Example curl

Example event

Agent identity

Get agent identity

Returns whether the agent has a bound identity key and the key itself.

Example response

Set agent identity

Binds a caller-supplied public key to the agent. The platform never generates or returns private keys.

Request body

Example request

Example response

Agent metrics

List metrics

Returns event-style metric samples for the caller’s agents. Defaults to the last 7 days.

Query parameters

Example response

Test suites

List test suites

Returns test suites for the caller, optionally filtered by agent.

Example response

Create a test suite

Request body

Example request

Example response

Run an agent test

Runs a single real round-trip against the agent’s brain using the last user message in messages, or a default connectivity probe.

Request body

Example request

Example response

Agent marketplace

The marketplace lets users publish snapshots of their agents, browse published listings, install copies, and rate them.

List listings

Query parameters

Example response

Publish an agent

Publishes a snapshot of one of the caller’s own agents. Only the agent’s owner can publish it.

Request body

Example response

Get a listing

Returns the listing plus up to 20 recent ratings.

Example response

Unpublish a listing

Only the publisher can unpublish.

Example response

Install a listing

Clones the listing’s snapshot into a brand-new agent owned by the caller. The creation checklist is re-run; the new agent is standalone (mode: primary, no parent).

Example response

Rate a listing

Request body

Example request

Example response

Agents v1 remote compatibility surface

The /api/agents/v1/* surface mirrors the shape of widely-used remote agent APIs so existing client code can point at Allternit with minimal changes.

Status

Example response

List models

Returns the caller’s agents as model objects.

Example response

Get a model

Example response

Same shape as an item from list models.

List tools

Returns the tools available to the agent profile, including deferred MCP tools and built-in platform tools.

Example response

Search tools

Request body

Example response

Same shape as list tools.

Activate tools

Activates one or more tools for a session, persisting the selection in the session metadata.

Request body

Example request

Example response

Get a response

Retrieves a completed assistant response by response_id, discovered from conversation message metadata.

Example response

Workspace initialization

Initialize agent workspace

Creates the agent’s workspace directory and writes a batch of documents into it. Paths must be relative. Parent directories are created as needed.

Request body

Example request

Example response

Error codes