Skip to main content

addToAgentState

plugin.cbstate.addToAgentState(key: string, value: string): Promise<AddToAgentStateResponse>

Adds a key-value pair to the agent's state on the server via WebSocket.

Parameters

ParameterTypeRequiredDescription
keystringYesThe key to add to the agent's state.
valuestringYesThe value associated with the key.

Returns

Promise<AddToAgentStateResponse> — A promise that resolves with the response to the addition request.

Example

import plugin from '@codebolt/plugin-sdk';

const result = await plugin.cbstate.addToAgentState('key', 'value');
console.log(result);