OpenSaC: A Python Library for Search as Code in Deep Research Agents
Organizations: Renmin University of China Beijing, China · National University of Singapore Singapore, Singapore
Abstract
Deep research agents investigate complex questions through iterative search, source examination, and evidence synthesis. A conventional workflow alternates reasoning with individual search and reading actions. Search as Code introduces a new paradigm: agents write programs that compose search, source reading, reranking, model calls, and local processing, returning selected observations for further reasoning. To support this workflow in existing coding agents, we present OpenSaC, an open-source Python library with a companion Search as Code skill. Configurable capability interfaces let agents combine these operations while retaining evidence for inspection and reuse. Compared with standard Codex using its built-in web search, the OpenSaC configuration uses less execution time and fewer model tokens on BrowseComp and WideSearch, with higher accuracy on BrowseComp and slightly lower row F1 on WideSearch. We aim to lower the barrier to adopting Search as Code and provide an open foundation for community development and transparent research on deep research agents.
Figures & tables
| Method | Operation |
|---|---|
| search | Find and rank web pages |
| search.many | Run independent searches in a batch |
| content.fetch | Fetch text from a URL |
| content.fetch_many | Fetch text from multiple URLs |
| rerank | Reorder items by query relevance |
| llm.complete | Generate text from a prompt |
| Benchmark | Condition | Quality (%) | Time (s) | Tokens (k) | Cost ($) |
|---|---|---|---|---|---|
| BrowseComp | Native | 82.25 | 473.01 | 4102.9 | 0.14324 |
| OpenSaC | 85.21 | 329.59 | 2552.1 | 0.09117 | |
| WideSearch | Native | 60.62 | 767.01 | 5416.0 | 0.18631 |
| OpenSaC | 59.78 | 540.36 | 4667.0 | 0.16286 |
Agentic Search
Agentic Search studies language-model agents that iteratively retrieve, inspect, and verify information to answer complex queries.
See all 101 papers