How aiplanethub/openagi works
Purpose and entry points
OpenAGI is a Python 3.9–3.11 framework for building autonomous or worker-based LLM agents. The main programmatic entry point is the Admin orchestrator, used with a planner, LLM adapter, optional memory, and action classes. Packaging and a CLI are rooted at pyproject.toml, src/openagi/__init__.py, and src/openagi/cli.py.
Admin orchestration
Admin is the top-level control boundary: callers configure it, optionally register specialized workers, then invoke run(query, description). It coordinates planning, execution, memory use, and result delivery for both manual multi-agent and autonomous modes.
• src/openagi/agent.py
• src/openagi/worker.py
• src/openagi/tasks/task.py
Planning and task lifecycle
A planner converts the requested outcome into executable tasks. The default task decomposer supports autonomous operation and human-intervention settings; alternative planning strategies include LATS and Reflexion. Task models and list management form the shared handoff between planning and workers.
• src/openagi/planner/task_decomposer.py
• src/openagi/planner/LATS.py
• src/openagi/tasks/lists.py
Worker execution boundary
Workers encapsulate a role, instructions, permitted actions, and iteration limits. In assigned-worker mode, Admin delegates planned tasks to these role-specific agents. In autonomous mode, the system can execute without predeclared workers, selecting available capabilities through the orchestration/planning path.
• src/openagi/worker.py
• src/openagi/agent.py
• src/openagi/prompts/worker_task_execution.py
LLM abstraction and providers
A provider-neutral LLM layer isolates orchestration and planners from model APIs. base.py defines the common contract; concrete adapters cover OpenAI, Gemini, Claude, Groq, Ollama, Azure, Cohere, Mistral, Hugging Face, xAI, Cerebras, and SambaNova. Runtime credentials and model settings are supplied through environment configuration.
• src/openagi/llms/base.py
• src/openagi/llms/openai.py
• src/openagi/llms/gemini.py
Actions and external integrations
Actions are the agent’s side-effect boundary. Common capabilities include console/file/human-input operations, output compression/formatting, and retrieval. Tool adapters integrate external search, content, document, and media services such as DuckDuckGo, Tavily, Google, GitHub, arXiv, PubMed, Reddit, DALL·E, and YouTube.
• src/openagi/actions/base.py
• src/openagi/actions/tools/ddg_search.py
• src/openagi/actions/tools/tavilyqasearch.py
Context, memory, and storage
Memory provides session and optional long-term context across runs. Long-term/vector storage is abstracted behind storage interfaces, with Chroma as the supplied backend; prompts include long-term-memory and summarization stages to manage context passed to LLMs.
• src/openagi/memory/memory.py
• src/openagi/memory/sessiondict.py
• src/openagi/storage/chroma.py
Primary flow
Application code constructs an LLM, planner, actions, optional memory, and optionally workers; it then calls Admin.run. Admin/planner clarifies and decomposes the request, tasks flow to workers or autonomous execution, workers invoke approved actions and LLMs, and outputs are summarized/formatted into the returned response. Human input is an explicit action/planner control point rather than an implicit UI dependency.
Main entry points: agent.py Admin · worker.py Worker · memory.py Memory · task_decomposer.py Task Decomposer
Components 18
Entry Points
- Application Code · Constructs framework components and calls Admin.run.
- CLI
src/openagi/cli.py
Orchestration
- Admin · Top-level boundary for planning, execution, memory, and responses.
src/openagi/agent.py - Task Model
src/openagi/tasks/task.py - Task Lists
src/openagi/tasks/lists.py - Returned Response · Summarized and formatted run output.
Execution
- Worker · Executes assigned tasks within role, action, and iteration constraints.
src/openagi/worker.py - Task Execution Prompt
src/openagi/prompts/worker_task_execution.py
Planning & Models
- Task Decomposer · Decomposes requests with autonomous and human-intervention settings.
src/openagi/planner/task_decomposer.py - LATS / Reflexion
src/openagi/planner/LATS.py - LLM Contract · Provider-neutral interface used by orchestration and planning.
src/openagi/llms/base.py - LLM Providers · Concrete adapters such as OpenAI and Gemini.
src/openagi/llms/openai.py
Context & Integrations
- Actions · Approved capabilities for agent execution.
src/openagi/actions/base.py - Search Tool Adapters · Connects retrieval providers such as DuckDuckGo and Tavily.
src/openagi/actions/tools/ddg_search.py - Human Input · Explicit intervention channel for planning or execution.
- Memory · Maintains session and optional long-term context.
src/openagi/memory/memory.py - Session Context
src/openagi/memory/sessiondict.py - Chroma Storage · Optional long-term storage backend.
src/openagi/storage/chroma.py
Connections 22
- Application Code → Admin: configures and runs
- CLI → Admin: invokes
- Admin → Task Decomposer: plans request
- Admin → LATS / Reflexion: may select
- Task Decomposer → Task Model: creates
- LATS / Reflexion → Task Model: creates
- Task Model → Task Lists: managed in
- Admin → Task Lists: coordinates
- Admin → Worker: delegates tasks
- Task Lists → Worker: supplies planned work
- Worker → Task Execution Prompt: uses
- Worker → Actions: invokes approved actions
- Worker → LLM Contract: requests reasoning
- Task Decomposer → LLM Contract: uses for planning
- LLM Contract → LLM Providers: implemented by
- Actions → Search Tool Adapters: includes adapters
- Actions → Human Input: can request
- Admin → Memory: reads and updates
- Memory → Session Context: maintains
- Memory → Chroma Storage: persists long-term context
- Worker → Memory: uses context
- Admin → Returned Response: returns formatted result