How-toMulti-source

Arav Srinivas:把 Agent 循环类比操作系统内核,Code Mode 减少 context 膨胀

Why we picked it

Arav Srinivas 用 CPU、RAM、I/O 的类比讲清了为什么传统工具调用会撑爆 context。Code Mode 加 QuickJS 让循环和过滤在模型外跑,只有结果进 context。做 Agent 开发的人照这个思路改架构,token 开销能省不少。

Perplexity CEO Arav Srinivas 提出一个理解 Agent 架构的类比:把 LLM 当 CPU,context 当稀缺的 RAM,外部存储当磁盘,工具调用当 I/O。在这个框架下,传统的一次一个 JSON 工具调用相当于同步阻塞式 I/O,每次调用返回的原始字节都会被复制进 RAM,也就是直接挤占 context 窗口。

Body

他提出的改进方案是 Code Mode:在 Agent 循环中嵌入 QuickJS JavaScript 引擎,配合 exec_wait 机制,让确定性的循环和结果过滤在神经网络之外运行,原始状态保存在磁盘上,慢 I/O 以异步方式执行。这样 Agent 循环更接近一个真正的操作系统内核,只有必要结果进入 context。

这个思路与 Anthropic 等公司倡导的“代码即工具”方向一致:用代码执行替代多轮工具调用,核心收益是节省 token 和 context 空间。对构建多工具 Agent 的开发者来说,工具返回数据量越大,这个架构差异越明显。

Original · Aravind Srinivas

If you think of the LLM as the CPU, context as scarce RAM, disk as storage, and tools as I/O, one-by-one JSON tool calling is basically synchronous blocking I/O where every raw byte gets copied into RAM. Code Mode + embedded QuickJS + exec_wait moves the agent loop closer to an actual OS kernel: deterministic loops and filtering run outside the neural net, raw state sits on disk, and slow I/O runs asynchronously.📊 1 ⚡

Industry Coordinates & Source Verification

This report is categorized under AITOP's "How-to" desk, focusing on US frontier AI labs and Silicon Valley technology leaders. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include Code Mode, QuickJS, Agent, prompt engineering.

Source attribution: curated from Aravind Srinivas (@AravSrinivas). Cross-source corroboration: 11 independent sources have covered this development (including shao__meng, IT之家, Perplexity), confirming industry-wide signal strength.

Spotted an error in the summary or translation? Tell us