core 1 credit · ~$0.015 <50ms

Context Distiller

POST /v1/distill

Compresses a bloated conversation to a token budget using TF-IDF importance scoring. Always keeps the system prompt and the most recent turns, then fills the remaining budget with the highest-signal messages — up to about 80% smaller.

Capabilities

  • TF-IDF importance scoring
  • Preserves system prompt and recency
  • Deterministic, under 50ms
  • Optional LLMLingua-2 backend

Use cases

  • Long-running agents hitting context limits
  • Cutting token spend on repeated loops
  • Summarizing history before a model call
example
curl -X POST https://api.agent-toolbox.ai/v1/distill \
  -H "Content-Type: application/json" \
  -d '{"messages": [...], "tokenBudget": 2000}'
response shape
{
  "verdict": "PASS" | "FLAG" | "BLOCK",
  // tool-specific findings…
  "certificate": "sha256:..."
}