### Install Dependencies and Run Development Server Source: https://github.com/simpleyyt/ai-manus/blob/main/frontend/README.md Install project dependencies using npm and start the development server. ```bash npm install npm run dev ``` -------------------------------- ### Run Mockserver Service Individually Source: https://github.com/simpleyyt/ai-manus/blob/main/AGENTS.md Starts the mock LLM server for development and testing purposes. Requires Python, pip, and uvicorn. Installs dependencies from requirements.txt. ```bash cd mockserver pip install -r requirements.txt uvicorn main:app --host 0.0.0.0 --port 8090 --reload ``` -------------------------------- ### Start Development Services Source: https://github.com/simpleyyt/ai-manus/blob/main/AGENTS.md Start all development services, including backend, frontend, and mockserver. ```bash ./dev.sh up -d ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Installs all development dependencies for the project using uv. Ensure uv is installed before running this command. ```bash uv sync --dev ``` -------------------------------- ### Run Frontend Service Individually Source: https://github.com/simpleyyt/ai-manus/blob/main/AGENTS.md Installs frontend dependencies and starts the Vite development server. Sets the backend URL for API requests. Requires Node.js and npm. ```bash cd frontend npm install BACKEND_URL=http://localhost:8000 npm run dev ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md After installing uv, use this command to install all project dependencies defined in the pyproject.toml file. ```bash uv sync ``` -------------------------------- ### Copy Environment Example File Source: https://github.com/simpleyyt/ai-manus/blob/main/README.md Copies the example environment file to a new file named '.env'. This file will be used to configure the application's environment variables. ```shell cp .env.example .env ``` -------------------------------- ### Start Development Environment with Docker Compose Source: https://github.com/simpleyyt/ai-manus/blob/main/AGENTS.md Quickly start the development environment including frontend, backend, sandbox, mockserver, MongoDB, and Redis. Ensure to copy and edit the .env file first, setting at least the API_KEY. ```bash cp .env.example .env # Edit .env — at minimum set API_KEY to any non-empty string ./dev.sh up -d ``` -------------------------------- ### Example MCP GitHub Server Configuration Source: https://github.com/simpleyyt/ai-manus/blob/main/docs/en/mcp.md An example mcp.json configuration for integrating with the GitHub API, specifying the command, transport, and environment variables. ```json { "mcpServers": { "github": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-github" ], "transport": "stdio", "enabled": true, "description": "GitHub API integration", "env": { "GITHUB_TOKEN": "your_github_token_here" } } } } ``` -------------------------------- ### Start Development Server Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Starts the FastAPI development server using uvicorn. This command reloads the server automatically on code changes. ```bash uv run uvicorn app.main:app --host 0.0.0.0 --port 8080 --reload ``` -------------------------------- ### Example .env File Configuration Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Provides an example of how to configure the sandbox service using environment variables in a .env file. These settings control CORS origins, service timeouts, and log levels. ```dotenv ORIGINS=http://localhost:3000,https://example.com SERVICE_TIMEOUT_MINUTES=60 LOG_LEVEL=DEBUG ``` -------------------------------- ### Install uv Package Manager Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Use this command to install the uv package manager, a fast Python package installer and resolver. ```bash pip install uv ``` -------------------------------- ### Example .env File for AI Manus Configuration Source: https://github.com/simpleyyt/ai-manus/blob/main/docs/en/quick_start.md This file provides example configurations for various services including models, databases, and search engines. Uncomment and modify lines to suit your environment. It's recommended for managing settings outside of docker-compose.yml. ```ini # Model provider configuration API_KEY= API_BASE=http://mockserver:8090/v1 # Model configuration MODEL_NAME=deepseek-chat TEMPERATURE=0.7 MAX_TOKENS=2000 # MongoDB configuration #MONGODB_URI=mongodb://mongodb:27017 #MONGODB_DATABASE=manus #MONGODB_USERNAME= #MONGODB_PASSWORD= # Redis configuration #REDIS_HOST=redis #REDIS_PORT=6379 #REDIS_DB=0 #REDIS_PASSWORD= # Sandbox configuration #SANDBOX_ADDRESS= SANDBOX_IMAGE=simpleyyt/manus-sandbox SANDBOX_NAME_PREFIX=sandbox SANDBOX_TTL_MINUTES=30 SANDBOX_NETWORK=manus-network #SANDBOX_CHROME_ARGS= #SANDBOX_HTTPS_PROXY= #SANDBOX_HTTP_PROXY= #SANDBOX_NO_PROXY= # Browser engine configuration # Options: playwright, browser_use (default) # - playwright: uses Playwright directly via CDP (stable, well-tested) # - browser_use: uses the browser_use library's BrowserSession via CDP # (richer DOM state extraction via AI-friendly selector map) #BROWSER_ENGINE=browser_use # Search engine configuration # Options: baidu, baidu_web, google, bing, bing_web, tavily # baidu: uses the Baidu Qianfan AI Search API (requires BAIDU_SEARCH_API_KEY) # baidu_web: scrapes Baidu search results with browser impersonation (no API key needed) # bing: uses the official Bing Web Search API (requires BING_SEARCH_API_KEY) # bing_web: scrapes Bing search results directly (no API key needed) SEARCH_PROVIDER=bing_web # Baidu search configuration, only used when SEARCH_PROVIDER=baidu # Get your API key from https://console.bce.baidu.com/qianfan/ais/console/onlineService #BAIDU_SEARCH_API_KEY= # Bing search configuration, only used when SEARCH_PROVIDER=bing # Get your API key from https://www.microsoft.com/en-us/bing/apis/bing-web-search-api #BING_SEARCH_API_KEY= # Google search configuration, only used when SEARCH_PROVIDER=google #GOOGLE_SEARCH_API_KEY= #GOOGLE_SEARCH_ENGINE_ID= ``` -------------------------------- ### Environment Variable Configuration Example Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Create a .env file and populate it with these environment variables to configure the service. This includes settings for model providers, LLM parameters, search APIs, sandbox environments, databases, and logging. ```bash # Model provider configuration API_KEY=your_api_key_here # API key for model providers API_BASE=https://api.openai.com/v1 # Base URL for model API (optional for some providers) # Model configuration MODEL_NAME=gpt-4o # Model name to use MODEL_PROVIDER=openai # Model provider for LangChain TEMPERATURE=0.7 # Model temperature parameter MAX_TOKENS=2000 # Maximum output tokens per model request # Google search configuration GOOGLE_SEARCH_API_KEY= # Google Search API key for web search functionality (optional) GOOGLE_SEARCH_ENGINE_ID= # Google custom search engine ID (optional) # Sandbox configuration SANDBOX_IMAGE=simpleyyt/manus-sandbox # Sandbox environment Docker image SANDBOX_NAME_PREFIX=sandbox # Sandbox container name prefix SANDBOX_TTL_MINUTES=30 # Sandbox container time-to-live (minutes) SANDBOX_NETWORK=manus-network # Docker network name for communication between sandbox containers # Database configuration MONGODB_URI=mongodb://localhost:27017 # MongoDB connection URL MONGODB_DATABASE=manus # MongoDB database name REDIS_HOST=localhost # Redis host REDIS_PORT=6379 # Redis port REDIS_DB=0 # Redis DB index # Log configuration LOG_LEVEL=INFO # Log level, options: DEBUG, INFO, WARNING, ERROR, CRITICAL ``` -------------------------------- ### Start AI Manus Services with Docker Compose Source: https://github.com/simpleyyt/ai-manus/blob/main/README.md Command to start all defined services in detached mode. Ensure the docker compose file is saved as 'docker-compose.yml' in the current directory. ```shell docker compose up -d ``` -------------------------------- ### Backend Python Dependencies Source: https://github.com/simpleyyt/ai-manus/blob/main/AGENTS.md Install backend dependencies using uv. Ensure you are in the backend directory. ```bash cd backend && uv sync ``` -------------------------------- ### Run Development Server Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Start the FastAPI development server with hot-reloading enabled for rapid development. The service will be accessible at http://localhost:8000. ```bash # Start the development server (with hot reload) uv run uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload ``` -------------------------------- ### SerpAPI Custom Search Configuration (GET) Source: https://github.com/simpleyyt/ai-manus/blob/main/docs/en/configuration.md Configure AI Manus to use SerpAPI as a custom search provider via GET requests. Requires a SerpAPI key and specifies the query parameter for authentication. ```env SEARCH_PROVIDER=custom SEARCH_API_URL=https://serpapi.com/search SEARCH_API_KEY=your-serpapi-key SEARCH_API_KEY_PARAM=api_key SEARCH_API_METHOD=GET SEARCH_RESULT_FIELD=organic_results ``` -------------------------------- ### Frontend TypeScript Dependencies Source: https://github.com/simpleyyt/ai-manus/blob/main/AGENTS.md Install frontend dependencies using npm. Ensure you are in the frontend directory. ```bash cd frontend && npm install ``` -------------------------------- ### Run Backend Service Individually Source: https://github.com/simpleyyt/ai-manus/blob/main/AGENTS.md Starts the FastAPI backend service with hot-reloading outside of Docker. Requires MongoDB and Redis to be running separately. Ensure the API_KEY environment variable is set. ```bash cd backend uv sync uv run uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload ``` -------------------------------- ### Brave Search API Custom Search Configuration (GET) Source: https://github.com/simpleyyt/ai-manus/blob/main/docs/en/configuration.md Configure AI Manus to use Brave Search API as a custom search provider via GET requests. Requires a Brave API key and specifies the header for authentication. ```env SEARCH_PROVIDER=custom SEARCH_API_URL=https://api.search.brave.com/res/v1/web/search SEARCH_API_KEY=your-brave-key SEARCH_API_KEY_HEADER=X-Subscription-Token SEARCH_API_KEY_HEADER_PREFIX= SEARCH_API_METHOD=GET SEARCH_RESULT_FIELD=web.results SEARCH_SNIPPET_FIELD=description ``` -------------------------------- ### Run AI Manus in Debug Mode Source: https://github.com/simpleyyt/ai-manus/blob/main/README.md Starts all services using the development Docker Compose file, enabling automatic code reloading for faster development cycles. This command is equivalent to 'docker compose -f docker-compose-development.yaml up'. ```shell ./dev.sh up ``` -------------------------------- ### Wait for Process Response Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Example JSON response indicating that a process has completed. It includes the session ID, return code, and final status. ```json { "success": true, "message": "Process completed, return code: 0", "data": { "session_id": "session_id", "returncode": 0, "status": "completed" } } ``` -------------------------------- ### Clone AI Manus Repository Source: https://github.com/simpleyyt/ai-manus/blob/main/README.md Clones the AI Manus project from GitHub and navigates into the project directory. This is the first step for local development setup. ```shell git clone https://github.com/simpleyyt/ai-manus.git cd ai-manus ``` -------------------------------- ### Docker Compose Configuration for MCP Source: https://github.com/simpleyyt/ai-manus/blob/main/docs/mcp.md Shows how to configure the MCP configuration file path within a Docker Compose setup for the AI Manus backend service. ```yaml ... services: backend: image: simpleyyt/manus-backend volumes: - ./mcp.json:/etc/mcp.json # 挂载 MCP 配置文件 - ... environment: # MCP 配置文件路径 - MCP_CONFIG_PATH=/etc/mcp.json ... ``` -------------------------------- ### Execute Shell Command Response Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Example JSON response after successfully executing a shell command. It includes the session ID, command executed, and its status. ```json { "success": true, "message": "Command executed", "data": { "session_id": "session_id", "command": "ls -la", "status": "running" } } ``` -------------------------------- ### Execute Shell Command Request Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Example JSON payload for executing a shell command. The 'id' is optional for creating a new session, and 'exec_dir' specifies the working directory. ```json { "id": "session_id", /* Optional, automatically created if not provided */ "exec_dir": "/path/to/dir", /* Optional, command execution working directory (must use absolute path) */ "command": "ls -la" /* Command to execute */ } ``` -------------------------------- ### Wait for Process Request Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Example JSON payload for waiting for a process in a shell session to complete. An optional 'seconds' parameter can limit the wait time. ```json { "id": "session_id", /* Target session ID */ "seconds": 10 /* Optional, wait time (seconds) */ } ``` -------------------------------- ### Get Session Response Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Response format for retrieving session information, including conversation history. ```json { "code": 0, "msg": "success", "data": { "session_id": "string", "title": "string", "events": [] } } ``` -------------------------------- ### View Shell Session Content Request Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Example JSON payload for viewing the content of a specific shell session. Requires the target session ID. ```json { "id": "session_id" /* Target session ID */ } ``` -------------------------------- ### Build Production Version Source: https://github.com/simpleyyt/ai-manus/blob/main/frontend/README.md Compile the project for production deployment. ```bash npm run build ``` -------------------------------- ### Build Docker Image Source: https://github.com/simpleyyt/ai-manus/blob/main/frontend/README.md Create a Docker image for the AI chatbot Vue application. ```bash docker build -t ai-chatbot-vue . ``` -------------------------------- ### GET /api/v1/supervisor/timeout/status Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Retrieves the current status of the timeout function. ```APIDOC ## GET /api/v1/supervisor/timeout/status ### Description Get the status of the timeout function. ### Method GET ### Endpoint /api/v1/supervisor/timeout/status ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **message** (string) - A message describing the current timeout status. - **data** (object) - Contains additional data about the timeout status. - **active** (boolean) - Indicates if the timeout function is currently active. - **timeout_timestamp** (string) - The timestamp when the timeout will occur if active. - **remaining_seconds** (integer) - The remaining time in seconds until the timeout occurs. #### Response Example ```json { "success": true, "message": "Remaining time: 45 minutes", "data": { "active": true, "timeout_timestamp": "2023-07-01T14:04:56", "remaining_seconds": 2700 } } ``` ``` -------------------------------- ### Get Process Status Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Retrieves the status of all service processes managed by the supervisor. ```APIDOC ## GET /api/v1/supervisor/status ### Description Get the status of all service processes. ### Method GET ### Endpoint /api/v1/supervisor/status ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful - **message** (string) - A message describing the result - **data** (array) - An array of service process statuses - **name** (string) - The name of the service - **status** (string) - The current status of the service (e.g., RUNNING) - **description** (string) - Additional details about the process (e.g., PID, uptime) #### Response Example ```json { "success": true, "message": "Services status retrieved successfully", "data": [ { "name": "chrome", "status": "RUNNING", "description": "pid 123, uptime 10:30:45" } ] } ``` ``` -------------------------------- ### Development Environment Variables Source: https://github.com/simpleyyt/ai-manus/blob/main/frontend/README.md Configure the backend API URL for development. Create a `.env.development` file in the project root. ```env VITE_API_URL=http://127.0.0.1:8000 ``` -------------------------------- ### Build Docker Image for Production Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Build the Docker image for the AI Manus × Claw backend service. This image can then be run as a container. ```bash # Build Docker image docker build -t manus-ai-agent . ``` -------------------------------- ### Get Session Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Retrieves session information, including conversation history, using the session ID. ```APIDOC ## GET /api/v1/sessions/{session_id} ### Description Get session information including conversation history. ### Method GET ### Endpoint /api/v1/sessions/{session_id} ### Parameters #### Path Parameters - **session_id** (string) - Required - The ID of the session to retrieve. ### Response #### Success Response (200) - **code** (integer) - 0 for success - **msg** (string) - "success" - **data** (object) - Contains session details - **session_id** (string) - The ID of the session. - **title** (string) - The title of the session. - **events** (array) - A list of conversation events. ### Response Example ```json { "code": 0, "msg": "success", "data": { "session_id": "string", "title": "string", "events": [] } } ``` ``` -------------------------------- ### VNC Connection Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Establishes a VNC WebSocket connection to the session's sandbox environment. ```APIDOC ## WebSocket /api/v1/sessions/{session_id}/vnc ### Description Establish a VNC WebSocket connection to the session's sandbox environment. ### Method WebSocket ### Endpoint /api/v1/sessions/{session_id}/vnc ### Parameters #### Path Parameters - **session_id** (string) - Required - The ID of the session. ### Protocol WebSocket (binary mode) ### Subprotocol `binary` ``` -------------------------------- ### View Backend Logs Source: https://github.com/simpleyyt/ai-manus/blob/main/AGENTS.md Follow the logs of the backend service for debugging purposes. ```bash ./dev.sh logs -f backend ``` -------------------------------- ### Run Docker Container Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Run the AI Manus × Claw backend service as a Docker container. Ensure to map the Docker socket and use an .env file for configuration. ```bash # Run container docker run -p 8000:8000 --env-file .env -v /var/run/docker.sock:/var/run/docker.sock manus-ai-agent ``` -------------------------------- ### Get Process Status Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Retrieves the status of all service processes managed by the supervisor. The response includes the name, status, and uptime for each service. ```json { "success": true, "message": "Services status retrieved successfully", "data": [ { "name": "chrome", "status": "RUNNING", "description": "pid 123, uptime 10:30:45" } ] } ``` -------------------------------- ### Build Docker Image Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Builds the Docker image for the manus-sandbox service. This command should be run from the root directory of the project. ```bash docker build -t manus-sandbox . ``` -------------------------------- ### Basic AI Manus Environment Configuration Source: https://github.com/simpleyyt/ai-manus/blob/main/README.md Minimum required environment variables for AI Manus. At a minimum, set your OpenAI API key. Refer to .env.example or the documentation for all options. ```ini API_KEY=sk-xxxx API_BASE=https://api.openai.com/v1 MODEL_NAME=gpt-4o ``` -------------------------------- ### Build and Push AI Manus Docker Images Source: https://github.com/simpleyyt/ai-manus/blob/main/README.md Commands to build and push Docker images for AI Manus. Set the IMAGE_REGISTRY and IMAGE_TAG environment variables before running these commands. ```shell export IMAGE_REGISTRY=your-registry-url export IMAGE_TAG=latest # Build images ./run build # Push to the corresponding image repository ./run push ``` -------------------------------- ### Frontend TypeScript Type Check and Build Source: https://github.com/simpleyyt/ai-manus/blob/main/AGENTS.md Perform type checking and build the frontend application. ```bash cd frontend && npm run type-check && npm run build ``` -------------------------------- ### Docker Compose Configuration for MCP Source: https://github.com/simpleyyt/ai-manus/blob/main/docs/en/mcp.md Shows how to configure the MCP service within a docker-compose.yml file, mounting the mcp.json configuration and setting the environment path. ```yaml ... services: backend: image: simpleyyt/manus-backend volumes: - ./mcp.json:/etc/mcp.json # Mount MCP configuration file - ... environment: # MCP configuration file path - MCP_CONFIG_PATH=/etc/mcp.json ... ``` -------------------------------- ### Connect to VNC Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Connect to the VNC server to access the graphical interface of the container. This is typically done using a VNC client application. ```text localhost:5900 ``` -------------------------------- ### Get Service Timeout Status Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Retrieve the current status of the timeout function, including whether it is active and the remaining time. The response provides the remaining time in seconds and the timestamp for the timeout. ```json { "success": true, "message": "Remaining time: 45 minutes", "data": { "active": true, "timeout_timestamp": "2023-07-01T14:04:56", "remaining_seconds": 2700 } } ``` -------------------------------- ### Run Docker Container Source: https://github.com/simpleyyt/ai-manus/blob/main/frontend/README.md Run the Docker container and map the host port 8080 to the container port 80. Access the application via http://localhost:8080. ```bash docker run -d -p 8080:80 ai-chatbot-vue ``` -------------------------------- ### Serper.dev Custom Search Configuration (POST) Source: https://github.com/simpleyyt/ai-manus/blob/main/docs/en/configuration.md Configure AI Manus to use Serper.dev as a custom search provider via POST requests. Requires a Serper.dev API key and specifies the header for authentication. ```env SEARCH_PROVIDER=custom SEARCH_API_URL=https://google.serper.dev/search SEARCH_API_KEY=your-serper-key SEARCH_API_KEY_HEADER=X-API-KEY SEARCH_API_KEY_HEADER_PREFIX= SEARCH_RESULT_FIELD=organic ``` -------------------------------- ### View File Content Response Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Response format for viewing file content from the sandbox environment. ```json { "code": 0, "msg": "success", "data": { "content": "file content", "file": "file path" } } ``` -------------------------------- ### View File Content Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Views the content of a file within the sandbox environment. ```APIDOC ## POST /api/v1/sessions/{session_id}/file ### Description View file content in the sandbox environment. ### Method POST ### Endpoint /api/v1/sessions/{session_id}/file ### Parameters #### Path Parameters - **session_id** (string) - Required - The ID of the session. ### Request Body - **file** (string) - Required - The path to the file. ### Request Example ```json { "file": "file path" } ``` ### Response #### Success Response (200) - **code** (integer) - 0 for success - **msg** (string) - "success" - **data** (object) - Contains file content details - **content** (string) - The content of the file. - **file** (string) - The path to the file. ### Response Example ```json { "code": 0, "msg": "success", "data": { "content": "file content", "file": "file path" } } ``` ``` -------------------------------- ### Run Docker Container Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Runs the manus-sandbox Docker container, exposing necessary ports for the FastAPI service, Chrome debugging, and VNC. ```bash docker run -p 8080:8080 -p 9222:9222 -p 5900:5900 -p 5901:5901 manus-sandbox ``` -------------------------------- ### MCP Server Configuration Structure Source: https://github.com/simpleyyt/ai-manus/blob/main/docs/mcp.md Defines the structure for configuring MCP servers, including command, arguments, transport, and environment variables. ```json { "mcpServers": { "服务器名称": { "command": "命令", "args": ["参数列表"], "transport": "传输方式", "enabled": true/false, "description": "服务器描述", "env": { "环境变量名": "环境变量值" } } } } ``` -------------------------------- ### Run Backend Integration Tests Source: https://github.com/simpleyyt/ai-manus/blob/main/AGENTS.md Executes backend integration tests using pytest. Requires the backend, MongoDB, and Redis to be running. Tests can be run for all files, specific files, or by marker. ```bash # Ensure backend + MongoDB + Redis are running ./dev.sh up -d mongodb redis backend cd backend uv run pytest # all tests uv run pytest tests/test_auth_routes.py # specific file uv run pytest -m file_api # by marker ``` -------------------------------- ### Docker Compose Backend Configuration Source: https://github.com/simpleyyt/ai-manus/blob/main/docs/en/quick_start.md This snippet shows how to configure the `backend` service in `docker-compose.yml` to use an environment file. This is an alternative to directly defining environment variables within the `docker-compose.yml` file. ```yaml backend: image: simpleyyt/manus-backend # ... env_file: - .env ``` -------------------------------- ### List All Sessions Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Retrieves a list of all available sessions. ```APIDOC ## GET /api/v1/sessions ### Description Get list of all sessions. ### Method GET ### Endpoint /api/v1/sessions ### Response #### Success Response (200) - **code** (integer) - 0 for success - **msg** (string) - "success" - **data** (object) - Contains a list of sessions - **sessions** (array) - List of session objects - **session_id** (string) - The ID of the session. - **title** (string) - The title of the session. - **latest_message** (string) - The latest message in the session. - **latest_message_at** (integer) - Timestamp of the latest message. - **status** (string) - The current status of the session. - **unread_message_count** (integer) - Number of unread messages. ### Response Example ```json { "code": 0, "msg": "success", "data": { "sessions": [ { "session_id": "string", "title": "string", "latest_message": "string", "latest_message_at": 1234567890, "status": "string", "unread_message_count": 0 } ] } } ``` ``` -------------------------------- ### Frontend Type Checking and Build Source: https://github.com/simpleyyt/ai-manus/blob/main/AGENTS.md Performs type checking on the frontend codebase using vue-tsc and creates a production build. These commands help catch TypeScript and template errors before deployment. ```bash cd frontend npm run type-check # vue-tsc type checking npm run build # production build (catches TS + template errors) ``` -------------------------------- ### Write Input to Shell Process Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Writes input to a specified process session and optionally simulates pressing Enter. ```APIDOC ## POST /api/v1/shell/write ### Description Write input to the process in the specified session. ### Method POST ### Endpoint /api/v1/shell/write ### Request Body - **id** (string) - Required - Target session ID - **input** (string) - Required - Content to write - **press_enter** (boolean) - Required - Whether to simulate pressing Enter after input ### Request Example ```json { "id": "session_id", "input": "example input", "press_enter": true } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful - **message** (string) - A message describing the result - **data** (object) - Contains details about the operation - **session_id** (string) - The ID of the session - **input** (string) - The input that was written #### Response Example ```json { "success": true, "message": "Input written", "data": { "session_id": "session_id", "input": "example input" } } ``` ``` -------------------------------- ### Run Sandbox Tests Source: https://github.com/simpleyyt/ai-manus/blob/main/AGENTS.md Executes tests for the sandbox service. Requires the sandbox container to be running. Uses pytest for testing. ```bash ./dev.sh up -d sandbox cd sandbox uv run pytest ``` -------------------------------- ### Write Input to Shell Process Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Use this endpoint to send input to a running shell process in a specified session. You can also control whether to simulate pressing Enter after the input. ```json { "id": "session_id", /* Target session ID */ "input": "example input", /* Content to write */ "press_enter": true /* Whether to simulate pressing Enter after input */ } ``` -------------------------------- ### MCP Configuration File Structure Source: https://github.com/simpleyyt/ai-manus/blob/main/docs/en/mcp.md Defines the structure of the mcp.json file for configuring MCP servers, including command, arguments, transport, and environment variables. ```json { "mcpServers": { "server_name": { "command": "command", "args": ["argument_list"], "transport": "transport_method", "enabled": true/false, "description": "server_description", "env": { "environment_variable_name": "environment_variable_value" } } } } ``` -------------------------------- ### View Shell Session Content Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Views the output of a shell session within the sandbox environment. ```APIDOC ## POST /api/v1/sessions/{session_id}/shell ### Description View shell session output in the sandbox environment. ### Method POST ### Endpoint /api/v1/sessions/{session_id}/shell ### Parameters #### Path Parameters - **session_id** (string) - Required - The ID of the session. ### Request Body - **session_id** (string) - Required - The ID of the shell session. ### Request Example ```json { "session_id": "shell session ID" } ``` ### Response #### Success Response (200) - **code** (integer) - 0 for success - **msg** (string) - "success" - **data** (object) - Contains shell output details - **output** (string) - The shell output content. - **session_id** (string) - The ID of the shell session. - **console** (array) - List of console interactions - **ps1** (string) - The prompt string. - **command** (string) - The executed command. - **output** (string) - The output of the command. ### Response Example ```json { "code": 0, "msg": "success", "data": { "output": "shell output content", "session_id": "shell session ID", "console": [ { "ps1": "prompt string", "command": "executed command", "output": "command output" } ] } } ``` ``` -------------------------------- ### View File Content Request Body Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Request body for viewing file content in the sandbox environment. ```json { "file": "file path" } ``` -------------------------------- ### Backend Pytest Execution Source: https://github.com/simpleyyt/ai-manus/blob/main/AGENTS.md Run backend tests using pytest. This requires a running backend, MongoDB, and Redis. ```bash cd backend && uv run pytest ``` -------------------------------- ### Find Files by Pattern Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Finds files within a specified directory based on a glob pattern. Returns a list of matching file paths. ```json { "path": "/path/to/dir", /* Directory path to search */ "glob": "*.txt" /* Filename pattern (glob syntax) */ } ``` -------------------------------- ### Create Session Response Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Response format for successfully creating a new conversation session. ```json { "code": 0, "msg": "success", "data": { "session_id": "string" } } ``` -------------------------------- ### Docker Compose Configuration for AI Manus Source: https://github.com/simpleyyt/ai-manus/blob/main/README.md This YAML file defines the services, networks, and volumes required to run the AI Manus application using Docker Compose. It includes configurations for frontend, backend, sandbox, claw, MongoDB, and Redis. ```yaml services: frontend: image: simpleyyt/manus-frontend ports: - "5173:80" depends_on: - backend restart: unless-stopped networks: - manus-network environment: - BACKEND_URL=http://backend:8000 backend: image: simpleyyt/manus-backend depends_on: - sandbox - claw restart: unless-stopped volumes: - /var/run/docker.sock:/var/run/docker.sock:ro #- ./mcp.json:/etc/mcp.json # Mount MCP servers directory networks: - manus-network environment: # OpenAI API base URL - API_BASE=https://api.openai.com/v1 # OpenAI API key, replace with your own - API_KEY=sk-xxxx # LLM model name - MODEL_NAME=gpt-4o # LLM temperature parameter, controls randomness #- TEMPERATURE=0.7 # Maximum tokens for LLM response #- MAX_TOKENS=2000 # More configuration options: https://docs.ai-manus.com/#/configuration sandbox: image: simpleyyt/manus-sandbox command: /bin/sh -c "exit 0" # prevent sandbox from starting, ensure image is pulled restart: "no" networks: - manus-network claw: image: simpleyyt/manus-claw entrypoint: /bin/sh -c "exit 0" # prevent claw from starting, ensure image is pulled restart: "no" networks: - manus-network mongodb: image: mongo:7.0 volumes: - mongodb_data:/data/db restart: unless-stopped #ports: # - "27017:27017" networks: - manus-network redis: image: redis:7.0 restart: unless-stopped networks: - manus-network volumes: mongodb_data: name: manus-mongodb-data networks: manus-network: name: manus-network driver: bridge ``` -------------------------------- ### POST /api/v1/supervisor/restart Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Restarts all services managed by the supervisor. ```APIDOC ## POST /api/v1/supervisor/restart ### Description Restart all services. ### Method POST ### Endpoint /api/v1/supervisor/restart ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **message** (string) - A message describing the result of the operation. - **data** (object) - Contains additional data about the operation. - **status** (string) - The status of the services after restart. #### Response Example ```json { "success": true, "message": "All services restarted", "data": { "status": "restarted" } } ``` ``` -------------------------------- ### Sandbox Pytest Execution Source: https://github.com/simpleyyt/ai-manus/blob/main/AGENTS.md Run sandbox tests using pytest. Ensure you are in the sandbox directory. ```bash cd sandbox && uv run pytest ``` -------------------------------- ### Clean Up and Rebuild AI Manus Development Environment Source: https://github.com/simpleyyt/ai-manus/blob/main/README.md Commands to clean up all related Docker resources and rebuild images for the development environment. Use this when dependencies change. ```shell # Clean up all related resources ./dev.sh down -v # Rebuild images ./dev.sh build # Run in debug mode ./dev.sh up ``` -------------------------------- ### Mockserver API Test Source: https://github.com/simpleyyt/ai-manus/blob/main/AGENTS.md Verify the mockserver API by sending a POST request to the chat completions endpoint. ```bash curl -X POST http://localhost:8090/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{"model":"mock","messages":[{"role":"user","content":"hi"}]}' ``` -------------------------------- ### List All Sessions Response Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Response format for listing all available conversation sessions. ```json { "code": 0, "msg": "success", "data": { "sessions": [ { "session_id": "string", "title": "string", "latest_message": "string", "latest_message_at": 1234567890, "status": "string", "unread_message_count": 0 } ] } } ``` -------------------------------- ### Execute Shell Command Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Executes a shell command within a specified or newly created session. It allows for defining the execution directory and returns the session details upon successful initiation. ```APIDOC ## POST /api/v1/shell/exec ### Description Execute a command in the specified shell session. ### Method POST ### Endpoint /api/v1/shell/exec ### Request Body - **id** (string) - Optional - session_id, automatically created if not provided - **exec_dir** (string) - Optional - command execution working directory (must use absolute path) - **command** (string) - Required - Command to execute ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **message** (string) - A message describing the result of the operation. - **data** (object) - Contains details about the executed command. - **session_id** (string) - The ID of the shell session. - **command** (string) - The command that was executed. - **status** (string) - The current status of the command execution (e.g., "running"). ### Request Example ```json { "id": "session_id", "exec_dir": "/path/to/dir", "command": "ls -la" } ``` ### Response Example ```json { "success": true, "message": "Command executed", "data": { "session_id": "session_id", "command": "ls -la", "status": "running" } } ``` ``` -------------------------------- ### Search File Content Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Searches file content using regular expressions, returning matching lines and optional sudo permissions. ```APIDOC ## POST /api/v1/file/search ### Description Search file content using regular expressions. ### Method POST ### Endpoint /api/v1/file/search ### Request Body - **file** (string) - Required - Absolute file path - **regex** (string) - Required - Regular expression pattern - **sudo** (boolean) - Optional - Whether to use sudo permissions ### Request Example ```json { "file": "/path/to/file", "regex": "search pattern", "sudo": false } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful - **message** (string) - A message describing the result, including the number of matches found - **data** (object) - Contains details about the search results - **file** (string) - The path to the file - **matches** (array) - An array of matching occurrences - **line_number** (integer) - The line number where the match occurred - **line** (string) - The content of the line containing the match - **match** (string) - The specific matched content #### Response Example ```json { "success": true, "message": "Search completed, found 3 matches", "data": { "file": "/path/to/file", "matches": [ { "line_number": 10, "line": "Matching line content", "match": "Matching content" } ] } } ``` ``` -------------------------------- ### Search File Content Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Searches for content within a file using regular expressions. Returns matching lines and their details. Sudo permissions can be optionally used. ```json { "file": "/path/to/file", /* Absolute file path */ "regex": "search pattern", /* Regular expression pattern */ "sudo": false /* Optional, whether to use sudo permissions */ } ``` -------------------------------- ### Create Session Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Creates a new conversation session. This endpoint does not require a request body. ```APIDOC ## PUT /api/v1/sessions ### Description Create a new conversation session. ### Method PUT ### Endpoint /api/v1/sessions ### Request Body None ### Response #### Success Response (200) - **code** (integer) - 0 for success - **msg** (string) - "success" - **data** (object) - Contains session details - **session_id** (string) - The ID of the newly created session ### Response Example ```json { "code": 0, "msg": "success", "data": { "session_id": "string" } } ``` ``` -------------------------------- ### Wait for Process Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Waits for a process within a specified shell session to complete. An optional timeout can be provided to limit the waiting period. ```APIDOC ## POST /api/v1/shell/wait ### Description Wait for the process in the specified session to complete. ### Method POST ### Endpoint /api/v1/shell/wait ### Request Body - **id** (string) - Required - Target session ID - **seconds** (integer) - Optional - wait time (seconds) ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **message** (string) - A message describing the result of the operation, including the return code. - **data** (object) - Contains details about the completed process. - **session_id** (string) - The ID of the shell session. - **returncode** (integer) - The exit code of the completed process. - **status** (string) - The final status of the process (e.g., "completed"). ### Request Example ```json { "id": "session_id", "seconds": 10 } ``` ### Response Example ```json { "success": true, "message": "Process completed, return code: 0", "data": { "session_id": "session_id", "returncode": 0, "status": "completed" } } ``` ``` -------------------------------- ### View Shell Session Content Request Body Source: https://github.com/simpleyyt/ai-manus/blob/main/backend/README.md Request body for viewing shell session output in the sandbox environment. ```json { "session_id": "shell session ID" } ``` -------------------------------- ### Write File Content Source: https://github.com/simpleyyt/ai-manus/blob/main/sandbox/README.md Writes content to a specified file. Supports options for append mode, adding leading/trailing newlines, and using sudo permissions. ```json { "file": "/path/to/file", /* Absolute file path */ "content": "File content", /* Content to write */ "append": false, /* Optional, whether to use append mode */ "leading_newline": false, /* Optional, whether to add a newline before the content */ "trailing_newline": false, /* Optional, whether to add a newline after the content */ "sudo": false /* Optional, whether to write with sudo permissions */ } ```