Skip to main content

Layer 4 · agent

agent

blocks/4-agent/agent.yaml

layer 4agent
3entities
5commands
5events
3views
13refusals
5KPIs

The definition of an agent. An agent is a principal of kind Agent with a name. Its behaviour is fixed by an immutable revision: a role, instructions held as content, a model or route for each use, the tools it may call, the knowledge it is given and its budget limits. A change is a new revision, never an edit. A revision is published, may be retired, and a retired revision is refused wherever it would be used.

Depends on​

  • knowledge · layer 3 · 4 references
  • tool · layer 3 · 4 references
  • model · layer 2 · 5 references
  • principal · layer 1 · 8 references
  • shared · layer 0 · 9 references

Used by​

  • harness · layer 4 · 11 references
  • work · layer 5 · 7 references
  • trigger · layer 7 · 11 references

Entities​

Agent​

A named agent and the principal it answers as. Active until retired; retiring it retires every revision.

Identified by agent_id (AgentId).

fieldtypemeaning
principal_idPrincipalIdThe principal of kind Agent this definition stands for.
nameName
defined_attimestamp

Relations:

  • principal references Principal of principal (one, by principal_id)

Lifecycle of Agent

ActiveRetiredretireActiveRetiredretire
Ends in Retired.

AgentRevision​

One immutable definition of an agent. No command changes its fields after it is published; only its state moves, from Published to Retired.

Identified by agent_revision_id (AgentRevisionId).

fieldtypemeaning
agent_idAgentId
numberintegerThe revision's place in the agent's history, counted from 1.
roleNameWhat the agent is for, for example operator or reviewer.
instructionsContent
modelslist of ModelBinding
toolslist of ToolIdThe tools the agent may call; a tool not listed is not granted.
knowledgelist of KnowledgeId
budgetBudgetLimits
published_attimestamp

Relations:

  • agent references Agent (one, by agent_id)
  • tools references Tool of tool (many, by tools)
  • knowledge references KnowledgeItem of knowledge (many, by knowledge)

Lifecycle of AgentRevision

PublishedRetiredretirePublishedRetiredretire
Ends in Retired.

RevisionUsage​

One use of a revision, kept apart from the revision so that the revision stays as it was published. Each use records one; the newest of a revision is its last use.

Identified by usage_id (RevisionUsageId).

fieldtype
agent_revision_idAgentRevisionId
used_attimestamp

Relations:

  • revision references AgentRevision (one, by agent_revision_id)

Lifecycle: one state, Recorded; a recorded RevisionUsage does not change.

Commands​

DefineAgent​

Define an agent.

fieldtype
agent_idAgentId
principal_idPrincipalId
nameName
attimestamp
outcomewhenresult
no-such-principal refusedno Principal for principal_idUnknownPrincipal: No principal of this identity is registered.
principal-not-agent refusedthe Principal of principal_id has kind != AgentPrincipalNotAgent: The principal is not of kind Agent, so no agent can stand for it.
principal-retired refusedthe Principal of principal_id has state == RetiredPrincipalRetired: A retired principal takes no new agent.
definedotherwisecreates a Agent in Active; emits AgentDefined

PublishRevision​

Publish an agent revision. Fixes one definition of the agent. The revision is never edited afterwards; a change is another revision.

fieldtype
agent_revision_idAgentRevisionId
agent_idAgentId
numberinteger
roleName
instructionsContent
modelslist of ModelBinding
toolslist of ToolId
knowledgelist of KnowledgeId
budgetBudgetLimits
attimestamp
outcomewhenresult
invalid-number refusednumber < 1InvalidRevisionNumber: The revision number is not at least 1.
no-model refusedmodels.count == 0NoModel: A revision names at least one model or route; it names none.
no-such-agent refusedno Agent for agent_idUnknownAgent: No agent of this identity is defined.
agent-retired refusedthe Agent of agent_id has state == RetiredAgentStateConflict: The agent is not in a state this command acts from.
publishedotherwisecreates a AgentRevision in Published; emits AgentRevisionPublished

RetireAgent​

Retire an agent.

fieldtype
agent_idAgentId
attimestamp
outcomewhenresult
no-such-agent refusedno such AgentUnknownAgent: No agent of this identity is defined.
retiredotherwisemoves the Agent Active → Retired; moves each AgentRevision with agent_id == subject.agent_id to Retired; emits AgentRetired
wrong-state refusedthe Agent is in a state that does not allow itAgentStateConflict: The agent is not in a state this command acts from.

RetireRevision​

Retire an agent revision.

fieldtype
agent_revision_idAgentRevisionId
attimestamp
outcomewhenresult
no-such-revision refusedno such AgentRevisionUnknownRevision: No revision of this identity is published.
retiredotherwisemoves the AgentRevision Published → Retired; emits AgentRevisionRetired
wrong-state refusedthe AgentRevision is in a state that does not allow itRevisionStateConflict: The revision is not in a state this command acts from.

UseRevision​

Use an agent revision. Names a revision as the one a session or an assignment runs. Default deny: a retired revision is refused, and so is one that was never published.

fieldtype
agent_revision_idAgentRevisionId
attimestamp
outcomewhenresult
no-such-revision refusedno AgentRevision for agent_revision_idUnknownRevision: No revision of this identity is published.
retired refusedthe AgentRevision of agent_revision_id has state == RetiredRevisionRetired: The revision is retired and is not used.
usedotherwisecreates a RevisionUsage in Recorded; emits AgentRevisionUsed

Events​

eventfieldsemitted by
AgentDefinedagent_id AgentId, principal_id PrincipalId, name Name, at timestampDefineAgent
AgentRetiredagent_id AgentId, at timestampRetireAgent
AgentRevisionPublishedagent_revision_id AgentRevisionId, agent_id AgentId, number integer, role Name, at timestampPublishRevision
AgentRevisionRetiredagent_revision_id AgentRevisionId, at timestampRetireRevision
AgentRevisionUsedusage_id RevisionUsageId, agent_revision_id AgentRevisionId, at timestampUseRevision

Views​

viewrowsfields
AgentRevisions
Agent revisions
each AgentRevisionagent_revision_id AgentRevisionId, agent_id AgentId, number integer, role Name, instructions Content, models list of ModelBinding, tools list of ToolId, knowledge list of KnowledgeId, budget BudgetLimits, published_at timestamp, state State
Agents
Agents
each Agentagent_id AgentId, principal_id PrincipalId, name Name, defined_at timestamp, state State
RevisionUsages
Revision usages
each RevisionUsageusage_id RevisionUsageId, agent_revision_id AgentRevisionId, used_at timestamp, state State

Types​

typeisvalues or fields
BudgetLimits
Ceilings on one run of the agent. An absent limit is no limit, which a gate or an architecture may refuse.
a recordmax_turns optional integer, max_output_tokens optional integer, max_cost optional Money, max_subagent_depth optional integer
ModelBinding
The model an agent uses for one use.
a recorduse ModelUse, target ModelTarget
ModelTarget
What a model use points at: one model directly, or a route that resolves to a model at call time. Exactly one, by construction.
exactly one ofModel ModelId, Route RouteId
ModelUse
What a model is used for inside the agent: the main loop, cheap side calls such as titles and summaries, or a second opinion on the agent's own work.
one ofPrimary, Fast, Review
RevisionUsageId
The identity of one use of a revision.
an identifier or valueuuid

KPIs​

5 KPIs from the KPI catalogue. A gate must be zero for a variant of an architecture to count.

Correctness​

KPIunitbettergatestatus
unpinned_agent_runs
Runs that started without an immutable agent revision.
How: RunStarted events whose assignment has no AgentRevisionUsed of a published revision. Must be 0.
countlowergateplanned
source: design

Quality​

KPIunitbettergatestatus
sub_agents_started
Sub-agents started in a window.
How: AgentStarted events with a parent agent, per session. Concurrency helps only on the largest tasks, so compare per task size.
By work mode: autonomous: ignore, pairing: lower, review: lower
countlower–computed today
source: docs/kpis.md
agent_tree_depth
Deepest chain of parent and sub-agent in a session.
How: Longest path of parent_agent_id links over AgentStarted events of one session.
countlower–planned
source: design
subagent_cost_share
Share of the cost spent by sub-agents.
How: cost_usd of model turns with scope sub divided by cost_usd of all model turns. The report already splits models by scope main and sub.
sharelower–computed today
source: docs/kpis.md
agent_time_cost_usd
Cost of agent time at the hourly price of an agent, over the horizon.
How: Seconds each agent copy is alive over the horizon, in hours, times the agent hour price. The simulator adds it to the cost of model messages in cost_usd.
usdlower–simulated
source: design

Settings​

The settings a part of this block carries in an architecture document. agenticspec sim check refuses any other setting (setting_unknown) and a value outside its type (setting_invalid), and a part that lacks a setting marked required in the default column; the contract copies a setting into the ports it narrows. The last rows of each table are the settings every part takes. What no setting here types (a file, a path, an audience, the use of a model) goes into the part's notes, a map with free keys and values that the check takes as written and nothing reads.

A part agent:

settingtypeunitdefaultcontractwhat
harnessstringharness.session, harness.tool-callThe kind of harness the agent runs in, a row a field registers.
rolestringharness.sessionThe role of the behaviour profile the agent plays; without one, the profile's default role.
acts_forpartharness.sessionThe principal the agent acts for.
coordinationenum Coordination: orchestrator, board, mesh, nonenoneHow the copies of the agent coordinate.
start_staggerduration of at least 0s0sThe time between the starts of two copies.
partitionenum: scopescope: each copy works on its own part of the scope, so copies do not collide.
strictnessstringbalancedThe entry of the profile's review strictness a reviewer agent judges with.
false_acceptnumber from 0 to 1shareThe share of wrong results a reviewer agent accepts; with false_reject, replaces the strictness entry.
false_rejectnumber from 0 to 1shareThe share of right results a reviewer agent sends back.
methodstringThe label of the method the agent follows, when an experiment compares methods.
model_sharesharesThe share of the agent's model calls each model part it reaches gets; without it, equal shares.
max_costnumber of at least 0USDharness.sessionThe spend cap of one run of the agent on a task, the max_cost of its revision's budget limits: a run that has spent it makes no further model call and ends; without it, no cap.
countinteger of at least 11How many copies of the part run.
perpartOne copy of the part for each copy of the named part.
notesnotesFree notes on the part, a map with keys and values of any kind: what no setting of its block types. The check takes any map; the simulator, the search and the contract never read it.