Skip to content

AI agents

An agent is an AI teammate that plays one of the workspace's roles. It wakes when a task lands on the steps it names, uses only the tools its access allows, and runs on the workspace's own model key. Sources: services/agents/crew.jac (agents) and services/agents/keys.jac (keys).

What runs today

Any agent can be saved, drawn on its canvas and switched on, but only a review agent (it holds read_pr and comment_on_pr) runs: when a task lands on one of its steps (in one of its projects) with a linked pull request, a run is queued as for a responsibility, and the runner reviews the pull request with the workspace's key. Its runs are recorded under code_review and show on the AI page. An agent's canvas is its design: the runner follows the agent's setup, not the drawn graph.

Bring your own key

Agent runs never use Flowline's OPENAI_API_KEY. The runner opens the workspace's key, passes it with the call to the review service, and the service holds it for that call only. A key is sealed with FLOWLINE_SECRETS_KEY before it is stored, is never reported (only its last four characters are), and never appears on a run. Tokens used count against the workspace's daily token budget.

Every refusal is {"ok": false, "error": <code>, "message": <text>}.

Agents

ListAgents

POST/walker/ListAgentsBearer JWTreports list[AgentView]services/agents/crew.jac:120

Every agent of the workspace, oldest first.

Body field: none.

Reports one list of AgentView, oldest first. A workspace with no agents reads empty. Never cached.

SaveAgent

POST/walker/SaveAgentBearer JWTreports dict[str, any]services/agents/crew.jac:138

Create or update an agent. An empty agent_id creates one. Setup only: whether it is on is SetAgentEnabled's, and the canvas is SaveAgentCanvas's.

Body field Type Default
agent_id str ""
name str ""
role_id str ""
projects list[str] []
steps list[str] []
event str ""
tools list[str] []
access dict[str, bool] {}
mode str "suggest"
duties list[str] []
prompt str ""
rules str ""
model str ""

An empty agent_id creates an agent (up to 30 per workspace), otherwise it updates the addressed one. It saves the setup only: whether the agent is on is SetAgentEnabled, and its canvas is SaveAgentCanvas. projects empty means every project; steps and projects keep each id that names one of this workspace's own, once. A save switches the agent off if its model has no key.

Reports {"ok": true, "agent":AgentView}. Refuses bad_name, bad_role (not one of this workspace's roles), bad_event, bad_mode, too_long, bad_tool, no_access (a tool needs suggest or write access the agent lacks), bad_model, too_many, or not_found for an unknown or foreign agent.

Send the whole setup

A save writes every field it is sent, like UpdateTask, so omitting tools or steps clears them.

SetAgentEnabled

POST/walker/SetAgentEnabledBearer JWTreports dict[str, any]services/agents/crew.jac:232

Switch an agent on or off. On needs a model whose provider has a key.

Body field Type Default
agent_id str ""
enabled bool False

Turning an agent on needs a model whose provider has a key.

Reports {"ok": true, "agent":AgentView}. Refuses no_model or not_found.

SaveAgentCanvas

POST/walker/SaveAgentCanvasBearer JWTreports dict[str, any]services/agents/crew.jac:317

Save the flow drawn for an agent. The canvas is its design; the runner follows the agent's setup, not this graph, so nothing here widens access.

Body field Type Default
agent_id str ""
canvas dict[str, any] {}

Saves the flow drawn for the agent: nodes (trigger, prompt, tool, condition, approval) and the connections between them. The server rebuilds the canvas from what it understands: unknown node types, tools and keys are dropped, positions are clamped, and a connection to a node that is gone is dropped. It never widens what the agent may do.

Reports {"ok": true, "agent":AgentView}. Refuses not_found.

DeleteAgent

POST/walker/DeleteAgentBearer JWTreports dict[str, any]services/agents/crew.jac:341

Delete an agent. Its past runs stay, as history.

Body field Type Default
agent_id str ""

Past runs stay, as history.

Reports {"ok": true, "deleted": <id>}. Refuses not_found.

Models and keys

ListAiKeys

POST/walker/ListAiKeysBearer JWTreports AiKeysservices/agents/keys.jac:248

The workspace's model accounts, models and token budget. Never a key.

Body field: none.

Reports one AiKeys: each provider's status, the models its connected providers offer, the default model, the daily token budget and the tokens used today. secrets_ready is false when the server has no FLOWLINE_SECRETS_KEY, so no key can be saved. Never a key.

SaveProviderKey

POST/walker/SaveProviderKeyBearer JWTreports dict[str, any]services/agents/keys.jac:257

Save or replace a provider's key. A custom provider also names its OpenAI-compatible address and model. The key is sealed before it is stored.

Body field Type Default
provider str ""
api_key str ""
base_url str ""
custom_model str ""

Saves or replaces a provider's key. The custom provider also names an OpenAI-compatible address and a model; the address must be public https (no credentials in it, no loopback, private or link-local host), because the web app calls it.

Reports {"ok": true}. Refuses unknown_provider, no_secrets, bad_key, bad_base, bad_model.

RemoveProviderKey

POST/walker/RemoveProviderKeyBearer JWTreports dict[str, any]services/agents/keys.jac:318

Forget a provider's key. Agents on that provider are switched off, and a default model on it is cleared.

Body field Type Default
provider str ""

Forgets the key. Agents on that provider are switched off and a default model on it is cleared.

Reports {"ok": true}.

TestProvider

POST/walker/TestProviderBearer JWTreports dict[str, any]services/agents/keys.jac:349

Ask the provider for its model list with the saved key. Reports only whether it answered, never the key or the provider's own error text.

Body field Type Default
provider str ""

Asks the provider for its model list with the saved key. It reports only whether the provider answered, never the key or the provider's own error text.

Reports {"ok": true}. Refuses no_key, unreadable, bad_base, refused, unexpected, unreachable.

SaveAiLimits

POST/walker/SaveAiLimitsBearer JWTreports dict[str, any]services/agents/keys.jac:405

The default model for new agents and the daily token budget.

Body field Type Default
default_model str ""
daily_tokens int 500000

The default model for new agents (empty for none, or a model a connected provider offers) and the daily token budget, between 1,000 and 50,000,000.

Reports {"ok": true}. Refuses bad_budget or bad_model.