How simbianai/taskgen works
Project type and purpose
• Type: A Python library/open-source framework for creating “task-based” agents that orchestrate LLM calls, external functions, memory, shared variables, and global context.
• Purpose: To let users split complex tasks into subtasks, run them synchronously or in parallel, plug-in external or LLM-based functions, and maintain state across subtasks and sessions.
File structure
• Core package:
– taskgen/agent.py, base.py, base_async.py → Agent and AsyncAgent classes (entry points)
– taskgen/function.py → Function wrappers (sync & async)
– taskgen/memory.py → Memory module
– taskgen/utils.py, wrapper.py, ranker.py → Helpers, RAG over function space
• Configuration & packaging: setup.py, pyproject.toml, requirements.txt, build.sh
• Tutorials & docs: Jupyter notebooks, Paper/, resources/ → background, research, sample code
• contrib/community → Plug-in agents & functions (“HelpfulAssistant”, “MathExpert”)
Key insights from README
• Agents orchestrate subtasks using StrictJSON prompts → JSON format + type checking
• Support for:
– Sync/async task execution
– LLM-based functions vs. external Python functions
– Shared variables (multi-modality)
– Global context (persistent state)
– Retrieval-augmented generation over function space
– Community plugin upload/download
Main components
a. User application (scripts/Notebook)
b. TaskGen Library
• Agent Core (Agent / AsyncAgent)
• Task Splitter & Scheduler
• Function Manager
– LLM Functions (StrictJSON calls)
– External Functions (Python sync/async)
• Memory Store (subtasks_completed buffer)
• Shared Variables store
• Global Context layer
• RAG Retriever/Ranker
c. External services
• LLM Provider (OpenAI / other LLMs)
• Optional storage or community registry
Relationships & data flows
– The User App instantiates Agent, configures LLM & functions → calls run()
– Agent Core splits the main task → passes subtasks to Scheduler
– Scheduler dispatches each subtask either:
• to LLM Functions → via StrictJSON → to LLM Service → parse JSON → back to Agent
• or to External Functions → local Python calls
– Outputs feed into Memory Store & Shared Variables
– Global Context is prepended to prompts on each LLM call
– RAG Retriever can look up past functions/subtasks to augment prompts
– Final reply_user() assembles combined output back to User App
Architectural patterns & principles
• Modular layering: clear separation of Agent core, Function layer, and external services
• Plugin-friendly: external functions and community modules dynamically registered
• Async pattern: Agent and Function Manager support parallel tasks
• State management: explicit Memory and Shared Variables vs ephemeral local variables
• Prompt design: strict JSON enforcement for predictable parsing
Relevant technologies/frameworks
• Python 3.x, AsyncIO
• StrictJSON parser (core dependency)
• OpenAI/python-based LLM clients (synchronous & asynchronous)
• CI via GitHub Actions (.github/workflows/build.yaml)
• Packaging: setuptools (setup.py), Poetry/pyproject.toml
Detail level
– Include every “taskgen/” submodule at a high level (don’t drown in file-by-file detail; group related modules)
– Explicitly show the in-memory stores: subtasks_completed, shared_variables, global_context
– Call out the RAG module as a specialized retriever within the Function Manager