From 5b975a3884a929c449d9567c2730f6abe3f1155b Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 20:20:07 +0000 Subject: [PATCH 1/7] =?UTF-8?q?feat(spec):=20an=20agent's=20model=20name?= =?UTF-8?q?=20becomes=20optional=20=E2=80=94=20absent=20means=20the=20envi?= =?UTF-8?q?ronment=20default?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude-Session: https://claude.ai/code/session_01Q4EjjQgJ62YaG4EAxNLuqP Co-authored-by: Claude --- packages/spec/src/ai/agent.test.ts | 34 ++++++++++++++++++++++++++++++ packages/spec/src/ai/agent.zod.ts | 6 +++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/packages/spec/src/ai/agent.test.ts b/packages/spec/src/ai/agent.test.ts index f1d3a0aeb81..d5ea7259efc 100644 --- a/packages/spec/src/ai/agent.test.ts +++ b/packages/spec/src/ai/agent.test.ts @@ -48,6 +48,40 @@ describe('AIModelConfigSchema', () => { expect(() => AIModelConfigSchema.parse(config)).not.toThrow(); }); + it('accepts a config that omits the model name — absent means the environment default', () => { + const result = AIModelConfigSchema.parse({ temperature: 0.2 }); + expect(result.model).toBeUndefined(); + expect(result.temperature).toBe(0.2); + expect(result.provider).toBe('openai'); + expect(AIModelConfigSchema.parse({}).model).toBeUndefined(); + }); + + it('keeps an explicit model name exactly as written', () => { + expect(AIModelConfigSchema.parse({ model: 'x' }).model).toBe('x'); + }); + + it('still refuses an unknown key in a config without a model name', () => { + const result = AIModelConfigSchema.safeParse({ temperature: 0.2, tier: 'fast' }); + expect(result.success).toBe(false); + expect(result.error?.issues.some((i) => i.code === 'unrecognized_keys')).toBe(true); + }); + + it('still refuses a non-string model name', () => { + expect(AIModelConfigSchema.safeParse({ model: 4 }).success).toBe(false); + }); + + it('an agent whose model block only sets temperature parses', () => { + const agent = AgentSchema.parse({ + name: 'ask_helper', + label: 'Ask Helper', + role: 'Helper', + instructions: 'Answer questions.', + model: { temperature: 0.2 }, + }); + expect(agent.model?.model).toBeUndefined(); + expect(agent.model?.temperature).toBe(0.2); + }); + it('should enforce temperature constraints', () => { expect(() => AIModelConfigSchema.parse({ model: 'gpt-4', diff --git a/packages/spec/src/ai/agent.zod.ts b/packages/spec/src/ai/agent.zod.ts index 7c76bf180f6..111b69c56d9 100644 --- a/packages/spec/src/ai/agent.zod.ts +++ b/packages/spec/src/ai/agent.zod.ts @@ -35,7 +35,11 @@ export const AIModelConfigSchema = lazySchema(() => strictObject({ }, }, { provider: z.enum(['openai', 'azure_openai', 'anthropic', 'local']).default('openai'), - model: z.string().describe('Model name (e.g. gpt-4, claude-3-opus)'), + model: z.string().optional().describe( + 'Model name (e.g. gpt-4, claude-3-opus). Optional: when absent, the agent runs on the ' + + 'host\'s default model for this environment, so an agent that only tunes sampling ' + + '(e.g. `temperature`) need not name a model.', + ), temperature: z.number().min(0).max(2).default(0.7), maxTokens: z.number().optional(), topP: z.number().optional(), From 801abf9ad1904ed47e6a17cfd5b3d9e371c734c3 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 20:23:28 +0000 Subject: [PATCH 2/7] docs(spec): regenerate agent reference for the optional model name Claude-Session: https://claude.ai/code/session_01Q4EjjQgJ62YaG4EAxNLuqP Co-authored-by: Claude --- content/docs/references/ai/agent.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/docs/references/ai/agent.mdx b/content/docs/references/ai/agent.mdx index 05ef096cfd5..69c1a09ab78 100644 --- a/content/docs/references/ai/agent.mdx +++ b/content/docs/references/ai/agent.mdx @@ -29,7 +29,7 @@ const result = AIModelConfigSchema.parse(data); | Property | Type | Required | Description | | :--- | :--- | :--- | :--- | | **provider** | `Enum<'openai' \| 'azure_openai' \| 'anthropic' \| 'local'>` | optional (default: `"openai"`) | | -| **model** | `string` | ✅ | Model name (e.g. gpt-4, claude-3-opus) | +| **model** | `string` | optional | Model name (e.g. gpt-4, claude-3-opus). Optional: when absent, the agent runs on the host's default model for this environment, so an agent that only tunes sampling (e.g. `temperature`) need not name a model. | | **temperature** | `number` | optional (default: `0.7`) | | | **maxTokens** | `number` | optional | | | **topP** | `number` | optional | | @@ -48,7 +48,7 @@ const result = AIModelConfigSchema.parse(data); | **avatar** | `string` | optional | | | **role** | `string` | ✅ | The persona/role (e.g. "Senior Support Engineer") | | **instructions** | `string` | ✅ | System Prompt / Prime Directives | -| **model** | `{ provider?: Enum<'openai' \| 'azure_openai' \| 'anthropic' \| 'local'>; model: string; temperature?: number; maxTokens?: number; … }` | optional | | +| **model** | `{ provider?: Enum<'openai' \| 'azure_openai' \| 'anthropic' \| 'local'>; model?: string; temperature?: number; maxTokens?: number; … }` | optional | | | **lifecycle** | `never` | optional | [REMOVED] `agent.lifecycle` was removed in @objectstack/spec 17.7.0 (ADR-0049 enforce-or-remove) — no runtime ever read it: no agent moved through a declared state and no transition was ever refused. Delete the key. A phase of a conversation is a skill with its own `instructions` and `tools`, selected by its `triggerConditions` (ADR-0064); multi-step process orchestration is a Flow (ADR-0019); a record's status transitions are a `state_machine` validation rule on the object (ADR-0020). Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **surface** | `Enum<'ask' \| 'build'>` | optional (default: `"ask"`) | Product surface this agent binds ('ask' \| 'build') — ADR-0063 §1 | | **skills** | `string[]` | optional | Skill names to attach (Agent→Skill→Tool architecture) | @@ -73,7 +73,7 @@ const result = AIModelConfigSchema.parse(data); | Property | Type | Required | Description | | :--- | :--- | :--- | :--- | | **provider** | `Enum<'openai' \| 'azure_openai' \| 'anthropic' \| 'local'>` | optional (default: `"openai"`) | | -| **model** | `string` | ✅ | Model name (e.g. gpt-4, claude-3-opus) | +| **model** | `string` | optional | Model name (e.g. gpt-4, claude-3-opus). Optional: when absent, the agent runs on the host's default model for this environment, so an agent that only tunes sampling (e.g. `temperature`) need not name a model. | | **temperature** | `number` | optional (default: `0.7`) | | | **maxTokens** | `number` | optional | | | **topP** | `number` | optional | | From 41516d1bf195090e78b1edee04892d581eb1b3de Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 20:24:37 +0000 Subject: [PATCH 3/7] chore(changeset): spec minor for the optional agent model name Claude-Session: https://claude.ai/code/session_01Q4EjjQgJ62YaG4EAxNLuqP Co-authored-by: Claude --- .changeset/37686-agent-model-name-optional.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .changeset/37686-agent-model-name-optional.md diff --git a/.changeset/37686-agent-model-name-optional.md b/.changeset/37686-agent-model-name-optional.md new file mode 100644 index 00000000000..a2e85bb1d4a --- /dev/null +++ b/.changeset/37686-agent-model-name-optional.md @@ -0,0 +1,15 @@ +--- +'@objectstack/spec': minor +--- + +feat(spec): an agent's model name is optional — absent means the host's default model for the environment + +Clause-②: no +Metadata-protocol: added +Skills-docs: follow-up owed — skills/objectstack-ai/SKILL.md, skills/objectstack-ai/evals/skills-tools-knowledge.json + +`AIModelConfigSchema.model` (the `model` key inside an agent's `model` block) is now optional. An agent that only tunes sampling can write `model: { temperature: 0.2 }` without naming a model; the host then runs it on its default model for the environment. Before, the block refused a missing `model`, so such an agent had to invent a model name it did not mean. + +Unchanged: an explicit `model: { model: 'gpt-4o' }` parses and is carried as written; the block is still strict, so an unknown key is refused; `provider` still defaults to `openai` and `temperature` to `0.7`. There is no sentinel value and no tier key. + +What to do: nothing for existing agents. Code that reads `agent.model.model` gets `string | undefined` from the `Agent` type now and treats `undefined` as "use the host's default model". From d36940ae4ba86aac90b8223334d50290e21a1dbd Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 21:04:32 +0000 Subject: [PATCH 4/7] chore(changeset): declare the optional model name as a widening Claude-Session: https://claude.ai/code/session_01Q4EjjQgJ62YaG4EAxNLuqP Co-authored-by: Claude --- .changeset/37686-agent-model-name-optional.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/37686-agent-model-name-optional.md b/.changeset/37686-agent-model-name-optional.md index a2e85bb1d4a..490d7a63656 100644 --- a/.changeset/37686-agent-model-name-optional.md +++ b/.changeset/37686-agent-model-name-optional.md @@ -4,7 +4,7 @@ feat(spec): an agent's model name is optional — absent means the host's default model for the environment -Clause-②: no +Clause-②: yes (widening) Metadata-protocol: added Skills-docs: follow-up owed — skills/objectstack-ai/SKILL.md, skills/objectstack-ai/evals/skills-tools-knowledge.json From 28097f5555f8dd0c6959dac22442cce7b9c866cc Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 22:25:28 +0000 Subject: [PATCH 5/7] feat(spec): an agent's model provider no longer defaults to openai Claude-Session: https://claude.ai/code/session_01Q4EjjQgJ62YaG4EAxNLuqP Co-authored-by: Claude --- packages/spec/src/ai/agent.test.ts | 11 +++++++++-- packages/spec/src/ai/agent.zod.ts | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/spec/src/ai/agent.test.ts b/packages/spec/src/ai/agent.test.ts index d5ea7259efc..9fa0ac27ff1 100644 --- a/packages/spec/src/ai/agent.test.ts +++ b/packages/spec/src/ai/agent.test.ts @@ -20,10 +20,17 @@ describe('AIModelConfigSchema', () => { }; const result = AIModelConfigSchema.parse(config); - expect(result.provider).toBe('openai'); + expect(result.provider).toBeUndefined(); expect(result.temperature).toBe(0.7); }); + it('adds no provider to a block that names none — the host picks the model and its provider', () => { + const result = AIModelConfigSchema.parse({ temperature: 0.2 }); + expect('provider' in result).toBe(false); + expect(AIModelConfigSchema.parse({ provider: 'anthropic' }).provider).toBe('anthropic'); + expect(AIModelConfigSchema.safeParse({ provider: 'google' }).success).toBe(false); + }); + it('should accept all providers', () => { const providers = ['openai', 'azure_openai', 'anthropic', 'local'] as const; @@ -52,7 +59,7 @@ describe('AIModelConfigSchema', () => { const result = AIModelConfigSchema.parse({ temperature: 0.2 }); expect(result.model).toBeUndefined(); expect(result.temperature).toBe(0.2); - expect(result.provider).toBe('openai'); + expect(result.provider).toBeUndefined(); expect(AIModelConfigSchema.parse({}).model).toBeUndefined(); }); diff --git a/packages/spec/src/ai/agent.zod.ts b/packages/spec/src/ai/agent.zod.ts index 111b69c56d9..2c97383f7f3 100644 --- a/packages/spec/src/ai/agent.zod.ts +++ b/packages/spec/src/ai/agent.zod.ts @@ -34,7 +34,7 @@ export const AIModelConfigSchema = lazySchema(() => strictObject({ top_p: 'topP', nucleus: 'topP', }, }, { - provider: z.enum(['openai', 'azure_openai', 'anthropic', 'local']).default('openai'), + provider: z.enum(['openai', 'azure_openai', 'anthropic', 'local']).optional(), model: z.string().optional().describe( 'Model name (e.g. gpt-4, claude-3-opus). Optional: when absent, the agent runs on the ' + 'host\'s default model for this environment, so an agent that only tunes sampling ' From db5f0e7de958b70b1e0102ba62b9077c8912d5a4 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 22:28:25 +0000 Subject: [PATCH 6/7] chore(spec): declare the provider default removal and regenerate its artefacts Claude-Session: https://claude.ai/code/session_01Q4EjjQgJ62YaG4EAxNLuqP Co-authored-by: Claude --- .changeset/37686-agent-model-name-optional.md | 12 +++++++----- content/docs/references/ai/agent.mdx | 4 ++-- packages/spec/authorable-defaults/ai.json | 1 - packages/spec/scripts/lib/default-changes.ts | 16 ++++++++++++++++ 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.changeset/37686-agent-model-name-optional.md b/.changeset/37686-agent-model-name-optional.md index 490d7a63656..104352e331d 100644 --- a/.changeset/37686-agent-model-name-optional.md +++ b/.changeset/37686-agent-model-name-optional.md @@ -2,14 +2,16 @@ '@objectstack/spec': minor --- -feat(spec): an agent's model name is optional — absent means the host's default model for the environment +feat(spec): an agent's model name is optional — absent means the host's default model for the environment; `provider` no longer defaults to `openai` Clause-②: yes (widening) -Metadata-protocol: added -Skills-docs: follow-up owed — skills/objectstack-ai/SKILL.md, skills/objectstack-ai/evals/skills-tools-knowledge.json +Metadata-protocol: semantic +Skills-docs: follow-up #37711 `AIModelConfigSchema.model` (the `model` key inside an agent's `model` block) is now optional. An agent that only tunes sampling can write `model: { temperature: 0.2 }` without naming a model; the host then runs it on its default model for the environment. Before, the block refused a missing `model`, so such an agent had to invent a model name it did not mean. -Unchanged: an explicit `model: { model: 'gpt-4o' }` parses and is carried as written; the block is still strict, so an unknown key is refused; `provider` still defaults to `openai` and `temperature` to `0.7`. There is no sentinel value and no tier key. +`AIModelConfigSchema.provider` loses its `openai` default. A block that names no model also names no provider, so the parse no longer stamps `provider: 'openai'` onto it — that would assert a provider for a model the host picks. The key and its enum are unchanged, and a written `provider` is carried as written. No runtime reads an agent's `model.provider`, so no deployed agent changes behaviour; what changes is the parsed value. -What to do: nothing for existing agents. Code that reads `agent.model.model` gets `string | undefined` from the `Agent` type now and treats `undefined` as "use the host's default model". +Unchanged: an explicit `model: { model: 'gpt-4o' }` parses and is carried as written; the block is still strict, so an unknown key is refused; `temperature` still defaults to `0.7`. There is no sentinel value and no tier key. + +What to do: nothing for existing agents. Code that reads `agent.model.model` gets `string | undefined` from the `Agent` type and treats `undefined` as "use the host's default model". Code that read `model.provider` from a parsed agent and relied on `openai` when the author wrote none now reads `undefined`; to keep `openai`, write `provider: 'openai'` in the agent. diff --git a/content/docs/references/ai/agent.mdx b/content/docs/references/ai/agent.mdx index 69c1a09ab78..76be187cd41 100644 --- a/content/docs/references/ai/agent.mdx +++ b/content/docs/references/ai/agent.mdx @@ -28,7 +28,7 @@ const result = AIModelConfigSchema.parse(data); | Property | Type | Required | Description | | :--- | :--- | :--- | :--- | -| **provider** | `Enum<'openai' \| 'azure_openai' \| 'anthropic' \| 'local'>` | optional (default: `"openai"`) | | +| **provider** | `Enum<'openai' \| 'azure_openai' \| 'anthropic' \| 'local'>` | optional | | | **model** | `string` | optional | Model name (e.g. gpt-4, claude-3-opus). Optional: when absent, the agent runs on the host's default model for this environment, so an agent that only tunes sampling (e.g. `temperature`) need not name a model. | | **temperature** | `number` | optional (default: `0.7`) | | | **maxTokens** | `number` | optional | | @@ -72,7 +72,7 @@ const result = AIModelConfigSchema.parse(data); | Property | Type | Required | Description | | :--- | :--- | :--- | :--- | -| **provider** | `Enum<'openai' \| 'azure_openai' \| 'anthropic' \| 'local'>` | optional (default: `"openai"`) | | +| **provider** | `Enum<'openai' \| 'azure_openai' \| 'anthropic' \| 'local'>` | optional | | | **model** | `string` | optional | Model name (e.g. gpt-4, claude-3-opus). Optional: when absent, the agent runs on the host's default model for this environment, so an agent that only tunes sampling (e.g. `temperature`) need not name a model. | | **temperature** | `number` | optional (default: `0.7`) | | | **maxTokens** | `number` | optional | | diff --git a/packages/spec/authorable-defaults/ai.json b/packages/spec/authorable-defaults/ai.json index b5c8f97d09a..0f02968e0d4 100644 --- a/packages/spec/authorable-defaults/ai.json +++ b/packages/spec/authorable-defaults/ai.json @@ -2,7 +2,6 @@ "description": "Ratchet of the DEFAULT VALUE of every authorable key in one category that has one (#4666) — what a metadata author gets when they omit the key, which for AI-authored metadata is most of the time. Sharded by category like authorable-surface/; the gate reads the whole authorable-defaults/ directory as ONE set. Each line is \": = \". Additions (a NEW key that ships with a default) are auto-recorded — commit the change. CHANGING, ADDING or REMOVING the default of a key that already existed is NOT auto-recorded: it silently alters the behaviour of already-deployed metadata, so it fails check:authorable-surface until it is declared in DEFAULT_CHANGES_BY_MAJOR (scripts/lib/default-changes.ts). Constraints are deliberately NOT recorded here — a tightened bound REJECTS a document loudly, which is a different and self-announcing class (maintainer ruling on #4666, direction B). See #4666, #4661.", "category": "ai", "defaults": [ - "ai/AIModelConfig:provider = \"openai\"", "ai/AIModelConfig:temperature = 0.7", "ai/Agent:active = true", "ai/Agent:surface = \"ask\"", diff --git a/packages/spec/scripts/lib/default-changes.ts b/packages/spec/scripts/lib/default-changes.ts index 4aa649575c2..c831504cf0b 100644 --- a/packages/spec/scripts/lib/default-changes.ts +++ b/packages/spec/scripts/lib/default-changes.ts @@ -798,4 +798,20 @@ export const DEFAULT_CHANGES_BY_MAJOR: Readonly Date: Thu, 26 Nov 2026 23:08:00 +0000 Subject: [PATCH 7/7] fix(app-shell): the agent preview shows the model name when the block names no provider Claude-Session: https://claude.ai/code/session_01Q4EjjQgJ62YaG4EAxNLuqP Co-authored-by: Claude --- .changeset/37686-agent-model-name-optional.md | 3 +++ .../metadata-admin/previews/AgentPreview.test.tsx | 12 ++++++++++++ .../views/metadata-admin/previews/AgentPreview.tsx | 4 +++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.changeset/37686-agent-model-name-optional.md b/.changeset/37686-agent-model-name-optional.md index 104352e331d..026c9727966 100644 --- a/.changeset/37686-agent-model-name-optional.md +++ b/.changeset/37686-agent-model-name-optional.md @@ -1,5 +1,6 @@ --- '@objectstack/spec': minor +'@object-ui/app-shell': patch --- feat(spec): an agent's model name is optional — absent means the host's default model for the environment; `provider` no longer defaults to `openai` @@ -14,4 +15,6 @@ Skills-docs: follow-up #37711 Unchanged: an explicit `model: { model: 'gpt-4o' }` parses and is carried as written; the block is still strict, so an unknown key is refused; `temperature` still defaults to `0.7`. There is no sentinel value and no tier key. +`@object-ui/app-shell`: the agent preview's model pill appears when the block names a model or a provider, and reads `PROVIDER · MODEL`, `MODEL` or `PROVIDER` from what is written. Before, it keyed on `provider` alone, so a block that named only a model showed no model at all. + What to do: nothing for existing agents. Code that reads `agent.model.model` gets `string | undefined` from the `Agent` type and treats `undefined` as "use the host's default model". Code that read `model.provider` from a parsed agent and relied on `openai` when the author wrote none now reads `undefined`; to keep `openai`, write `provider: 'openai'` in the agent. diff --git a/ui/packages/app-shell/src/views/metadata-admin/previews/AgentPreview.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/previews/AgentPreview.test.tsx index 4693478d631..6407090e94c 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/previews/AgentPreview.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/previews/AgentPreview.test.tsx @@ -75,6 +75,18 @@ describe('AgentPreview renders what a spec-valid agent declares', () => { expect(screen.getByText('You are a helpful sales assistant.')).toBeTruthy(); }); + it('shows the model name when the block names no provider', () => { + renderPreview({ ...VALID_DRAFT, model: { model: 'gpt-4o' } }); + expect(screen.getByText('gpt-4o')).toBeTruthy(); + expect(screen.queryByText(/openai/)).toBeNull(); + }); + + it('shows no model pill for a block that names neither, so the environment default is not given a name', () => { + renderPreview({ ...VALID_DRAFT, model: { temperature: 0.2 } }); + expect(screen.queryByText('gpt-4o')).toBeNull(); + expect(screen.queryByText(/openai/)).toBeNull(); + }); + it('says where tools come from, so the missing TOOLS block is not read as a gap', () => { renderPreview(VALID_DRAFT); expect(screen.getByText(/tools come from the attached skills/i)).toBeTruthy(); diff --git a/ui/packages/app-shell/src/views/metadata-admin/previews/AgentPreview.tsx b/ui/packages/app-shell/src/views/metadata-admin/previews/AgentPreview.tsx index 7043f23f2cd..0d68864c886 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/previews/AgentPreview.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/previews/AgentPreview.tsx @@ -153,7 +153,9 @@ export function AgentPreview({ name, draft, locale }: MetadataPreviewProps) { label={tr(active ? 'engine.agentPreview.active' : 'engine.agentPreview.disabled', locale)} tone={active ? 'green' : 'gray'} /> - {model.provider && } + {(model.provider || model.model) && ( + + )} {model.temperature != null && ( )}