Configurable Agents
An Agent is a saved, reusable execution configuration. It is edited in eight sections (General, Programs, Skills, MCP, Memory, Context, Always-on, Advanced); saves are atomic and revision-checked. New Agents keep memory off.
| Page | Covers |
|---|---|
| Editor and core fields | Prototype with illustrative data; it never changes live configuration |
| Capabilities | Programs, Skills and MCP policies |
| Programs selector | List, tree, inspector |
| Implementation plan | Stages, migration, scenario detail |
Objects
| Object | Identity and lifetime | Boundary |
|---|---|---|
| AgentConfig | Immutable value for one resolution; may be inline and unnamed | No implicit persistence, session or memory allocation |
| AgentSpec | Saved ID, display name, revision and AgentConfig fields | Metadata and configuration, not a running worker |
| Execution | Run or job ID and immutable effective configuration | One invocation; many may reference one Agent |
| Session / DAG | Conversation and execution history | History reuse is chosen apart from Agent selection |
| Memory space | Stable store reference with access policy | Optional; never inferred from a matching display name |
AgentSpec is the persisted envelope; AgentConfig is its typed projection, not a second registry. Role, persona, dedicated model, workspace, memory and schedule are all optional.
Current implementation
| Area | Today | Gap |
|---|---|---|
| Saved configuration | runtime/agent_registry/manager.py stores model, effort, instructions, Programs, skills, MCP, identity, session policy, description, revision, memory policy | Schema 2 migration; transactional multi-file lifecycle |
| Agents UI | agents-page.tsx: eight sections, one draft, catalog model picker, save-conflict comparison | Effective-value preview with provenance; embedded trial |
| Function execution | agent() and llm() take model, effort, tools and instructions directly | Saved-Agent or inline AgentConfig selection |
| Delegation | agent tool accepts agent_id, clean/inherit, background, to | One resolver for direct calls and durable dispatch |
| Management writes | Whole-config atomic conditional write against expected_revision or legacy updated_at, under the writer lock | Multi-file lifecycle as one transaction |
| Memory | self or legacy_global, applied to execution, background extraction, derived results and recovery, with policy-epoch revalidation | Catalog of arbitrary shared spaces |
| Workspace | workspace.py seeds instruction files | An Agent directory is not isolation |
Schema and defaults
| Field | Meaning | Default, validation |
|---|---|---|
schema_version, revision | Format; monotonic saved revision | New format 2; manager assigns revision |
name, description, identity | Display name, optional description, channel identity | Immutable ID for saved records only; only a name is required, and a model only if no default exists |
model, thinking_effort | Provider-qualified reference, supported level | Unset inherits; unsupported blocks execution |
system_prompt, instruction_files | Inline instructions; allowlisted workspace files (path, required default true) | Omission inherits; empty clears this layer only |
tools, skills, mcp | Independent capability policies | inherit, all, selected, none; selected empty means none |
memory | mode, read_spaces, write_space, required (default false) | New and anonymous configs off; existing Agents migrate to legacy behaviour |
context | history: inherit, clean, selected; node references | Legacy inline calls inherit; named or inline config switches default clean |
environment | cwd reference, sandbox profile reference | Inherited; missing explicit path fails before tools run |
limits | Resource-governance references and overrides | Unset inherits; child cap never exceeds parent |
| Session policy | Channel scope and reset, explicit timezone reference | Does not decide function history or memory access |
Not in the first implementation: arbitrary provider parameters, inheritance between named Agents, custom execution engines, arbitrary memory plugins. Inline configs use system defaults, not hidden fields from the caller's saved Agent.
Proposed wire shape
{
"schema_version": 2,
"id": "general",
"name": "General",
"revision": 1,
"model": {"provider": "provider-id", "id": "model-id"},
"system_prompt": "",
"tools": {"mode": "selected", "allowed": ["tool_a"], "disabled": []},
"skills": {"mode": "none"},
"mcp": {"mode": "none"},
"memory": {"mode": "off"},
"context": {"history": "clean"}
}
PATCH /api/agents/general
{
"expected_revision": 1,
"system_prompt": "Use concise answers.",
"memory": {"mode": "off"},
"reset_fields": ["model", "thinking_effort"]
}
- The flat AgentSpec envelope stays. POST takes a name plus optional executable fields; id, revision and timestamps are server-assigned unless a valid explicit legacy ID is given.
- AgentConfig has executable fields only. Export/import excludes server metadata and assigns a fresh identity. The package exports AgentConfig beside agent and llm; a provider-qualified model string normalizes to the provider/id object.
- Active read modes need at least one authorized read space;
read_writeneeds exactly one readable write target. Off leaves bindings inactive; the editor may keep them in its draft. - Unknown fields, invalid types and a field in both
reset_fieldsand the changes are rejected before writing. Readiness is returned apart from stored configuration.
One resolver
The base comes from exactly one source, in order: explicit agent_id, explicit config (mutually exclusive with it), ambient Agent, system default. Session overrides apply only while on the same Agent identity; a switch inherits no model, prompt, tools or memory bindings. Authorized invocation overrides replace fields next; authority constraints apply last and revocations are rechecked at every effectful boundary.
| Value | Meaning |
|---|---|
| Omitted / UNSET | Inherit; PATCH omission leaves storage unchanged |
| Empty string | Clear prompt or description; clearing model uses reset_fields |
| Empty selected list | Explicit empty scope, never all |
mode=none, memory.mode=off | Explicit disable, not inheritance |
reset_fields | Delete the local override and expose the base; JSON null is rejected |
| Lists, policy objects | Replace atomically; no implicit union |
| Scalar object fields | Patch named leaves; normalize to a complete policy before commit |
| Conflicting overrides | Reject fields given through both legacy keywords and overrides |
| Permission, quota | Intersect; deny wins; minimum finite cap; never last-write |
Dispatch acceptance pins the effective snapshot, Agent revision, policy version and catalog/preset versions (references and hashes, never credentials). Queued work, retries and resume keep it and recheck revocations; new independent turns resolve again.
Public calls
| Entry | Creates | History |
|---|---|---|
agent(), llm() | Execution node with the selected config; no saved Agent | Same DAG storage, separately filtered model view |
agent tool without to | Durable child task or branch | start_from=clean/inherit/exact-node |
agent tool with to | Next turn on the addressed branch | Target Agent unchanged; conflicting agent_id rejected |
| Chat, CLI, scheduler | Existing session and job types, same resolver | Scheduled jobs resolve Agent ID at each firing and set it on the task's branch; resume keeps its snapshot |
llm()has no Python, Program or MCP tool loop, even when the Agent allows them. Explicitweb_search=Truestays, under native-action checks; selecting an Agent never enables search.- A resolved view is bound through a context-local scope and reset in finally.
Runtime.modeland process-global Agent state are never mutated. - A named selection error is explicit, never a fallback to main.
- Switching the chat Agent starts a new context by default; keeping history is explicit and marks retained data as disclosed.
Proposed Python API (not available yet)
Extends agent() and llm() with agent_id, config, overrides and history selection; no parallel executor. Validation and return types stay.
from openprogram import Agent
# Explicit history sharing; records stay in the same execution DAG.
agent(prompt, agent_id="reviewer", history="selected", context_nodes=[node_id])
class ExampleAgent(Agent):
method_options = {
'extract': {'tool': True},
'classify': {'tool': True},
}
def extract(self, document):
return agent(document, agent_id="my-agent",
overrides={"memory": {"mode": "off"}},
response_format=Result)
def classify(self, document):
return llm(document,
config=AgentConfig(model="provider:model", memory={"mode": "off"}),
response_format=Label)
_example_agent = ExampleAgent()
extract = _example_agent.extract
classify = _example_agent.classify
Optional memory
| Mode | Recall | Memory tools | Background write |
|---|---|---|---|
off | None | None | No ingestion from these nodes |
read_only | Authorized read_spaces | Read and search | No ingestion from these nodes |
read_write | Authorized read_spaces | Plus one authorized write_space | Under writer policy and execution provenance |
inherit | Resolved to a concrete mode first | Never passed unresolved | Migration only |
- Spaces
selffor a saved Agent is its own namespace and invalid for anonymous configs. Implemented:self,legacy_global. Target: a selected project or shared space, which allows anonymous memory use.write_spacemust be readable. Enabling a new Agent's memory defaults toself, with no copy of the old global store.- Off does not
- Delete memory, disable session history or remove user-provided instruction files. Text already in messages cannot be unseen; start a clean context. Pending recalls are invalidated before entering a request. It is not a filesystem sandbox: if shell or file tools can read memory files, the UI shows that.
- Failure
- An optional backend failure shows degraded memory and continues;
required=truefails before model execution. A write failure keeps the task result and reports separately. - Not offered
write_only. A backend without enforceable namespaces cannot enable scoped memory; prompts never simulate isolation.
Write eligibility
| Case | Rule |
|---|---|
| Label | Every execution node carries a write-eligibility label, space reference and policy epoch. Session-end writers, compaction extraction, source export and scheduled reorganizers filter out off and read-only nodes |
| Disabling writes | Disabling writes blocks unsettled queued writes and prevents retroactive ingestion on re-enable. Committed memory stays |
| Derived outputs | Derived outputs and summaries carry the most restrictive eligibility of the context included. Splitting or switching Agents cannot relabel restricted data. Off propagates a no-write restriction but does not forbid an independently authorized read later |
| Background write | A background write validates the original grant and current space policy at commit; revocation wins over the pin. Never retry with a broader space. External backends that cannot cancel are documented |
| User inputs | User-authored instructions and uploads stay inputs, even with personal facts; text outside recorded provenance is not claimed classifiable |
Context, instructions and environment
| Source | Treatment |
|---|---|
| Runtime and owner policy | Enforced outside the model; no Agent prompt overrides it |
| User, project and scoped workspace instructions | Existing authority and scope rules; show provenance and conflicts |
Agent system_prompt, allowlisted files | Configurable; files are workspace path references, snapshot by content or hash in protected execution storage |
| Skills | Load on demand within the allowed set |
| Memory, tool and web results | Data with provenance, never promoted to instructions |
- Clean means no inherited conversation messages, not no system or project policy.
- Selected history is validated against the caller's visibility; DAG membership is not authorization. Execution history is kept by default; there is no incognito guarantee.
- Workspace and project cwd are separate. A cwd is not an access boundary. Incompatible host or sandbox requests fail visibly.
- Context length uses existing Context Engine limits; no second summarizer.
Capability scope and authority
Catalogs own definitions and credentials; Agent policies own references. Detail: Agent capability policies. Admission, usage, cancellation and quotas: resource governance.
- A session or invocation may replace a preference but never expand an enforced ceiling. A delegation restriction survives an
agent_idchange. Rejected overrides are explained. - Provider-native search and other native actions are capability-gated;
tools=[]alone is not a network restriction. - Accounts resolve through credential services; no raw keys in AgentSpec, snapshots, exports or examples. Anthropic connections use the official API and legitimately obtained API keys with API account billing.
- Python already authorized by the host is not sandboxed by an allowlist; tools and nested agentic calls are checked at their public boundaries.
Multi-agent composition
Branches, Jobs, messages and attach references: collaboration contract, architecture. A config reused in parallel creates distinct runs, not new saved Agents.
| Operation | Contract |
|---|---|
| Independent invocation | No automatic previous-task history; one Agent ID may serve many sessions |
| Delegation | Explicit goal, input and filtered context; parent cancellation and budget stay in task control |
| Continue a task | Address an existing run or branch; target Agent stays |
| Shared memory | Explicit bindings; concurrent writes use backend version checks and idempotent execution IDs |
| Shared files, browser | Ownership and serialization for conflicting mutations; Agent names do not isolate |
| Automatic choice | Deferred to P6; ranks existing eligible configs, never creates Agents or widens scope |
One successful run never persists config changes, skills or preferences; durable updates use explicit write mechanisms. Role orchestration, automatic topology and marketplace publishing are out of scope.
Management API
| Operation | Contract |
|---|---|
GET /api/agents[/{id}] | Summary and detail DTOs with schema_version and revision; no memory contents or secrets |
POST /api/agents | Name-only creation; safe explicit defaults; optional idempotency key; no provider call |
PATCH /api/agents/{id} | expected_revision; top-level changes plus reset_fields; validate the whole candidate, compare and write once under a cross-process lock |
POST /api/agents/resolve | Proposed read-only preview for saved or draft config; no session, memory search or credentials |
POST /api/agents/{id}/duplicate | Configuration only; new ID and revision; self maps to a new empty namespace; shared bindings shown |
POST /api/agents/{id}/default | One authoritative pointer, updated atomically; profile.default is derived |
DELETE /api/agents/{id} | 409 for default or active references; show affected resources before confirmation; recoverable intent before destructive cleanup |
| Status | When |
|---|---|
| 428 | Neither precondition (updated_at is kept for display and the temporary adapter) |
| 409 | Stale revision |
| 400 | Invalid schema |
| 403 | Forbidden scope |
| 404 | Unknown ID |
An unavailable reference saves as a draft with warnings; starting is blocked if it is required, as a typed preflight error. Unknown schemas fail closed without rewriting.
Atomic persistence
One canonical agent.json, atomic replacement. A small recovery journal covers create, default and delete across the index and resources; several os.replace calls are not a transaction. Startup reconciles unfinished intents before serving writes. Deleting an Agent never deletes shared memory, global credentials or external workspaces. Session and DAG references are enumerated through their store.
Lifecycle and failure
| Event | Behaviour |
|---|---|
| Anonymous config | No sidebar entry, workspace or memory folder. Saved creation initializes config only; instruction files on explicit request or legacy bootstrap |
| Duplicate | No sessions, learned memory, schedules or credentials. Shared references stay visible. Copying instruction contents is separate from copying references |
| Export, import | Portable configuration and optional selected instruction text; no memory, history, machine paths, credentials or automatic schedules. Import validates, resolves references, previews permissions, starts nothing |
| Delete | Enumerate owned versus referenced resources. Private memory is retained or explicitly deleted; shared memory never. Tombstoned IDs accept no runs; unfinished cleanup is visible and retryable |
| Failure | Failed preflight: no provider request or side effect. Failed save: draft kept. Provider failure: bounded retries, no silent model or policy change. Cancel: scoped state restored, never success |
| Policy edit | Affects new executions; deny or revocation applies at the next access boundary; disabling memory writes invalidates unsettled writes. The UI shows the difference |
Built-in Agents
Ordinary saved Agents: the Assistant with Decision, Lightweight helper and Coordinator, plus the job Agents (see Always-on Agents). No template catalog: the Agents list is it, and New Agent starts blank.
| Installation | Behaviour |
|---|---|
| At startup | Once a default exists, the server installs built-ins this instance has never installed, through the manager under its lock |
| Recorded | Their ids, in the registry index |
| Kept | IDs, edits and the default |
| Reading | Creates nothing |
| Deleting | Does not trigger recreation |
| Agent | Behaviour |
|---|---|
| All three specialists | Fixed parameters of the Agent class via AgentSpec and Agent.from_spec; no role prompts. Tasks and instructions come from the call site and Context; an empty saved prompt does not erase ambient instructions. Models stay editable; local installation assigns configured models. Roles guarantee neither cost nor quality. |
| Decision | Agent.choose picks one supplied option in a single tool-free llm request with the choice resolver: no advice, no re-pick; returns the option ID and rejects invalid answers. Keeps Context and DAG scope. Tools disabled. |
| Lightweight helper | Tools disabled |
| Coordinator | Inspects evidence and delegates authorized tasks |
Page layout
| Area | Layout |
|---|---|
| Page | Saved-Agent list and full-width editor. Secondary navigation uses the shared ManagePage split layout and sidebar width token |
| Header | Header: name, ID, conversation actions. Eight tabs stay horizontal at every width and scroll when needed |
| General | General has name, purpose, the switch that offers the Agent to other agents, avatar, model and reasoning. Manual instructions stay in Advanced, with the channel identity and where the Agent works when another agent starts it (agent collaboration). No inner navigation column, duplicate introduction or settings summary |
| Type | Inputs normal weight, labels medium; application font, neutral surfaces, control dimensions, blue selection |
| Panels | Panels fill the editor inside standard padding, no fixed maximum width. The editor scrolls independently; the save footer stays visible and reports draft state |
| Narrow screens | Narrow screens replace the list with a select and stack identity fields. Saved invalid reasoning choices stay visible; inherited incompatible settings raise no pre-edit error |
Acceptance: built-ins visible and editable; New Agent starts blank; repeat installation keeps edits; Agent.from_spec runs a saved record; draft, conflict, duplication and conversation flows work; desktop and narrow layouts checked on the real page and the App.
Acceptance contract
| ID | Entry | Expected |
|---|---|---|
| A01 | Agent API, UI | A name-only Agent runs a general task |
| A02 | PATCH from two clients | One same-revision update wins; no mixed config or partial save |
| A03 | agent(), llm(), chat, dispatch | Same base and overrides give equivalent config; llm has no tool loop; native search explicit and authorized |
| A04 | Parallel nested functions | Models and memory policies do not leak; scope resets after failure or cancel |
| A05 | All memory ingress and egress | Off and read-only runs never become learned memory |
| A06 | Switch Agent, selected history | No implicit history; inaccessible nodes rejected |
| A07 | Discovery and invoke | Empty stays empty; missing visible; denied never executes |
| A08 | Queue, retry, resume | Pinned revision; revoked capability cannot execute |
| A09 | Duplicate, export, delete | No accidental copy or deletion of memory, credentials, schedules or shared resources |
| A10 | Agents page, narrow, keyboard | All sections reachable; no overflow; dirty, error, conflict and degraded states visible |
| A11 | Legacy migration | Effective model, scope, memory and history kept |
| A12 | App, CLI, scheduler | Shared resolver evidence |
Scenario inputs and stage gates are in the implementation plan. A static documentation check satisfies none of these.
References
| Reference | Adopted | Boundary |
|---|---|---|
| Meta Muse | Persistent work; policy enforced outside the acting model | No claim of Muse VM isolation; memory and persona stay optional |
| Grok Bot: bots, overview | Saved configurations, separate conversations, explicit shared resources | No specialized job required; schedules and learned memory not duplicated |
| OpenClaw: configuration, CLI, workspace, runtime | Per-Agent workspace and policy references | Workspace is no sandbox; no profile inheritance graph |
| Claude Code | Separate model, instruction, tool and session choices | Anthropic integration stays official API-key based |
| Codex | Separate config, provider and MCP responsibilities | No claim of identical profile or approval semantics |
Product and configuration concepts, not proof of internals. No claim of research novelty, benchmark wins or autonomous routing.
Implementation status
- Implemented
- Eight-section page with shared draft, catalog model selection, save-conflict comparison, animated icons; built-in saved Agents and
Agent.from_spec; description, revision, atomic conditional saves; memory policy with spacesselfandlegacy_global, defaulting new configurations to off and keeping legacy shared read/write. Web conversations use saved Agents; independent trials persist a read-only-or-off session snapshot. Missing required MCP servers fail before a model request. - Target
- Schema 2 migration, transactional multi-file lifecycle, Python
AgentConfig, resolver parity across entries, shared-space catalogs, effective preview, embedded trial, portable import/export, automatic Agent/model selection.
Configuration belongs to a conversation branch
A conversation shares its project and working directories. Each branch stores its own Agent, model and provider, effort, tool intent, search toggle, permission mode and rules, Plan, sandbox override and service tier.
A new branch copies its source's settings once, then changes alone. Switching restores the destination's settings, empty overrides included; Rewind, Undo and Redo keep them. A scheduled task's branch copies the selected branch with the task's Agent at its first run; later runs keep that record and take the task's Agent again.
Branch references own the settings; the session's top-level fields mirror the selected branch. A switch saves the source and restores the destination with the head in one commit. Old sessions seed a branch from their settings once; missing history is not reconstructed.
Admission freezes the turn's Agent, model, effort, Fast, tool intent, Sandbox, and permission mode and rules from its branch, the first of:
- the branch the request names;
- the record reserved for the run's message (a scheduled run's);
- the live same-session parent's branch;
- the record at the turn's starting message;
- the selected branch.
A chat, scheduled, background or headless turn on an unselected branch runs that branch's Agent and permission. A Job keeps what it was given, same-session children inherit their parent, and Trial Agents keep their snapshot.
| Change | Stored on |
|---|---|
| Composer control, model pick, Agent switch, permission, Sandbox | The branch the request names, the one the pane shows, whatever is selected elsewhere. Without a branch: the selected one, guarded by an older client's expected_branch_id. |
| Message send | The message's branch: effort, web search, Fast, Sandbox, and the composer's mode while the branch has no versioned permission. Never the Agent. |
/skill message | Nothing. Its allowed-tools list narrows that turn only. |
| "Allow for this conversation" during a turn | The turn's branch. |
null, or the effort menu's default | Inherit: the project, Agent or global value decides. |
| Read or write of a branch with no record | Answered as branch_gone, with the selected branch. The composer reads the branch the conversation shows and applies the change there. |
An unfocused pane rereads its model settings when its branch or that branch's Agent changes. A model pick or Agent switch on a branch that is not selected leaves the live runtime alone and is not broadcast, so other panes and the sidebar keep the selected branch's model; the pane takes the model and its controls from the reply.
Every model settings read names the pane's branch, so after any broadcast a pane on a branch that is not selected reads back that branch's model, not the selected one's. A broadcast names no conversation, so no chip takes its model: each keeps what it shows until its own read lands.
The read also carries the branch's stored effort and web search toggle. A pane takes them unless one of its own writes is still on the way, so a setting changed from another window or the API reaches an open pane without a reload.
Implementation status
| Not yet implemented | Today |
|---|---|
| Two branches of one conversation side by side | A pane shows the selected branch. The server already runs a turn on each branch at once, each with its branch's settings (Two branches running at once). |
| ACP turns on the branch's Agent | The ACP server sends its own Agent, so a branch switched in the app runs the server's Agent from ACP. |
| Scheduler Sandbox policy per branch | The run's request carries its branch's Sandbox; the scheduler process installs the selected branch's policy. |