Skip to content

Error: string or blob too big: SQLITE_TOOBIG #546

@marcoaleixooliveira-tech

Description

_setStateInternal(state, source = "server") {
    this._state = state;
    this.sql`
    INSERT OR REPLACE INTO cf_agents_state (id, state)
    VALUES (${STATE_ROW_ID}, ${JSON.stringify(state)})
  `;
    this.sql`
    INSERT OR REPLACE INTO cf_agents_state (id, state)
    VALUES (${STATE_WAS_CHANGED}, ${JSON.stringify(true)})
  `;
    this.broadcast(
      JSON.stringify({
        state,
        type: "cf_agent_state"
        /* CF_AGENT_STATE */
      }),

I'm building an application that is heavily based on Agents SDK, but, we are constantly getting this for heavy users.
I know that this is related to the DO key/value limits, but, 2megabytes in 2025 is really hard to manage. A single user long conversation with a LLM will hit that ( with multiple tool call etc ), we are doing heavy optimizations ( we don't store base64, off course, just plan string/arrays ) but wan't to check with you if you have best practices around state, if we might need to migrate to Actors that you recently launched to break down cf_agent_state into multiple tables.

Not sure wdyt, just asking for some ideas :)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions