Glean

Building an efficient harness for advanced enterprise work

Jul 8, 2026
Building an efficient harness for advanced enterprise work
SummaryAI, from the source post

This post details the re-architecture of Glean's agent harness to use 100% programmatic tool-calling via a Python runtime and tools SDK within an agent sandbox. This shift replaces standard tool calls with code execution, enabling complex orchestration (filtering, looping, branching) within a single script. Key design decisions include using the shell as the only directly exposed tool, exposing other capabilities via the tools SDK, and implementing a sandbox filesystem for intermediate outputs. Tool outputs are truncated in context, with full outputs written to disk. The harness uses search and progressive disclosure to manage tool discovery and context, appending search results to the end of the conversation to preserve prefix cache efficiency. This approach reduced token usage by 24% compared to the previous hybrid model.

More from the Agent Orchestration Platform trail