Extract and summarise bounds are each agent's own limits, set on its form

agents.limits holds extract_top, extract_min, summarise_top and
summarise_min; the scope query reads them per ranked row, and a row saved
before this behaves like a fresh agent. The four global config keys go.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Fable 5.1 committed 2026-09-28 16:02:06 +02:00
1 parent e602eb3388
commit cebe62ddc9
20 files changed
+229 -147

No files matched your search

+3 -4
View File
@@ -12,10 +12,9 @@ nothing: `extract.enabled: false`, or an `on_ingest` this pull does not
satisfy, is an extract stage with no batches whose final job moves straight
on. The free stages go first: embed and score cost no tokens, and the score
they produce is what bounds the two that do. Extract reads only the best
`extract.per_agent` roles of each enabled agent, not below
`extract.min_score`; the second score then applies the gates to the columns
it filled. Summarise runs last, on the best `summarise.per_agent` roles not
below `summarise.min_score`.
roles of each enabled agent, as deep and as low as that agent's own `limits`
say; the second score then applies the gates to the columns it filled.
Summarise runs last, on the best roles by the same agent's summarise limits.
A batch that failed, or a stage somebody killed, does not stop the chain: the
work comes round on the next pull, and a rescore of what did arrive is worth
+7 -10
View File
@@ -8,9 +8,10 @@ refused batch, and failing with a notice when no model is reachable are
`desk.modeltask`'s.
A role is waiting while it is open, has never been answered (`extracted_at IS
NULL`), has not been given up on, and is in the best `extract.per_agent` of an
enabled agent's ungated scores at `extract.min_score` or more. That bound is
what keeps the cost proportional to the rankings rather than to the boards:
NULL`), has not been given up on, and is in the best of an enabled agent's
ungated scores as deep and as low as that agent's own `limits` say
(`extract_top`, `extract_min`). That bound is what keeps the cost
proportional to the rankings rather than to the boards:
the pull scores every role for free first, then reads the few hundred that
rank, and scores again so the gates see what was filled. A batch built for
named uids finishes what it was dealt whatever their rank. The answer only
@@ -133,8 +134,7 @@ def _item(role: Role) -> dict[str, Any]:
def build_batch(config: Config, store: Store, limit: int = 20,
uids: Sequence[str] | None = None) -> dict[str, Any]:
return {"instructions": SYSTEM,
"roles": [_item(r) for r in store.extract_waiting(
limit, config.extract.per_agent, config.extract.min_score, uids)]}
"roles": [_item(r) for r in store.extract_waiting(limit, uids)]}
# -------------------------------------------------------------------- answer
@@ -205,11 +205,8 @@ TASK: ModelTask[ExtractResult] = ModelTask(
kind="extract", label="Reading postings for gate fields",
verb="extracting", noun="fields", idle="nothing to extract", items="roles",
settings=lambda config: config.extract,
pending=lambda config, store: store.extract_pending(
config.extract.per_agent, config.extract.min_score),
waiting=lambda config, store, limit: [
r.uid for r in store.extract_waiting(
limit, config.extract.per_agent, config.extract.min_score)],
pending=lambda config, store: store.extract_pending(),
waiting=lambda config, store, limit: [r.uid for r in store.extract_waiting(limit)],
build_batch=build_batch,
system=lambda store: SYSTEM,
schema=SCHEMA,
+1 -1
View File
@@ -276,7 +276,7 @@ def seed_agents(config: Config, store: Store) -> list[str]:
for seed in config.agents:
try:
store.save_agent(seed.name, seed.intent, seed.gates, seed.weights,
seed.enabled)
seed.enabled, limits=seed.limits)
except ValueError as exc:
log.warning("agents: %s", exc)
continue
+6 -7
View File
@@ -6,9 +6,10 @@ what the model is told, the schema it answers in, what to do with the
answer), and running it is `desk.modeltask`'s.
A role is waiting while it has no summary, has some text, and is in the top
`summarise.per_agent` of an enabled agent's ungated scores at
`summarise.min_score` or more. That bound is what keeps the cost flat: a pull
summarises the roles somebody will look at, not the 30k that are open. A batch built for named uids (the read page's Summarise
of an enabled agent's ungated scores as deep and as low as that agent's own
`limits` say (`summarise_top`, `summarise_min`). That bound is what keeps the
cost flat: a pull summarises the roles somebody will look at, not the 30k
that are open. A batch built for named uids (the read page's Summarise
button) takes those roles whatever their rank. See `Store.summarise_waiting`.
The text is `article_text` when the posting page was fetched, else
@@ -121,8 +122,7 @@ def _item(role: Role) -> dict[str, Any]:
def _waiting(config: Config, store: Store, limit: int,
uids: Sequence[str] | None = None) -> list[Role]:
return store.summarise_waiting(limit, config.summarise.per_agent, uids,
min_score=config.summarise.min_score)
return store.summarise_waiting(limit, uids)
def build_batch(config: Config, store: Store, limit: int = 10,
@@ -166,8 +166,7 @@ TASK: ModelTask[SummariseResult] = ModelTask(
verb="summarising", noun="summaries", idle="nothing to summarise",
items="summaries",
settings=lambda config: config.summarise,
pending=lambda config, store: store.summarise_pending(
config.summarise.per_agent, config.summarise.min_score),
pending=lambda config, store: store.summarise_pending(),
waiting=lambda config, store, limit: [r.uid for r in _waiting(config, store, limit)],
build_batch=build_batch,
system=lambda store: SYSTEM,