Skip to content

fix(agent): stabilize research structured output - #159

Merged
iamjr15 merged 1 commit into
mainfrom
fix/research-native-structured-output
Aug 4, 2026
Merged

fix(agent): stabilize research structured output#159
iamjr15 merged 1 commit into
mainfrom
fix/research-native-structured-output

Conversation

@iamjr15

@iamjr15 iamjr15 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Why

Production research runs reached the evidence pass but every nested structured-output call returned an empty object. The installed AI SDK does not yet identify claude-sonnet-5 as natively structured-output capable, so its automatic fallback used a synthetic JSON response tool that produced {}.

What changed

  • Force Anthropic native outputFormat structured output for research query and synthesis passes.
  • Present a flat provider citation schema to the model so it remains compatible with native constrained decoding.
  • Preserve strict downstream Exa and Firecrawl provenance validation, including exact Exa result IDs and empty Firecrawl result IDs.

No database, migration, dependency, environment, or deployment-topology changes.

Verification

  • pnpm lint
  • pnpm typecheck
  • pnpm turbo build --force
  • pnpm deadcode
  • pnpm architecture:check
  • pnpm turbo skills:build

Production browser QA will be run after the Cloudflare deployment: natural-language research intent, PDF generation, project persistence, browser viewing, download validation, refresh persistence, and / file recall.

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
cheatcode Skipped Skipped Aug 4, 2026 10:24pm

@iamjr15
iamjr15 merged commit cbe0a91 into main Aug 4, 2026
6 checks passed
@iamjr15
iamjr15 deleted the fix/research-native-structured-output branch August 4, 2026 22:26
iamjr15 added a commit that referenced this pull request Aug 4, 2026
## Why

The production trace after PR #159 proved that Anthropic native
structured output was active, but query passes generated 11-23
exhaustive claims and exhausted the response budget before emitting
required fields. Responses were valid JSON prefixes cut off mid-claim or
before `summary`.

## What changed

- Bound each query pass to 1-6 concise claims and 1-3 exact provider
citations per claim.
- Prompt the model to produce 4-6 synthesis-ready claims instead of
restating the whole evidence pack.
- Bound synthesis to 16 consolidated claims and 4 source IDs per claim.
- Give the final synthesis an explicit 8,192-token allowance while
keeping the report below 2,000 words.
- Keep all strict Exa/Firecrawl provenance validation in place.

No database, migration, dependency, environment, or deployment-topology
changes.

## Verification

- `pnpm lint`
- `pnpm typecheck`
- `pnpm turbo build --force`
- `pnpm deadcode`
- `pnpm architecture:check`
- `pnpm turbo skills:build`

After deployment, production QA will repeat natural-language and
explicit-tool research flows and validate PDF generation, viewing,
download, refresh persistence, and `/` file recall.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant