Skip to content

Existing instances stuck on a non-tool-capable model — #100 fix only covers NEW agents, and there's no way to change an instance's model #151

Closed

Description

@serge-ivo

The live residual behind the (correctly) closed #100. 2641bb0 fixed the root cause for newly created agents — but two gaps remain and together they strand every pre-fix instance:

  1. Pre-fix instances are frozen on 3B. An instance copies the model into its DO state at subscribe and never re-reads the template. So an instance created before 2641bb0 (e.g. the live lead-finder 933ebec5) is still on @cf/meta/llama-3.2-3b-instruct → useTools=false → its chat cannot call query_records and confabulates from prose. Reproduced 2026-08-02: asked for exact counts, it returned 106 / 89 (truth: 116 / 95) and said "I did not query a structured collection."
  2. No programmatic path to change an instance's model. get_instance_state is read-only; set_instance_settings only touches declared settings; update_agent changes the template, not existing instances (verified — the instance stayed 3B after the template flip). Only the console PUT /v1/instances/:id/state can do it. So the Non-tool-capable default model silently disables ALL tools — a structured-data agent can't query its own collection #100 fix can't be automated or applied to existing instances.

Ask

  • A path to set/upgrade an existing instance's model (MCP set_instance_model / a state-write tool, or a one-shot "re-sync from template" action).
  • Optionally: a migration/backfill to move pre-fix instances declaring tools off the non-tool-capable default.

Blocks the lead-finder chat today. Relates to closed #100, agent-repo #2.

Activity

  1. serge-ivo commented on Aug 3, 2026

    @serge-ivo
    ContributorAuthor

    Shipped the primary ask in d3b892c.

    New MCP tool set_instance_model — the programmatic path to change an existing instance's model (was only possible via the console PUT /v1/instances/:id/state). Write-scoped + audited; PUTs {model} to the instance /state route, which handleUpdateState already persists (state.model = updates.model). Its description lists the tool-capable CF models (@cf/meta/llama-4-scout-17b-16e-instruct etc.) and notes BYOK Anthropic. +3 tests (writes to /state, rejects empty, write-scope gated); MCP suite green (41).

    So an operator can now move a stuck instance (e.g. the lead-finder 933ebec5) onto a tool-capable model in one MCP call.

    On the functional symptom: the chat loop already upgrades a tool-declaring instance off a non-tool-capable model per turn at runtime (agent-think.ts resolveModelForTools, wired from #100), so a pre-fix instance's chat should call its tools rather than confabulate. set_instance_model is the durable operator escape hatch on top of that.

    The optional bulk backfill (ask #2) stays deferred — the per-turn upgrade covers the live behaviour and the tool covers the manual case; a migration touching every instance DO is heavier and can be filed separately if we want persisted (not per-turn) upgrades.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions