Repository navigation
Conversation
🦋 Changeset detectedLatest commit: c51ec2e The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
4 of 5 tasks
Co-authored-by: Cursor <cursoragent@cursor.com>
…ing, routing trace keys) Co-authored-by: Cursor <cursoragent@cursor.com>
…ad_id Co-authored-by: Cursor <cursoragent@cursor.com>
…hreshold Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
hary73
force-pushed
the
hary/subagent-auto
branch
from
November 16, 2026 08:36
42ed3b4 to
88b3379
Compare
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
hary73
commented
Nov 16, 2026
hary73
commented
Nov 16, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
hary73
marked this pull request as ready for review
November 16, 2026 10:19
hary73
requested review from
chiragjn,
debajyoti-truefoundry,
heerambavi1998 and
thesujai
as code owners
November 16, 2026 10:19
Co-authored-by: Cursor <cursoragent@cursor.com>
…bilities Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…lder Co-authored-by: Cursor <cursoragent@cursor.com>
The router takes the classifier as an IDecisionModel and the question separately; building the request and reading the answer live in classification.ts. Long tasks keep their start and end. The router no longer takes a fallback model and logs once; the caller logs what the thread ends up on. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…use reasoning efforts modelRouting and RoutableModel's canonicalModel and price are required and allow undefined instead of being optional. Decision requests no longer take an abort signal, so routes no longer take one either. The clusters and the routed effort use SUPPORTED_REASONING_EFFORTS instead of their own effort list. Co-authored-by: Cursor <cursoragent@cursor.com>
…ffort The router's inputs are ModelRouterDeps (classifier, question, listModels, timeoutMs), which the resolver exposes directly; the logger is a separate argument. ReasoningEffort names the supported efforts once. Co-authored-by: Cursor <cursoragent@cursor.com>
prepareTurnExecution reads the routing config and builds the turn's ModelRouterDeps, which createTurnResolver receives as a dependency like web search and memory. Co-authored-by: Cursor <cursoragent@cursor.com>
public_cost is only set on filtered or sorted listings, which routing doesn't request. Cost entries need both prices as numbers. Co-authored-by: Cursor <cursoragent@cursor.com>
Routing asks only the category question. The routing log line says whether the task was cut from the middle (input_truncated). Co-authored-by: Cursor <cursoragent@cursor.com>
Route first and put the pick in request.model before resolving the definition; the routed effort is set on modelParams without conditional spreads. Co-authored-by: Cursor <cursoragent@cursor.com>
…ting timeout listRoutingCandidates is required; SQLite and Postgres return no candidates. RoutableModel uses name and cost. The router and its config no longer have a timeout. Co-authored-by: Cursor <cursoragent@cursor.com>
The gateway ignores the chat-only headers on decision requests, so withGatewayMetadata is dropped and OpenAIDecisionModel uses buildOutboundRequestHeaders. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
heerambavi1998
approved these changes
Nov 19, 2026
listModels takes include_catalog_info and returns CatalogModel, which adds canonical_model and cost (TypeScript only; the public schema is unchanged). listRoutingCandidates is removed. Co-authored-by: Cursor <cursoragent@cursor.com>
…ssage Our image part schema accepts the SDK's 'original' detail, so the SDK type is assignable again. The published OpenAPI spec is unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
4 of 5 tasks
The store's listModels now returns AvailableModelWithCatalogInfo, which extends AvailableModel and RoutableModel, so listModels passes straight into the router and the field-copying map in turns.ts is gone. The TypeScript-only type replaces CatalogModel; the public schema is unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
Object.hasOwn does not narrow the classifier's string, so the router asserted RoutingCategory. isRoutingCategory is the same membership check and narrows the value for selectModel. Co-authored-by: Cursor <cursoragent@cursor.com>
Rename classificationRequest's `truncated` to `isTruncated` and the `include_catalog_info` list option to `has_catalog_info`. The `input_truncated` log key is unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c8e73f4. Configure here.
This branch has not been deployed
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.

core/modelRouting/): a decision model (Jev) classifies a thread's task asdirect,fixed_stepsoradaptive, andcreateModelRouterpicks the cheapest model and effort pair in that cluster that the user has, by gateway token price. The router never throws and returns nothing when it can't pick, so the caller keeps its own model.IDecisionModeland the question is data (classification.tsbuilds the request and reads the answer); each route takes only the thread id, the task (text or messages, long text cut from the middle) and a signal, so root auto mode can reuse it.IDecisionModelandOpenAIDecisionModelon theopenaiSDK's Decisions API (openaibumped to 7.57), withx-tfy-metadataon decision calls.SessionHandleroutes a subagent spawned without a model and runs it at the routed effort, viaITurnResourceResolver.modelRouting.TRUEFOUNDRY_MODEL_ROUTINGturns routing on per tenant (off by default), andlistRoutingCandidates()lists the tenant's models with their canonical id and price.AGE-2842
Note
Medium Risk
Changes which LLM and effort subagents run on and adds a pre-spawn decision-model call; failures are non-blocking but mis-routing could affect quality or cost.
Overview
Adds optional subagent model routing (off by default) gated by per-tenant
TRUEFOUNDRY_MODEL_ROUTINGin TrueFoundry mode.Core introduces
IDecisionModel/OpenAIDecisionModel(OpenAI SDK bumped to 7.57 for the Decisions API), pluscreateModelRouter: a classifier assigns each delegated task todirect,fixed_steps, oradaptive, then picks the cheapest available model + reasoning effort from predefined clusters using gateway canonical ids and blended token cost. Routing never throws—on failure the subagent keeps its requested model.Harness wiring:
ITurnResourceResolver.modelRoutingfeeds dynamic sub-agent creation inSessionHandle, which classifiesname+ task text and applies routedmodelandreasoning_effortbeforeresolveAgentDefinition.Server:
turnModelRoutingresolves the tenant’s decision model and lists routable models withhas_catalog_info; TrueFoundry’s model store surfacescanonicalModel/costfrom gateway metadata and allows decision models by name without listing them in the chat model picker.Reviewed by Cursor Bugbot for commit c8e73f4. Bugbot is set up for automated code reviews on this repo. Configure here.