autonomous agent loop with think-act-criticize cycle
Implements a continuous execution loop where the agent generates thoughts via LLM, selects and executes commands, processes observations, and optionally applies self-criticism to refine behavior. The loop maintains state across iterations through a MiniAGI orchestrator class that coordinates ThinkGPT instances for reasoning and action generation, enabling multi-step task decomposition without external orchestration frameworks.
Unique: Uses a dual-ThinkGPT architecture where one instance generates agent actions and the other independently summarizes history, decoupling reasoning from memory compression and allowing different model configurations (e.g., GPT-4 for agent, GPT-3.5-turbo for summarizer) to optimize cost-performance tradeoffs.
vs alternatives: Lighter and more transparent than AutoGPT or BabyAGI because the entire loop is implemented in ~500 lines of Python with explicit state management, making it easier to understand, modify, and debug compared to framework-based alternatives.
context-aware memory summarization with token budgeting
Maintains a summarized_history buffer that condenses lengthy observations and action sequences to stay within a configurable MAX_CONTEXT_SIZE token limit. When observations exceed MAX_MEMORY_ITEM_SIZE, the summarizer ThinkGPT instance compresses them; when total history grows, older items are summarized and replaced. This approach preserves semantic meaning of past actions while freeing tokens for new reasoning, implemented via explicit summarization calls rather than sliding-window or retrieval-based approaches.
Unique: Implements a two-tier memory system where individual observations are summarized when they exceed MAX_MEMORY_ITEM_SIZE, and the entire history is re-summarized when approaching MAX_CONTEXT_SIZE, creating a cascading compression strategy that avoids sudden context drops.
vs alternatives: More explicit and controllable than RAG-based memory systems (e.g., LangChain's ConversationSummaryMemory) because token budgets are hard-coded and summarization is deterministic, making behavior predictable for cost-sensitive applications.
objective-driven task decomposition via llm reasoning
The agent is initialized with a user-provided objective (goal) and uses the think-act-criticize loop to decompose it into sub-tasks and execute them sequentially. The LLM reasons about what steps are needed to achieve the objective, selects appropriate commands, and iterates until the objective is complete (signaled by the done command). This approach enables flexible, adaptive task decomposition without requiring explicit task graphs or workflows.
Unique: Implements task decomposition implicitly through LLM reasoning rather than explicitly generating a task graph, allowing the agent to adapt its plan based on observations but making the overall strategy opaque to external observers.
vs alternatives: More flexible than predefined workflows because the agent can adapt its approach based on observations, but less transparent and potentially less efficient than explicit task planning systems.
docker containerization for isolated execution
MiniAGI can be deployed in a Docker container with environment variables and dependencies pre-configured. The Dockerfile specifies Python runtime, dependency installation, and entry point configuration, enabling reproducible agent execution across different environments. This provides OS-level isolation and dependency management without requiring manual setup.
Unique: Provides a pre-configured Docker setup that bundles the agent, dependencies, and runtime configuration, enabling one-command deployment without manual environment setup.
vs alternatives: Simpler than manual deployment because dependencies are pre-installed, but adds operational overhead compared to running the agent directly on the host system.
multi-command execution engine with python, shell, and web search
Provides a Commands class that exposes six executable actions: execute_python (runs arbitrary Python code in the agent's process), execute_shell (runs bash/shell commands), web_search (queries the web for information), talk_to_user (prompts for human input), ingest_data (loads files or URLs), and process_data (applies LLM-based transformation to data). The agent selects which command to execute based on LLM reasoning, and each command returns structured observations that feed back into the reasoning loop.
Unique: Integrates Python code execution directly into the agent loop without requiring separate sandboxing or containerization, allowing the agent to leverage the full Python ecosystem (numpy, pandas, requests, etc.) for data processing and computation within a single process.
vs alternatives: More flexible than tool-calling APIs (OpenAI functions, Anthropic tools) because it allows arbitrary Python code execution rather than predefined schemas, but trades safety and reproducibility for expressiveness.
llm-driven action selection with structured command parsing
The agent's think() method prompts the LLM to generate a thought, proposed_command, and proposed_arg in a structured format. The LLM output is parsed to extract the command name and argument, which are then validated against the Commands registry and executed. This approach uses the LLM as a decision-making engine that reasons about which action to take next, rather than using predefined workflows or decision trees.
Unique: Uses the LLM as a stateful decision engine that maintains context across multiple steps, allowing it to reason about the current state and select actions adaptively, rather than using a fixed decision tree or rule-based system.
vs alternatives: More flexible than ReAct-style agents because it doesn't require predefined tool schemas; the agent can reason about any command in the Commands registry without explicit tool definitions, but less robust than schema-validated function calling.
optional self-criticism mechanism for behavior refinement
When ENABLE_CRITIC is set to true, the agent generates a criticism of its proposed action before execution, allowing it to reflect on whether the action is appropriate. The criticism is stored and can inform future decisions. This is implemented as an optional post-thinking step that calls the agent ThinkGPT instance again to evaluate the proposed command, adding an extra LLM call per step.
Unique: Implements self-criticism as an optional post-thinking step that evaluates the proposed action before execution, creating a two-stage reasoning process where the agent first decides what to do, then critiques its own decision.
vs alternatives: Simpler than multi-agent debate systems (e.g., LLM-based consensus) because it uses a single agent instance for both reasoning and criticism, reducing complexity and cost, but less robust because the agent may not effectively critique its own flawed reasoning.
user approval gating with interactive prompts
When PROMPT_USER is enabled (default true), the agent pauses before executing each command and prompts the user for approval via stdin. The user can approve the action, provide feedback, or reject it. This implements a human-in-the-loop mechanism that prevents the agent from executing unintended or dangerous commands without explicit authorization.
Unique: Implements approval gating at the command execution level rather than at the planning level, meaning the agent completes its reasoning and selects an action before asking for approval, allowing humans to see the agent's full reasoning before deciding whether to allow execution.
vs alternatives: More transparent than silent autonomous execution because it exposes the agent's decisions to human review, but less efficient than fully autonomous agents because it introduces latency and requires human availability.
+4 more capabilities