上下文

概览

长跑后任何窗口都会长出。 引擎分两个阶段处理: 免费丢弃旧的工具结果, 然后再支付一个模型来总结 。

200 000 tokens by defaultclearing is freecompaction costs a turn
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

命令很重要。 清理是免费的, 损失的只有模型已经读懂的材料; 总结成本转折和损失细节。 最便宜的事情首先做就是为什么大部分跑不为昂贵的花费付钱。

这两阶段

阶段开始于费用损失
结算结果40 000个象征性,或一半的限量无下 内容内容内容内容 旧工具结果。 电话保持可见 。
压缩限额的80%一种模式转一个模式旧的那半对话的细节

上限

200 000 个象征性 默认情况下,不管模型本身的窗口是什么——一个慎重的选择,因为有用的限制是转弯仍然快速和负担得起,而不是提供者允许的。 contextTokens,直到模型的真正的窗口。

const agent = api.agents.create({
  runtime: "local", machine: pc, model: "gemini-3.5-flash",
  contextTokens: 400_000,       // a whole number, at least 10 000
});
agent = api.agents.create(
    runtime="local", machine=pc, model="gemini-3.5-flash",
    context_tokens=400_000,
)

看着它

每一 turn 时空天体包含提供者测量的大小、效力的限度和一个解析——因此接口中的测量仪显示实际占用房间的大小。

onEvent: (e) => {
  if (e.type !== "turn") return;
  console.log(e.contextTokens, "/", e.contextLimit);
  console.log(e.contextParts);   // { system, tools, memory, messages }
  console.log(e.cachedTokens, "served from cache");
  console.log(e.contextCleared, "results cleared so far");
}
def on_event(event):
    if event["type"] != "tool_end":
        return
    context = agent.context
    print(context["tokens"], "/", context["limit"])
    print(context["parts"])        # {"system", "tools", "memory", "messages"}
    print(context["cleared"], "results cleared so far")
测量总数,估计各部分

总数来自提供者,四部分是估算的,然后按比例计算,因此它们加起来是准确的——比例是正常的,单部分是接近的,而不是准确的。

附加附件自行退出

A A A PDF图像, 录音, 由 read 留在对话中 6 条信息。之后,它被一条线所取代,该线告诉模型它已经看到文件并可以读过它。媒体足够重,仅此就使许多文件都低于第一个门槛值。