OpenSage: Self-programming Agent Generation Engine

Hongwei Li, Zhun Wang, Qinrun Dai, Yuzhou Nie, Jinjun Peng, Ruitong Liu, Jingyang Zhang, Kaijie Zhu, Jingxuan He, Lun Wang, Yangruibo Ding, Yueqi Chen, Wenbo Guo, Dawn Song

Introduction

Building an AI agent today often mirrors the early days of machine learning, requiring extensive "feature engineering." Developers manually dictate an agent's topology (the number of sub-agents and their communication channels), its toolset (the functions it can execute), and its memory structure.

While Agent Development Kits (ADKs) have provided effective platforms for constructing these agents, their reliance on human-handcrafted designs introduces significant limitations:

  1. Scalability: Manually designing specialized agents for every conceivable task is practically impossible.
  2. Generalizability: A rigid structure optimized for code debugging may fail entirely when applied to DevOps orchestration.
  3. Context Bloat: When a single monolithic agent attempts to handle everything, its context window becomes cluttered with irrelevant tool descriptions and history, inevitably leading to hallucinations and errors.

To address these flaws, researchers propose OpenSage, the first ADK that shifts from a human-centered to an AI-centered paradigm. OpenSage functions as an engine that allows Large Language Models (LLMs) to autonomously create their own sub-agents, synthesize custom tools, and manage complex graph-based memory.

The OpenSage Framework

OpenSage introduces a "self-programming" architecture built upon three foundational pillars:

1. Self-Generating Topology

Instead of relying on a single monolithic agent, OpenSage equips a "parent" agent with a create_agent tool, allowing it to spawn specialized sub-agents at runtime. This dynamic topology can be organized vertically (breaking a complex task into a sequential chain of specialists) or horizontally (deploying multiple agents to attempt different plans and ensembling the results). This approach provides a minimal but essential scaffold, allowing agents to improve their own architectures as underlying LLMs become more capable.

2. Dynamic Tool Synthesis

Transitioning AI from a "tool user" to a "toolsmith" is a major leap in agent capabilities. If an OpenSage agent realizes it lacks a specific tool—such as a specialized fuzzer for a rare file format—it can write the code for that tool itself. OpenSage then registers this newly synthesized tool in a sandboxed Docker environment, making it immediately available for use.

3. Hierarchical Memory Management

Rather than relying on a simple, linear list of past messages, OpenSage implements a graph-based memory system powered by Neo4j. A dedicated Memory Agent manages this graph, handling database schemas and queries so the primary reasoning agent can remain focused on high-level goals using natural language. This system effectively stores both "short-term" execution history and "long-term" cross-task knowledge, enabling precise retrieval without drowning the model in excessive text.

Key Insights

  • Context Isolation Reduces Errors: A critical finding is that spawning sub-agents actually reduces errors. By providing a sub-agent with only the specific tools and context required for its sub-task, OpenSage prevents the "distraction" that frequently causes larger, monolithic models to fail.
  • Autonomous Tool Creation is Viable: In experimental settings, OpenSage successfully created 39 custom tools (e.g., grammar-aware fuzzers) that were not included in its original library, proving the viability of dynamic tool synthesis.

Empirical Evaluation

OpenSage (referred to as SageAgent in the results) was rigorously evaluated across high-skill benchmarks, consistently outperforming existing state-of-the-art (SOTA) frameworks.

Datasets

  • CyberGym: 1,507 real-world C/C++ vulnerabilities requiring proof-of-concept (PoC) exploits.
  • Terminal-Bench 2.0: 89 expert-curated tasks in containerized environments spanning software engineering, machine learning, and scientific computing.
  • DevOps-Gym: 705 tasks covering the full DevOps lifecycle (build, monitor, resolve).
  • SWE-Bench Pro: 266 Python-based software engineering issues.
  • LOCOMO: Utilized specifically to test long-term conversational memory.

Performance Highlights

  • CyberGym: Achieved a 60.2% resolved rate, surpassing Anthropic’s best agent (50.6%).
  • DevOps-Gym: Reached a 46.8% resolved rate. Notably, it was the only agent capable of solving complex end-to-end pipeline tasks where baseline models scored 0%.
  • SWE-Bench Pro: Resolved 59.0% of issues, representing a massive improvement over the "Agentless" baseline (9.4%).
  • Cost Efficiency: The AI-centered approach proved highly cost-effective. On Terminal-Bench 2.0, a collaborative setup using a strong planner (Gemini 3 Pro) alongside a cheaper executor (GPT-5 Mini) matched the performance of the strongest standalone models at a significantly lower cost.

Limitations and Future Work

While OpenSage pioneers a new paradigm in agent development, the authors acknowledge that the field is still in its early stages:

  • Model Capability Gap: Even top-tier models occasionally misuse advanced features, such as hallucinating non-existent tools or creating sub-agents with overly broad permissions.
  • Complexity Management: While sub-agents effectively isolate context, managing the communication overhead between dozens of dynamic agents introduces new system complexities.

Future Directions: The research team plans to extend OpenSage to support AI-generated parallel workflows, where agents autonomously determine their own dependencies. Additionally, they aim to integrate direct model training (such as RLHF) directly into the agent-building loop, further blurring the line between model training and agent architecture.

Summary updated

BibTeX
@inproceedings{li2026opensage,
  author = {Hongwei Li and Zhun Wang and Qinrun Dai and Yuzhou Nie and Jinjun Peng and Ruitong Liu and Jingyang Zhang and Kaijie Zhu and Jingxuan He and Lun Wang and Yangruibo Ding and Yueqi Chen and Wenbo Guo and Dawn Song},
  title = {{OpenSage: Self-programming Agent Generation Engine}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=6ml27Kec2C},
}
Figure