Skip to main content

Architecture

scheduled-loops

Agents woken by schedules instead of a person: a nightly sweep that makes a fresh task from its template every 24 h at 02:00, and a triage loop that wakes on its own clock and works through the backlog until it is empty. Scheduled agent loops went from 2.2 to about 35 merged pull requests per day (2610.36254). The simulator fires each schedule every `every` from `next_fire_at` and applies the trigger's policy: skip drops a firing while a run is going, queue holds it until a run ends, parallel overlaps up to `max_parallel` runs and refuses the rest. A run that finds nothing to take costs one model call. Tasks wait in the backlog between two ticks. The simulator does not model cron expressions or time zones (only a fixed interval), the restriction checks a schedule passes before it is enabled, nor what a sweep finds: a sweep is one task of the coding role, and triage does the tasks rather than sorting them.

architectures/scheduled-loops.yaml

Search result​

A short run of the experiment scheduled-loops-tuning tried 108 variants of the marked places. Its fitness, the weighted sum of KPIs the experiment scores, is -25.249 as built and 164.1 for the best variant. How the run was made: Optimization.

Marked places​

A marked place carries vary: the value as built and the values a search may try there. The best value is that of the best variant.

placeas builtbest valuethe search may try
parts.clock.every1h30m15m, 30m, 1h, 2h
parts.triage.max_parallel181, 4, 8
parts.triage.policyskipparallelskip, queue, parallel
parts.triager.count282, 4, 8

KPIs that moved​

35 of 102 KPIs differ between the architecture as built and its best variant; the others are equal. A weight is what the experiment scores a KPI by: above 0 more is better, below 0 less is better.

KPIweightas builtbest variantchange
false_completions_shipped−510.50089+747.6 %, worse
backlog_wait_p90_seconds−0.00169457.112024.0−82.7 %, better
cost_usd−0.05255.41641.2+542.5 %, worse
owner_wait_share−2000.0450.067+48.1 %, worse
questions_defaulted−111.50043.500+278.3 %, worse
tasks_correct+101376+484.6 %, better
firing_failure_share–0.6670.875+31.3 %
agents_total–39+200.0 %
task_completion–0.1140.803+601.7 %
agent_time_cost_usd–72216+200.0 %
backlog_wait_p50_seconds–37371.45484.3−85.3 %
capacity_ratio–0.3751.125+200.0 %
cost_per_task_usd–10.8819.949−8.6 %
firing_skip_share–0.8800.694−21.2 %
firings–2549+96.0 %
firings_empty–12+100.0 %
firings_skipped–2234+54.5 %
firings_started–315+400.0 %
jobs–87.500638.5+629.7 %
jobs_killed–5.50038.500+600.0 %
pool_utilization–0.0200.143+606.6 %
questions_asked–15.50090+480.6 %
rework_turns–7626205+714.3 %
steps–2381890.5+694.3 %
steps_failed–1341145+754.5 %
tasks_claimed_done–23.500165+602.1 %
tasks_done–23.500165+602.1 %
tasks_started–24.500173+606.1 %
tokens_cache_read–1375800001068930000+677.0 %
tokens_cache_write–917200071262000+677.0 %
tokens_input–458600035631000+677.0 %
tokens_output–137580010689300+677.0 %
turns–229217813.5+677.2 %
worker_busy_share–0.2890.725+151.4 %
wrong_assumptions–4.50015.500+244.4 %

Graph​

The architecture as a graph, with the best variant of a short run of the experiment scheduled-loops-tuning at its marked places.Open full screen ↗

Check​

accepted 10 parts and 10 links; the structural check refuses nothing.

The architecture as a whole​

Read from the document alone, before any simulation: its size, autonomy, exposure, weak points and fixed limits. agenticspec sim check reports the same numbers; a marked place counts at its value as built. The KPIs are in the KPI catalogue under the block architecture.

KPIvaluewhat it counts
agents_total3Agent copies: the sum of count over the agent parts.
principals_total1Principal parts.
human_touchpoints2Links that end at a principal and carry a question or a proposal.
autonomy_depth0Links in the longest chain of order and question links from agent to agent.
model_call_paths2Distinct paths of model_call links from an agent part to a model part.
ungated_model_calls0Paths of model_call links from an agent to a model that pass no gateway part.
single_points2 (gateway, model)Parts whose removal leaves some agent with no model_call path to a model.
border_parts0Parts named in the border, the parts that take input from outside.
egress_targets0Distinct parts and endpoints named in the egress of the sandbox parts.
shared_workspaces0Workspace parts whose sharing is not exclusive.
capacity_ratio0.375Agent copies that claim a pool divided by its capacity, the largest over the pools.

Contract​

The ports a runtime implements to run this architecture: each port's protocol, the part that uses it with the settings that narrow it, and how many instances run. Derived from the document and the ports of the building blocks; how. The contract file: scheduled-loops.contract.yaml.

portkindblockprotocolpartsettingsinstances
resource.claimOutboundresourceRequestClaim (ExpireWait | GrantClaim (ExpireClaim | KillClaim | ReleaseClaim) | WithdrawClaim)buildscapacity: 8, job_limit: 10m, kind: build_slots1
trigger.scheduleOutboundtriggerEnableSchedule AdvanceSchedule*clockevery: 1h1
gateway.callOutboundgatewayAdmitCall CompleteCallgatewayrate_limit_per_minute: 1201
model.inferenceOutboundmodelStartInference FinishInferencemodelroute: frontier1
trigger.scheduleOutboundtriggerEnableSchedule AdvanceSchedule*nightlyevery: 24h, next_fire_at: 2h1
question.questionPrincipalquestionAsk (Answer | RecordUnreadableAnswer | TakeDefault ReviseAnswer? | Withdraw)ownerkind: human1
trigger.firingOutboundtriggerFireTrigger (RecordFailure | RecordStart (RecordEnd | RecordReplaced) | SkipFiring)sweepkind: on_schedule, max_parallel: 1, policy: skip, schedule: nightly1
harness.sessionOutboundharness(OpenSession | SpawnSubAgent) (CompactContext | NameSession | RecordRestart | RecordTurn | RequestRoute)* EndSessionsweeperharness: coding1
model.inferenceOutboundmodelStartInference FinishInferencesweepernone1
question.questionPrincipalquestionAsk (Answer | RecordUnreadableAnswer | TakeDefault ReviseAnswer? | Withdraw)sweepernone1
resource.claimOutboundresourceRequestClaim (ExpireWait | GrantClaim (ExpireClaim | KillClaim | ReleaseClaim) | WithdrawClaim)sweepernone1
trigger.firingOutboundtriggerFireTrigger (RecordFailure | RecordStart (RecordEnd | RecordReplaced) | SkipFiring)triagekind: on_schedule, max_parallel: 1, policy: skip, schedule: clock1
harness.sessionOutboundharness(OpenSession | SpawnSubAgent) (CompactContext | NameSession | RecordRestart | RecordTurn | RequestRoute)* EndSessiontriagerharness: coding2
model.inferenceOutboundmodelStartInference FinishInferencetriagernone2
question.questionPrincipalquestionAsk (Answer | RecordUnreadableAnswer | TakeDefault ReviseAnswer? | Withdraw)triagernone2
resource.claimOutboundresourceRequestClaim (ExpireWait | GrantClaim (ExpireClaim | KillClaim | ReleaseClaim) | WithdrawClaim)triagernone2

Routing invariants, one per link whose value travels in a port:

  • sweep -> sweeper carries trigger: every trigger.firing@sweep to sweeper
  • triage -> triager carries trigger: every trigger.firing@triage to triager
  • triager -> owner carries question: every question.question@triager to owner
  • sweeper -> owner carries question: every question.question@sweeper to owner
  • sweeper -> gateway carries model_call: every model.inference@sweeper inside gateway.call@gateway
  • triager -> gateway carries model_call: every model.inference@triager inside gateway.call@gateway
  • gateway -> model carries model_call: every gateway.call@gateway to model
  • sweeper -> builds carries claim: every resource.claim@sweeper to builds
  • triager -> builds carries claim: every resource.claim@triager to builds

Border: none.

Ingresses: who reaches the architecture from outside, what each audience may use, and over which protocols.

ingressaudienceauthenticatedexportscommandsviewsfeedsmetrics
metricscontrol.monitornometrics_scrape0009
operatorcontrol.operatoryeshttp, event_stream, ui, tool829730
  • metrics: cache_bust_count, cache_hit_share, context_size_p90_tokens, cost_usd, human_prompt_share, owner_wait_share, priced_message_share, sub_agents_started, subagent_cost_share
  • operator: agentic.gateway.DetachUpstream, agentic.gateway.DrainGateway, agentic.gateway.StopGateway, agentic.question.Answer, agentic.trigger.DisableSchedule, agentic.trigger.DisableTrigger, agentic.trigger.EnableTrigger, agentic.trigger.PassScheduleChecks

Parts​

partblocksettings
ownerprincipalkind human
gatewaygatewayrate_limit_per_minute 120
modelmodelroute frontier
sweeperagentharness coding
triageragentcount 2 marked: 2, 4, 8; harness coding
sweeptriggerkind on_schedule; max_parallel 1; policy skip; schedule nightly; task_template nightly-sweep
triagetriggerkind on_schedule; max_parallel 1 marked: 1, 4, 8; policy skip marked: skip, queue, parallel; schedule clock; takes all
buildspoolcapacity 8; job_limit 10m; kind build_slots
clockscheduleevery 1h marked: 15m, 30m, 1h, 2h
nightlyscheduleevery 24h; next_fire_at 2h

No link, no reach: a part reaches only what a link names.

  • owner sends prompt to triager.
  • sweep sends trigger to sweeper.
  • triage sends trigger to triager.
  • triager sends question to owner.
  • sweeper sends question to owner.
  • sweeper sends model_call to gateway.
  • triager sends model_call to gateway.
  • gateway sends model_call to model.
  • sweeper sends claim to builds.
  • triager sends claim to builds.

Policies​

policyvalue
question_default_after15m

Optimization​

The experiment scheduled-loops-tuning searches the marked places of this architecture under a behaviour profile. The figures on this page come from a short run of it: 24 evaluations of 2 seeds each. The experiment file asks for more; agenticspec sim run experiments/scheduled-loops-tuning.yaml runs it in full.

Every KPI of the architecture as built and of its best variant:

KPIkindas builtbest variant
acts_for_not_principalcorrectness00
acts_for_without_partcorrectness00
agent_time_cost_usdquality72216
agent_without_model_pathcorrectness00
agents_totalcompleteness39
as_not_principalcorrectness00
autonomy_depthquality00
backlog_wait_p50_secondsquality37371.45484.3
backlog_wait_p90_secondsquality69457.112024.0
border_partsquality00
border_without_partcorrectness00
bus_reach_not_eventcorrectness00
capacity_ratioquality0.3751.125
claim_conflictsquality00
coordination_callsquality00
coordination_messagesquality00
cost_per_task_usdquality10.8819.949
cost_usdquality255.41641.2
decision_kind_unknowncorrectness00
duplicate_runsquality00
egress_targetsquality00
egress_without_partcorrectness00
empty_architecturecorrectness00
endpoint_invalidcorrectness00
external_store_not_in_egresscorrectness00
false_completions_shippedcorrectness10.50089
firing_failure_sharecorrectness0.6670.875
firing_skip_sharequality0.8800.694
firing_start_wait_p90_secondsquality00
firingsquality2549
firings_emptyquality12
firings_queuedquality00
firings_skippedquality2234
firings_startedquality315
gateway_without_modelcorrectness00
human_touchpointsquality22
invalid_concurrencycorrectness00
invalid_schedulecorrectness00
jobsquality87.500638.5
jobs_killedquality5.50038.500
link_existscorrectness00
link_grant_invalidcorrectness00
merge_conflictsquality00
model_call_pathscompleteness22
module_link_cyclescorrectness00
not_a_channelcorrectness00
not_reached_by_principalcorrectness00
operator_decided_owner_questionsquality00
operator_wait_sharequality00
owner_wait_sharequality0.0450.067
per_without_partcorrectness00
pool_utilizationquality0.0200.143
postsquality00
principals_totalcompleteness11
question_without_answerercorrectness00
questions_askedquality15.50090
questions_defaultedquality11.50043.500
questions_forwardedquality00
queue_wait_p50_secondsquality00
queue_wait_p90_secondsquality00
rate_limited_secondsquality00
review_callsquality00
review_without_reviewercorrectness00
reviewsquality00
reviews_rejectedquality00
rework_turnsquality7626205
self_referencecorrectness00
semantic_store_without_modelcorrectness00
setting_invalidcorrectness00
setting_unknowncorrectness00
shared_workspacesquality00
single_pointsquality22
slot_wait_sharequality00
stepsquality2381890.5
steps_failedquality1341145
store_reach_not_record_or_readcorrectness00
swarm_needs_agentcorrectness00
task_completioncompleteness0.1140.803
tasks_arrivedquality206206
tasks_claimed_donequality23.500165
tasks_correctquality1376
tasks_donequality23.500165
tasks_startedquality24.500173
tokens_cache_readquality1375800001068930000
tokens_cache_writequality917200071262000
tokens_inputquality458600035631000
tokens_outputquality137580010689300
trigger_source_not_triggercorrectness00
trigger_target_not_agentcorrectness00
trigger_without_sourcecorrectness00
turnsquality229217813.5
under_not_authoritycorrectness00
ungated_model_callsquality00
ungoverned_tool_callcorrectness00
unknown_blockscorrectness00
unknown_carriescorrectness00
unknown_link_partscorrectness00
unreachable_partscorrectness00
via_not_in_egresscorrectness00
via_without_endpointcorrectness00
worker_busy_sharequality0.2890.725
wrong_assumptionsquality4.50015.500