Zum Inhalt
HALOWERK

Agentenwerk

memory compact

Takes a message history and a character budget and returns a shortened history together with a full account of what it cost.

POST https://agent.halowerk.com/v1/memory-compact

Eingaben

Felder des veröffentlichten Eingabeschemas
FeldTypPflichtBeschreibung
messagesarrayJaThe conversation in order, oldest first.
budget_charsintegerJaCharacter budget for the sum of all returned message contents.
keep_last_nintegerNeinHow many of the most recent messages are protected.
keep_rolesarrayNeinRoles whose messages are protected.
duplicate_thresholdnumberNeinWord-overlap ratio from which a later message of the same role counts as a near-duplicate of an earlier one.
max_message_charsintegerNeinLength to which unprotected survivors are trimmed in the trim stage.
Vollständiges Eingabeschema anzeigen
{
  "type": "object",
  "required": [
    "messages",
    "budget_chars"
  ],
  "additionalProperties": false,
  "properties": {
    "messages": {
      "type": "array",
      "minItems": 2,
      "maxItems": 200,
      "description": "The conversation in order, oldest first.",
      "items": {
        "type": "object",
        "required": [
          "role",
          "content"
        ],
        "additionalProperties": false,
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "user",
              "assistant",
              "tool"
            ],
            "description": "Speaker role."
          },
          "content": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8000,
            "description": "Message text."
          },
          "id": {
            "type": "string",
            "maxLength": 128,
            "description": "Optional caller-side identifier, echoed unchanged."
          },
          "pin": {
            "type": "boolean",
            "default": false,
            "description": "If true this message is protected: never trimmed, never dropped."
          }
        }
      }
    },
    "budget_chars": {
      "type": "integer",
      "minimum": 100,
      "maximum": 400000,
      "description": "Character budget for the sum of all returned message contents."
    },
    "keep_last_n": {
      "type": "integer",
      "minimum": 0,
      "maximum": 50,
      "default": 5,
      "description": "How many of the most recent messages are protected."
    },
    "keep_roles": {
      "type": "array",
      "maxItems": 4,
      "default": [
        "system"
      ],
      "items": {
        "type": "string",
        "enum": [
          "system",
          "user",
          "assistant",
          "tool"
        ]
      },
      "description": "Roles whose messages are protected."
    },
    "duplicate_threshold": {
      "type": "number",
      "minimum": 0.5,
      "maximum": 1,
      "default": 0.9,
      "description": "Word-overlap ratio from which a later message of the same role counts as a near-duplicate of an earlier one."
    },
    "max_message_chars": {
      "type": "integer",
      "minimum": 80,
      "maximum": 4000,
      "default": 400,
      "description": "Length to which unprotected survivors are trimmed in the trim stage."
    }
  }
}

Originalschema öffnen

Veröffentlichtes Eingabebeispiel

{
  "messages": [
    {
      "role": "system",
      "content": "You are a logistics dispatcher. Always answer with the shipment id first."
    },
    {
      "role": "user",
      "content": "Where is shipment DE-4471? It left Hamburg on Monday morning and should reach Lyon by Thursday."
    },
    {
      "role": "assistant",
      "content": "DE-4471 is in transit and cleared the Strasbourg hub at 03:10. Estimated arrival in Lyon is Thursday 14:00."
    },
    {
      "role": "user",
      "content": "Where is shipment DE-4471? It left Hamburg on Monday morning and should reach Lyon by Thursday."
    },
    {
      "role": "assistant",
      "content": "DE-4471 is still on schedule, no new scan since Strasbourg."
    },
    {
      "role": "user",
      "content": "Good. Book the return leg for Friday."
    }
  ],
  "budget_chars": 400,
  "keep_last_n": 2,
  "keep_roles": [
    "system"
  ],
  "duplicate_threshold": 0.9,
  "max_message_chars": 120
}

Ergebnis & Dokumentation

Veröffentlichtes Ergebnisschema anzeigen
{
  "$ref": "https://agent.halowerk.com/v1/memory-compact/schema#/outputSchema"
}

Veröffentlichtes Ergebnisbeispiel öffnen

Maschinenlesbare Dokumentation dieses Hubs

Quelle dieser Seite: der veröffentlichte HALOWERK-Katalog. Stand: 2026-11-01, 15:19 UTC.

Weitere Endpunkte dieses Hubs

Alle Endpunkte dieses Hubs →