Letta · Schema

TurnTokenData

Token data for a single LLM generation turn in a multi-turn agent interaction. Used for RL training to track token IDs and logprobs across all LLM calls, not just the final one. Tool results are included so the client can tokenize them with loss_mask=0 (non-trainable).

AIAgentsStateful AgentsMemoryMemGPTContinual LearningMCPMulti-AgentRAGOpen Source

Properties

Name Type Description
role string Role of this turn: 'assistant' for LLM generations (trainable), 'tool' for tool results (non-trainable).
output_ids object Token IDs from SGLang native endpoint. Only present for assistant turns.
output_token_logprobs object Logprobs from SGLang: [[logprob, token_id, top_logprob_or_null], ...]. Only present for assistant turns.
content object Text content. For tool turns, client tokenizes this with loss_mask=0.
tool_name object Name of the tool called. Only present for tool turns.
View JSON Schema on GitHub

JSON Schema

letta-turntokendata-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/TurnTokenData",
  "title": "TurnTokenData",
  "properties": {
    "role": {
      "type": "string",
      "enum": [
        "assistant",
        "tool"
      ],
      "title": "Role",
      "description": "Role of this turn: 'assistant' for LLM generations (trainable), 'tool' for tool results (non-trainable)."
    },
    "output_ids": {
      "anyOf": [
        {
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Output Ids",
      "description": "Token IDs from SGLang native endpoint. Only present for assistant turns."
    },
    "output_token_logprobs": {
      "anyOf": [
        {
          "items": {
            "items": {},
            "type": "array"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Output Token Logprobs",
      "description": "Logprobs from SGLang: [[logprob, token_id, top_logprob_or_null], ...]. Only present for assistant turns."
    },
    "content": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Content",
      "description": "Text content. For tool turns, client tokenizes this with loss_mask=0."
    },
    "tool_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Tool Name",
      "description": "Name of the tool called. Only present for tool turns."
    }
  },
  "type": "object",
  "required": [
    "role"
  ],
  "description": "Token data for a single LLM generation turn in a multi-turn agent interaction.\n\nUsed for RL training to track token IDs and logprobs across all LLM calls,\nnot just the final one. Tool results are included so the client can tokenize\nthem with loss_mask=0 (non-trainable)."
}