LEAD-QUAL-001.2 · Two-pass autonomous screening and qualification
Отдельный файл отчёта для этой задачи не найден или не указан. Показан сохранённый результат задачи.
I built the two-pass engine: targeted intake, cheap screening, deeper qualification for survivors only, then automatic shortlisting. No step needs a human. The acceptance check passes: python3 -m unittest tests.test_autonomous_qualification -v ran 29 tests, all OK. I did not migrate the live database (it is still at schema version 2) and did not run any live leads.
How a run works (app/autonomous_qualification.py, QualificationEngine(...).run(candidates))
- Intake: a company becomes a candidate only if it matches the campaign targeting and has a dated signal that names it, with a real source URL. Companies that fail are not stored; the report lists them with reason codes such as
no_dated_signal or outside_geography. If too many arrive, the extra ones are put off, not stored. - Pass 1 (cheap screening): each candidate becomes SCREENED or REJECTED with a reason code from the config. This pass can fill in an unknown country, size or sector.
- Pass 2 (deeper qualification): this runs only on companies that passed screening. Every scoring dimension is stored with its weight, score, points, cited signals and explanation. Each company ends up QUALIFIED, REJECTED, or held as SCREENED with a reason such as
needs_more_evidence or evidence_not_supported. The thresholds come from the campaign config. - Shortlist: qualified companies move to SHORTLISTED automatically, using the config's ranking and per-run cap. Each gets a handoff record for the presales stage, with
human_approval_required=false and outreach_authorized=false. Companies that don't make the cut stay QUALIFIED with below_shortlist_cutoff or shortlist_capacity. - Evidence: source-confirmed ("SUPPORTED") evidence is enough; human verification is never required. If the AI cites a signal that doesn't exist, the answer is rejected and nothing is cached.
Failures, re-runs and limits
- Nothing waits for a person: held records are asked again only when their signals or the config change. An AI failure leaves the record where it was, stores the error, and it is retried on the next run.
monitor() shows every record with its state, reason codes and last error. - Re-runs cost nothing if nothing changed: each AI answer is stored per company, pass, input and config version. An unchanged re-run makes no AI calls and records no state changes. A crashed run picks up from the stored answers, and repeating a finished run's ID just returns its report.
- New signals: a rejected company is readmitted only if its rejection reason is not marked final in the config.
- Resource limits: each call counts against the run's call, token and wall-clock limits, and retries are capped. Each AI call runs in a separate process that is killed at its deadline. Work over budget is put off with its state unchanged, the run is marked
BUDGET_EXHAUSTED, and the shortlist step still runs. - Human override (optional): an override needs a named person and a reason, and is logged permanently.
force_reject, force_shortlist and remove_from_shortlist stick across runs; restore and requalify hand the record back to the automatic flow.
Storage: I added migration 3 in app/migrations.py. It adds four new tables: runs, the current state of each company, the state history, and the stored AI answers. The database blocks edits and deletions of the history and the stored answers. Existing tables are untouched
[truncated]
Материалы