How nvtam2105/openmanus works
Main Components
• Main Entrypoints:
– “main.py” and “run_flow.py” serve as the orchestration scripts that kick off the agent’s processes.
• Application Core (“app” Directory):
– Agent Module (app/agent): Contains various strategies such as “base”, “manus”, “planning”, “react”, “swe”, and “toolcall.” These submodules indicate that the agent follows different decision-making or behavioral strategies.
– Flow Module (app/flow): Likely manages the decision workflow with files such as “flow_factory.py” and “planning.py.” It coordinates high‑level planning flows.
– Prompt Module (app/prompt): Contains templates or methods for generating prompts (e.g., “manus”, “planning”, “swe”, “toolcall”) to interact with LLMs.
– Tool Module (app/tool): Offers a collection of tools that can be used by the agent. Each file (bash, browser_use_tool, create_chat_completion, file_saver, google_search, python_execute, etc.) represents an external functionality that the agent might call to extend its capabilities.
– Other Core Modules: “llm.py” to manage LLM integration, “config.py” for reading configuration settings, “exceptions.py” for error handling, “logger.py” for application logging, and “schema.py” likely for data schema definitions.
• Configuration & Deployment:
– The “config” directory contains configuration examples (config.toml) which define global LLM settings (e.g., API keys, model configurations).
– There are several GitHub workflows, pre-commit hooks, and setup/build scripts (setup.py, requirements.txt) that support CI/CD and deployment.
Relationships and Interactions
• The Main Entrypoints (main.py, run_flow.py) initialize the application environment and load the configuration.
• The “app/config.py” reads the config (from a user‑provided config.toml) and shares runtime settings with all components.
• The Agent Module dispatches work among submodules: the “planning” and “react” files indicate that agents evaluate user input and choose an appropriate agent strategy.
• The Flow Module coordinates more complex workflows for sequential or conditional decisions—acting like an orchestrator for agent actions.
• The Prompt Module dynamically generates the prompts sent to the LLM, leveraging prepared templates.
• The LLM Module (“llm.py”), in combination with the configuration settings, interacts with an external LLM API (like OpenAI’s API) to process text and generate responses.
• The Tool Module includes integrations for calling external tools (e.g., executing bash commands, performing a Google search, running python code, etc.) whenever the agent decides that an external action is needed.
• Logging and exception handling are essential cross‑cutting concerns managed by “app/logger.py” and “app/exceptions.py.”
Architectural Patterns and Design Principles
• Modular Design: The clear separation into agent, flow, prompt, and tool modules points to a modular architecture, where each component handles a specific responsibility.
• Extensibility: With separate “tool” and “prompt” modules, it’s easy to plug in new functionalities and handle new types of tasks.
• Configuration Driven: The use of toml configuration files suggests a design that externalizes environment and API-specific settings.
Relevant Technologies and Frameworks
• Python – the primary language, with dependency management via pip or uv.
• LLM APIs – external calls defined in “config/config.example.toml.”
• Community and CI/CD tools – evidenced by GitHub workflows, pre-commit hooks, and similar automation scripts.
• Modular architecture may also indicate using patterns similar to MVC where “agent” functionality encapsulates business logic and “flow” or “prompt” generation corresponds to the controller side.
Instructing the Principal Software Engineer
– Agent Module (with subcomponents: planning, react, toolcall, etc.)
– Flow Module (orchestrating agent tasks)
– Prompt Module (delegating prompt templates for LLM calls)
– Tool Module (multiple tool integrations)
– LLM Integration (showing configuration-driven API calls)
• A configuration block showing how API keys and model settings are loaded and shared.
– How the main application initializes the configuration and passes input to the agent module.
– The decision path from agent selection (planning or reaction) to tool calls or LLM queries.
– The feedback loop from LLM responses back into agent logic.
Happy Diagramming!