feat(agent): move every model call to Sonnet 5 (#1218)
* feat(agent): move every model call to Sonnet 5
Sonnet 5 is verified enabled on our Bedrock account already: a live probe of
eu.anthropic.claude-sonnet-5 in eu-north-1 answered normally, so no model-access
request was needed. The bare anthropic.claude-sonnet-5 is rejected (on-demand
throughput needs the cross-region inference profile), so the eu. prefix we
already use stays.
This is not a model-string swap. Sonnet 5 REJECTS the fixed thinking budget
outright: thinking {type:'enabled', budget_tokens} returns 400 "not supported
for this model. Use thinking.type.adaptive and output_config.effort". Every
chat intent set a budget, so the assistant would have failed on the first turn
after a bare ID change. Reasoning depth is now an effort level (STANDARD high,
DEEP xhigh), and max_tokens is explicit per tier rather than derived from a
budget that no longer exists.
display:'summarized' is load-bearing, not cosmetic. The default is 'omitted',
which still emits thinking blocks but with empty text. Measured on our own
account at xhigh effort: summarized returned ~1k characters of reasoning, the
default returned none. Without it the collapsible "Tänker ..." block in the
chat would have gone silently empty, which no mocked test would have caught.
Ceilings are raised (16k standard, 24k deep) because Sonnet 5's tokenizer
produces roughly 30% more tokens for the same text and max_tokens now caps
thinking and the visible reply together.
Also resolves the Opus 4.7 landmine recorded in the readiness doc: the composer
comment told ops to flip BEDROCK_OPUS_MODEL_ID to Opus 4.7, which would have
400d every thinking intent against the legacy budget shape. Both model
constants now point at Sonnet 5 and the stale instruction is gone.
Checked but deliberately unchanged: forced tool_choice in atom-selection. The
Sonnet 5 docs require thinking:{type:'disabled'} alongside a forced tool_choice
on Bedrock; probed against our account, the forced call succeeds without it, so
no change was made rather than adding a guard we cannot show is needed.
Other call sites moved too: invoice-inbox extraction, document extraction, the
compliance config, and the CI/CD workflows (pr-agent MODEL and MODEL_WEAK,
swedish-compliance-review, compliance-swarm).
Verified: 11315 tests pass, lint and tsc clean on every touched file, guards
pass.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(agent): review triage: keep the no-thinking output ceiling, finish the model sweep
max_tokens now caps thinking and the visible reply together, so collapsing the
two tiers into one made every non-thinking intent inherit a 16000 ceiling where
it used to have 4096. Give it its own MAX_TOKENS_NO_THINKING instead, set to the
old 4096 scaled ~30% for Sonnet 5's tokenizer so the effective reply length is
unchanged rather than quietly cut.
scripts/swedish-compliance-review.mjs still fell back to Sonnet 4.6 when
REVIEW_MODEL was unset, so a manual run silently used the old model. The initial
sweep only covered .ts and .yml.
pr-agent's FALLBACK_MODELS listed the primary model as its own fallback, which is
not a fallback; dropped it and rewrote the surrounding comments, which still
described Opus 4.8 and a 200k window.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
f3eacb436d
commit
2d543ac999
@@ -1,5 +1,5 @@
|
||||
import { defineAgentIntent } from './types'
|
||||
import { SONNET_MODEL, THINKING_BUDGET_STANDARD } from '@/lib/agent/composer/client'
|
||||
import { SONNET_MODEL, EFFORT_STANDARD } from '@/lib/agent/composer/client'
|
||||
import { renderAgentGroundRules } from './shared-rules'
|
||||
|
||||
// general.help: always-present "Fråga min assistent" from the top nav.
|
||||
@@ -98,7 +98,7 @@ export const generalHelp = defineAgentIntent<GeneralHelpArgs, GeneralHelpCapture
|
||||
// answered regulatory questions from memory and narrated its steps. Thinking
|
||||
// moves the reasoning into its own channel so the visible reply is a single
|
||||
// consolidated answer.
|
||||
thinking: { budgetTokens: THINKING_BUDGET_STANDARD },
|
||||
thinking: { effort: EFFORT_STANDARD },
|
||||
|
||||
capture: async ({ route }) => ({ route: route ?? null }),
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineAgentIntent } from './types'
|
||||
import { SONNET_MODEL, THINKING_BUDGET_STANDARD } from '@/lib/agent/composer/client'
|
||||
import { SONNET_MODEL, EFFORT_STANDARD } from '@/lib/agent/composer/client'
|
||||
|
||||
// inbox.bulk-book: "Fråga assistenten" on a multi-selection in the Underlag
|
||||
// view (Dokumentinkorgen). Unlike transaction.categorization (which keys off the
|
||||
@@ -116,7 +116,7 @@ export const inboxBulkBook = defineAgentIntent<InboxBulkBookArgs, CapturedInboxB
|
||||
// Reason before proposing: group the selection and work out category + VAT
|
||||
// treatment in the thinking channel, so the visible reply is one short
|
||||
// motivation, not a play-by-play.
|
||||
thinking: { budgetTokens: THINKING_BUDGET_STANDARD },
|
||||
thinking: { effort: EFFORT_STANDARD },
|
||||
|
||||
capture: async ({ item_ids }, { supabase, companyId }) => {
|
||||
const ids = Array.isArray(item_ids) ? item_ids.filter((x): x is string => typeof x === 'string') : []
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineAgentIntent } from './types'
|
||||
import { SONNET_MODEL, THINKING_BUDGET_STANDARD } from '@/lib/agent/composer/client'
|
||||
import { SONNET_MODEL, EFFORT_STANDARD } from '@/lib/agent/composer/client'
|
||||
import { renderAgentGroundRules } from './shared-rules'
|
||||
|
||||
// invoice.draft: "Fråga om denna faktura" from the invoice form.
|
||||
@@ -83,7 +83,7 @@ export const invoiceDraft = defineAgentIntent<InvoiceDraftArgs, CapturedInvoiceD
|
||||
// Draft the invoice lines + VAT in the thinking channel, so the visible reply
|
||||
// is one short confirmation after staging rather than a play-by-play that
|
||||
// repeats once before the tool call and once after it.
|
||||
thinking: { budgetTokens: THINKING_BUDGET_STANDARD },
|
||||
thinking: { effort: EFFORT_STANDARD },
|
||||
|
||||
capture: async ({ customer_id, invoice_id }, { supabase, companyId }) => {
|
||||
// Resolve the effective customer_id. When the FAB lands here from
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineAgentIntent } from './types'
|
||||
import { OPUS_MODEL, THINKING_BUDGET_DEEP } from '@/lib/agent/composer/client'
|
||||
import { OPUS_MODEL, EFFORT_DEEP } from '@/lib/agent/composer/client'
|
||||
import { renderAgentGroundRules } from './shared-rules'
|
||||
|
||||
// supplier_invoice.review: "Fråga din assistent" from a supplier invoice
|
||||
@@ -171,7 +171,7 @@ export const supplierInvoiceReview = defineAgentIntent<
|
||||
// so the visible reply is a single conclusion after the booking is staged:
|
||||
// not a pre-tool analysis echoed again post-tool. Matches the always-on
|
||||
// prompt's promise that reasoning happens in the (separately shown) tankekanal.
|
||||
thinking: { budgetTokens: THINKING_BUDGET_DEEP },
|
||||
thinking: { effort: EFFORT_DEEP },
|
||||
|
||||
capture: async ({ supplier_invoice_id }, { supabase, companyId }) => {
|
||||
const { data: invoice } = await supabase
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineAgentIntent } from './types'
|
||||
import { SONNET_MODEL, THINKING_BUDGET_STANDARD } from '@/lib/agent/composer/client'
|
||||
import { SONNET_MODEL, EFFORT_STANDARD } from '@/lib/agent/composer/client'
|
||||
|
||||
// transaction.categorization: "Fråga om denna transaktion" on a transaction
|
||||
// row.
|
||||
@@ -78,7 +78,7 @@ export const transactionCategorization = defineAgentIntent<
|
||||
// Reason before proposing: read underlag + history and work out the VAT
|
||||
// treatment in the thinking channel, so the visible reply is one short
|
||||
// motivation, not a play-by-play of each tool call.
|
||||
thinking: { budgetTokens: THINKING_BUDGET_STANDARD },
|
||||
thinking: { effort: EFFORT_STANDARD },
|
||||
|
||||
capture: async ({ transaction_id }, { supabase, companyId }) => {
|
||||
const { data: tx } = await supabase
|
||||
|
||||
@@ -36,11 +36,13 @@ export interface AgentIntent<Args = Record<string, unknown>, Captured = unknown>
|
||||
// override to Opus.
|
||||
model: string
|
||||
|
||||
// Extended-thinking budget. When set, run-turn enables a reasoning channel
|
||||
// (thinking: { type: 'enabled', budget_tokens }) on every model call in the
|
||||
// loop, so the agent reasons before it answers instead of narrating its
|
||||
// steps in the visible reply. Omit to disable. budget_tokens must be ≥ 1024.
|
||||
thinking?: { budgetTokens: number }
|
||||
// Reasoning depth. When set, run-turn enables adaptive thinking on every
|
||||
// model call in the loop, so the agent reasons before it answers instead of
|
||||
// narrating its steps in the visible reply. Omit to disable.
|
||||
//
|
||||
// Sonnet 5 rejects the old fixed budget outright, so this is an effort level
|
||||
// (EFFORT_STANDARD / EFFORT_DEEP), not a token count.
|
||||
thinking?: { effort: 'low' | 'medium' | 'high' | 'xhigh' | 'max' }
|
||||
|
||||
// Captures the page-context object the prompt template needs. Runs server-
|
||||
// side after the user clicks the button. Failures bubble up to the route.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineAgentIntent } from './types'
|
||||
import { OPUS_MODEL, THINKING_BUDGET_DEEP } from '@/lib/agent/composer/client'
|
||||
import { OPUS_MODEL, EFFORT_DEEP } from '@/lib/agent/composer/client'
|
||||
import { renderAgentGroundRules } from './shared-rules'
|
||||
|
||||
// vat.review: "Fråga [namn]" from the VAT declaration preview.
|
||||
@@ -62,7 +62,7 @@ export const vatReview = defineAgentIntent<VatReviewArgs, CapturedVatReview>({
|
||||
// Reason over the period figures + Rutor in the thinking channel, so the
|
||||
// visible reply is one conclusion, not a running commentary of each read
|
||||
// followed by a restated summary. Parity with the other reasoning intents.
|
||||
thinking: { budgetTokens: THINKING_BUDGET_DEEP },
|
||||
thinking: { effort: EFFORT_DEEP },
|
||||
|
||||
capture: async ({ period_type, year, period }, { supabase, companyId }) => {
|
||||
const { data: settings } = await supabase
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineAgentIntent } from './types'
|
||||
import { SONNET_MODEL, THINKING_BUDGET_STANDARD } from '@/lib/agent/composer/client'
|
||||
import { SONNET_MODEL, EFFORT_STANDARD } from '@/lib/agent/composer/client'
|
||||
import { renderAgentGroundRules } from './shared-rules'
|
||||
import { resolvePeriodStatusForDate } from '@/lib/core/bookkeeping/period-service'
|
||||
|
||||
@@ -102,7 +102,7 @@ export const verifikationDraft = defineAgentIntent<
|
||||
// analysis before the tool call and a near-identical answer after it. The
|
||||
// always-on prompt promises "resonemang sker i tankekanalen"; without this
|
||||
// that channel doesn't exist and the reasoning spills into the visible reply.
|
||||
thinking: { budgetTokens: THINKING_BUDGET_STANDARD },
|
||||
thinking: { effort: EFFORT_STANDARD },
|
||||
|
||||
capture: async ({ journal_entry_id, description }, { supabase, companyId }) => {
|
||||
let entry: CapturedVerifikationDraft['entry'] = null
|
||||
|
||||
Reference in New Issue
Block a user