Agents

Budget Pre-Flight

When the assembled context exceeds the token budget (maxContextTokensmaxOutputTokens), Open Astra automatically trims tool schema descriptions before calling the model. This prevents silent truncation mid-inference and keeps the context within budget.

How It Works

  • Calculated as: overBudget = estimatedTokens + maxOutputTokens - tokenBudget
  • If overBudget > 0 and tool schemas exist, trimToolSchemas() is called
  • Descriptions are shortened to 80 characters, freeing ~(original_length − 80) / 4 tokens per schema
  • The agent proceeds with trimmed schemas; full schemas are restored next turn

Config

yaml
agents:
  my-agent:
    model:
      maxContextTokens: 200000
      maxOutputTokens: 4000
Budget pre-flight is automatic — no config required. Set maxContextTokens accurately for your model to get the best results.