Skip to main content
readonly state: AgentHarnessStatePort<State>

On the Agent Runtime

The runtime adapter builds the port from host, which carries the protected members of the Agent class.
  • get() calls getState(). Until a state is written, it returns initialState().
  • merge() calls setState(), which host carries as mergeState. The patch follows RFC 7396, so null deletes a key.
  • replace() calls replaceState(). Nothing of the previous state survives.
  • merge() and replace() run the class’s onStateChanged() after the write commits.

AgentHarnessStatePort

Existing persistent Agent state semantics. merge() and replace() include the Agent’s post-commit state-change hook. They may therefore reject after the new value is already persistent; callers must read state before deciding whether a rejected mutation can be retried. Type Parameters Methods get()
get(): Promise<State>
Returns Promise<State> merge()
merge(patch): Promise<State>
Parameters Returns Promise<State> replace()
replace(state): Promise<State>
Parameters Returns Promise<State>