Fetch terms narrow what big boards read with the wide reach send (WP F2)

An agent has fetch_terms (migration 23, API, a chip field in the agent
editor). The terms of a pull are the union over the enabled agents, none
when one of them has none. They go only to wide reads: a company tagged All
roles, or a reach ask_for drops as too many countries for a one host; a
board's {"terms": false} switches them off. SmartRecruiters q,
SuccessFactors q, Workday searchText, Phenom keywords, Eightfold query and
Oracle keyword declare query="one"; the runner makes one series per term
times the country series, drops the places first over MAX_SERIES, then the
terms. A term read is narrowed: it writes no ats:size, closes nothing and
prunes no per-role state, and the 10% guard holds it to its own
fingerprint. The Companies reach line counts the terms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 11:59:27 +02:00
1 parent 3917b31209
commit 0fd45b333a
28 files changed
+839 -113

No files matched your search

+25 -1
View File
@@ -1141,10 +1141,33 @@ def check_prompts(prompts: list[Prompt]) -> list[Prompt]:
Prompts = Annotated[list[Prompt], AfterValidator(check_prompts)]
def fetch_terms(value: Any) -> list[str]:
"""Fetch terms as stored and sent: a JSON list or a list, each stripped,
empty ones dropped, one of each regardless of case, in the order given."""
items = _json(value, "[]")
seen: set[str] = set()
out: list[str] = []
for item in items if isinstance(items, list) else []:
term = " ".join(str(item).split())
if term and term.casefold() not in seen:
seen.add(term.casefold())
out.append(term)
return out
#: An agent's fetch terms, normalised by `fetch_terms`.
FetchTerms = Annotated[list[str], BeforeValidator(fetch_terms)]
class Agent(Model):
"""A row of `agents`: a named search with its own prompts, gates, weights
and limits. The prompts are rows of `agent_prompts`, read alongside; their
cached vectors are columns this does not declare."""
cached vectors are columns this does not declare.
`fetch_terms` are words a role must match for a big board read with the
wide reach to send it (`app/jobs/reach.py`): the pull's terms are the
union over the enabled agents, and an agent with none means no board is
narrowed by words. They decide what is fetched, not what ranks."""
id: int
name: str
@@ -1152,6 +1175,7 @@ class Agent(Model):
gates: Annotated[list[Gate], BeforeValidator(lambda v: _json(v, "[]"))] = []
weights: Annotated[Weights, BeforeValidator(lambda v: _json(v, "{}"))] = Weights()
limits: Annotated[Limits, BeforeValidator(lambda v: _json(v, "{}"))] = Limits()
fetch_terms: FetchTerms = []
enabled: bool = True
created_at: str