Abstract
TaskGen is an open-source agentic framework designed to optimize Large Language Model (LLM) performance through structured task decomposition and efficient memory management. By leveraging StrictJSON, a novel token-efficient parser, and a "need-to-know" memory architecture, TaskGen reduces latency and operational costs while improving reliability. Evaluation across diverse benchmarks, including dynamic maze navigation and complex mathematics, demonstrates that TaskGen achieves superior performance compared to existing free-form text-based agent frameworks.
Introduction
Building autonomous agents capable of executing multi-step, real-world tasks is a significant challenge in AI. Current frameworks often rely on verbose, free-form text outputs, which lead to high token costs, increased latency, and "context window bloat." This clutter often causes agents to lose track of primary objectives or fail in dynamic environments. TaskGen addresses these issues by introducing a leaner, more structured approach to agentic logic, focusing on reducing the hallucination surface area and optimizing memory usage through structured subtasks.
Methods
TaskGen's architecture is built on several key innovations designed to streamline the interaction between the LLM and its environment:
- StrictJSON Parsing: Unlike standard JSON schemas or Pydantic models that consume substantial tokens, TaskGen utilizes StrictJSON. This parser enforces structured data output with type checking and iterative error correction, significantly reducing schema-related overhead.
- Hierarchical Task Decomposition: A "Meta Agent" orchestrates the process by breaking complex tasks into manageable subtasks. These are then delegated to either "Equipped Functions" (Python scripts or API calls) or "Inner Agents" (specialized LLM instances).
- Need-to-Know Memory: To prevent context bloat, TaskGen distinguishes between "Subtasks Completed" (a concise history of actions) and "Shared Variables" (large data accessed only when explicitly necessary).
- Global Context & Memory Bank: A Global Context provides real-time environmental updates, while a RAG-based Memory Bank allows for the retrieval of relevant past experiences based on semantic similarity.
Key Insights: Structure and Efficiency
The core philosophy of TaskGen is that structure breeds efficiency. By constraining the LLM's output space to JSON, the framework reduces the "hallucination" surface area. Furthermore, treating agents as functions allows for a clean "manager-worker" hierarchy, where the Meta Agent focuses on high-level strategy while specialized Inner Agents handle technical details. This modularity, combined with aggressive memory pruning, ensures that the agent remains focused on the task at hand without being overwhelmed by its own internal monologue.
Results and Evaluation
The framework was evaluated across several challenging benchmarks to prove its versatility and efficiency:
- Dynamic Maze Navigation: TaskGen achieved a 100% solve rate in a 40x40 grid with shifting obstacles, significantly outperforming traditional Reinforcement Learning (RL) agents like PPO and A2C.
- MATH Dataset (Level-5): The framework achieved 71% accuracy on the hardest subset of competition-level math problems, compared to just 44% for a standard LLM baseline.
- TextWorld: TaskGen reached a 96% solve rate in dense-reward escape room scenarios.
- Token Efficiency: StrictJSON was shown to use only 58 tokens to define a schema that required 110 tokens in standard JSON Schema format—a 53% reduction in overhead.
Conclusion
TaskGen demonstrates that structural constraints and pruned memory are essential for building reliable, cost-effective AI agents. By moving away from verbose free-form text and toward structured subtasks, the framework achieves state-of-the-art results in complex reasoning and navigation tasks. While current limitations include planning complexity and potential memory bias, future work will focus on multi-modal support and advanced reflection mechanisms to further enhance agent autonomy.
Summary updated