[AUTO-2361] Document agent vs legacy confidence scores in get-run-results - #79
Open
rosalie-byrnes wants to merge 1 commit into
Open
[AUTO-2361] Document agent vs legacy confidence scores in get-run-results#79rosalie-byrnes wants to merge 1 commit into
rosalie-byrnes wants to merge 1 commit into
Conversation
…[AUTO-2361]) Clarify that include_confidence_scores still returns both model and OCR keys; agent mode stubs OCR confidence to 1.0 while legacy mode returns a measured value (or null when provenance is missing). Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
AUTO-2361 (from Slack) reported that as part of the agent mode rollout, the v2 results API started having only one confidence score instead of model confidence and OCR confidence, that v1 still defaulted OCR confidence to
1for agent mode, and that the change was never documented or communicated.The published Get run results docs still listed a
confidenceobject with bothmodelandocr, with no indication that behavior depends on processing mode. The same gap affects theinclude_confidence_scoresquery param description (and was noted for the Postman collection).I asked Cursor to verify current behavior against:
What Cursor found (important correction to the ticket premise)
Run results did not drop OCR confidence
For
GET /api/v2/apps/runs/{run_id}/resultswithinclude_confidence_scores=true, the API still returns both keys:files/documents/fields/confidence/modelfiles/documents/fields/confidence/ocrplus document-level
classification_confidence/model.Verified in
py/src/instabase/api_server/handler/api/v2/utils/results_utils.py(ResultsField._parse): when the flag is true, the response always builds:{ "model": field_result.get("model_confidence"), "ocr": field_result.get("ocr_confidence"), }Missing underlying scores become
null, not omitted keys.Agent mode stubs OCR to
1.0(same idea as the v1 comms)Agent-mode apps extract via the unified extractor / agent extract path. When building refined phrases, OCR/
char_confidenceare hardcoded to1.0because agent mode does not run a separate OCR step:py/src/instabase/flow_step_executors/unified_extractor/unified_extractor_step_executor.py—create_refined_phrase_from_pixelssets'char_confidence': 1.0and'ocr_confidence': 1.0 # Agent mode doesn't do separate OCR1.0after refinementrefined_phrase.get_char_confidence()intoresult.ocr_confidence(flow_export/export_results.py)ResultsAPIOptions(include_confidence_scores=True)So the accurate statement is:
confidence.modelconfidence.ocr1.0(placeholder; not measured)nullif no OCR provenanceThis matches product docs: legacy mode alone offers OCR confidence scores (
fern/docs/pages/apps/create.mdx, agent mode vs legacy mode section).Related but different: Build extracted-fields skip
[EPD-5767](2026-05-14; customer-facing around AI Hub 26.20) skips OCR population on the Build extracted-fields / validations path (aihub_build.py/Project.get_doc_extracted_values) for agent-mode projects. That is not the run-results serializer change. Do not use EPD-5767 as the “run results OCR removed” date.When the run-results agent-mode stub came into effect
char_confidence: 1.0[AUTO-400] #73078ocr_confidence: 1.0“so that the validations pass”[AUTO-549] #74426→25.38.0-aihubBest date for the delayed-docs acknowledgment: agent mode GA (25.48), with the stub present from AUTO-549 / 25.38.
Extra signal
SDK system tests previously asserted
confidence.ocrwas non-null, then commented that assertion out in[JIRA-000] Update SDK to version 0.9.0(sdk/system-tests/test_runs.py) — consistent with OCR being unreliable / placeholder-dependent depending on run shape, not with the key being removed from the schema.Fixes in this PR
Docs-only OpenAPI updates for Get run results:
include_confidence_scoresquery param — listsclassification_confidence/model, clarifies keys are always returned when the flag is true (values may benull), and documents agent vs legacy meaning, linking to/automate/creating#agent-mode-and-legacy-mode.documentField.confidence— object-level description for when the block appears;modelandocrdescriptions updated for mode-conditional meaning, null cases, and the agent-mode1.0stub.classification_confidence— notes when returned and whenmodelmay benull.ocrexample values changed from fabricated measured scores (0.69…/0.79…) to1.0to match agent-mode default behavior (new apps are agent mode).No server/API behavior change. Schema shape unchanged (still
confidence.model+confidence.ocr).Testing / verification
flow_binary.get_flow_results→export_results→ResultsAPIResponse/ResultsFieldto confirm both confidence keys are always emitted when the flag is true.build_refined_phrases_from_fields→create_refined_phrase_from_pixelsand confirmed OCR/char_confidencestub to1.0.apply_refiner_fns.get_provenance_info_for_text(OCR-derivedchar_confidence) for contrast./automate/creating#agent-mode-and-legacy-modeverified (slug + heading already used elsewhere in Fern docs).openapi.yamlonly; no Fern temp copy in this PR (docs site sync is a follow-up, same as last time).Next steps (outside this PR)
document_field_confidence.pyetc.). Shape/types do not need a hand edit.What to review
confidence.model/confidence.ocr/classification_confidence.modeldescriptions match server realityocr: 1.0is acceptable for the default (agent mode) response shape1.0) is acceptable messaging for GTM/supportMade with Cursor
Made with Cursor