Skip to main content

Function: toolLearningContextFor()

toolLearningContextFor(session, turn): object

Defined in: packages/agentos/src/cognition/learning/toolContext.ts:151

A turn's tool context (sessionData.learning) and the turn its recorded writes belong to, from a learner session and what it prepared for the turn. The GMI builds each turn's with it, and a product that runs its own turn loop puts the same on its tool calls. The recorder and the freeze read are bound to the turn and called on the session, each only where the session has it; the turn's conversation goes to the session row, so forgetUser deletes the conversation's thread.

Parameters​

session​

ILearnerSession

The learner session the turn was prepared by.

turn​

The turn's learner and mode, its scope ids where the session gives them, the explicit id of a second user on a turn with no learner, the turn's conversation id, and the ids its own thread is filed under where its memory names a session of its own (threadIds; the conversation id is then the first of them).

conversationId?​

string

learner​

"none" | "bound"

mode​

LearningMode

scopes?​

TurnScopes

threadIds?​

readonly string[]

turnUserId?​

string

Returns​

object

tools, what each tool call of the turn is told; writeTurn, what the session's recorder and guard are told about the turn, undefined when the turn has no scope ids.

tools​

tools: ToolLearningContext

writeTurn​

writeTurn: SelfChangeTurn | undefined