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

+6 -3
View File
@@ -16,7 +16,7 @@ from pydantic import BaseModel, Field
from app import jobs, places
from app.models import (
AFFINITY, LEVELS, Agent, Application, Company, Gate, Limits, Prompts, Role, RoleRow,
AFFINITY, LEVELS, Agent, Application, Company, FetchTerms, Gate, Limits, Prompts, Role, RoleRow,
HandReason, ScoredRole, Status, Subscription, Weights, company_key,
)
from app.storage import Store
@@ -1064,7 +1064,9 @@ def list_agents(store: StoreDep) -> list[Agent]:
class AgentBody(BaseModel):
"""Create when `id` is missing, replace that agent's fields when given.
`intent` is the body from before an agent had prompts: without `prompts`
it is stored as one prompt named after the agent."""
it is stored as one prompt named after the agent. `fetch_terms` narrow
what big boards send (`app/jobs/reach.py`); `[]` narrows nothing, and
leaving the key out keeps an existing agent's."""
id: int | None = None
name: str = Field(min_length=1)
@@ -1073,6 +1075,7 @@ class AgentBody(BaseModel):
gates: list[Gate] = []
weights: Weights = Weights()
limits: Limits = Limits()
fetch_terms: FetchTerms | None = None
enabled: bool = True
@@ -1083,7 +1086,7 @@ def save_agent(body: AgentBody, store: StoreDep, queue: QueueDep) -> Agent:
try:
saved = store.save_agent(body.name, body.intent, body.gates, body.weights,
body.enabled, agent_id=body.id, limits=body.limits,
prompts=body.prompts)
prompts=body.prompts, fetch_terms=body.fetch_terms)
except ValueError as exc:
raise HTTPException(409, str(exc)) from exc
except KeyError: