-
Notifications
You must be signed in to change notification settings - Fork 261
Open
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