### Download Installation Guide Source: https://github.com/lsdefine/genericagent/blob/main/README.md Use curl to download the installation guide for LLM Agents. This command fetches the Chinese version of the installation documentation. ```bash curl -fsSL https://raw.githubusercontent.com/lsdefine/GenericAgent/refs/heads/main/docs/installation_zh.md ``` -------------------------------- ### Python Install and Setup Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md Installs GenericAgent using a standard Python checkout and uv for environment management. This method is suitable for developers who need an editable installation. ```bash git clone https://github.com/lsdefine/GenericAgent.git cd GenericAgent uv venv uv pip install -e ".[ui]" cp mykey_template.py mykey.py # Fill in your LLM API key python launch.pyw ``` -------------------------------- ### JavaScript for Desktop App Configuration and Start Source: https://github.com/lsdefine/genericagent/blob/main/frontends/desktop/static/fallback.html This script handles user input for Python path and project directory, invokes backend commands to start the bridge, and manages window visibility. Use this for the initial setup screen. ```javascript const {invoke} = window.__TAURI__.core; const {getCurrentWindow, Window} = window.__TAURI__.window; const statusEl = document.getElementById('status'); const btn = document.getElementById('start-btn'); const pyInput = document.getElementById('pypath'); const dirInput = document.getElementById('projdir'); // Pre-fill from Rust config discovery invoke('get_config').then(([py, dir]) => { if (py) pyInput.value = py; if (dir) dirInput.value = dir; }).catch(() => {}); async function doStart() { const pythonPath = pyInput.value.trim(); const projectDir = dirInput.value.trim(); if (!pythonPath) { statusEl.className='err'; statusEl.textContent='Please enter Python path / 请输入 Python 路径'; return; } if (!projectDir) { statusEl.className='err'; statusEl.textContent='Please enter project directory / 请输入项目目录'; return; } btn.disabled = true; statusEl.className=''; statusEl.textContent='Starting bridge… 正在启动…'; try { await invoke('start_bridge_with_config', {pythonPath, projectDir}); statusEl.className='ok'; statusEl.textContent='Connected! 已连接,正在打开主窗口…'; // Show main window and hide setup const mainWin = await Window.getByLabel('main'); if (mainWin) { await mainWin.show(); await mainWin.setFocus(); } const setupWin = getCurrentWindow(); await setupWin.hide(); } catch(e) { statusEl.className='err'; statusEl.textContent='Failed: '+e; btn.disabled = false; } } pyInput.addEventListener('keydown', e =>{ if(e.key==='Enter') dirInput.focus(); }); dirInput.addEventListener('keydown', e=>{ if(e.key==='Enter') doStart(); }); ``` -------------------------------- ### One-Click Install for Linux/macOS Source: https://github.com/lsdefine/genericagent/blob/main/README.md Download and execute an installation script using curl for Linux or macOS. This is a recommended one-click installation method. ```bash curl -fsSL http://fudankw.cn:9000/files/ga_install.sh | bash ``` -------------------------------- ### Python Install for Developers (Bash) Source: https://github.com/lsdefine/genericagent/blob/main/README.md Installation method for developers using Python. Clones the repository, sets up a virtual environment, installs dependencies, and prepares for launch. ```bash git clone https://github.com/lsdefine/GenericAgent.git cd GenericAgent uv venv uv pip install -e ".[ui]" # Core + UI dependencies cp mykey_template.py mykey.py # Fill in your LLM API key python launch.pyw ``` -------------------------------- ### GenericAgent Skill Crystallization Examples Source: https://github.com/lsdefine/genericagent/blob/main/README.md Provides examples of how GenericAgent translates user requests into executable skills, detailing the initial setup and subsequent one-line invocation. ```markdown | What you say | First time | Every time after | | :--- | :--- | :--- | | "Read my WeChat messages" | Install deps → reverse DB → write read script → save Skill | **one-line invoke** | | "Monitor stocks and alert me" | Install `mootdx` → build selection flow → configure cron → save Skill | **one-line start** | | "Send this file via Gmail" | Configure OAuth → write send script → save Skill | **ready to use** ``` -------------------------------- ### Developer Installation with Python Source: https://github.com/lsdefine/genericagent/blob/main/README.md Clone the repository, set up a virtual environment using uv, install core and UI dependencies, configure API keys, and launch the application. This method is for developers. ```bash git clone https://github.com/lsdefine/GenericAgent.git cd GenericAgent uv venv uv pip install -e ".[ui]" cp mykey_template.py mykey.py # 填入你的 LLM API Key python launch.pyw ``` -------------------------------- ### Developer Checkout and Install Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md Clones the GenericAgent repository, sets up a virtual environment, installs dependencies including UI, and copies the API key template. ```bash git clone https://github.com/lsdefine/GenericAgent.git cd GenericAgent uv venv uv pip install -e ".[ui]" cp mykey_template.py mykey.py ``` -------------------------------- ### Add Initial Version Check Tasks Source: https://github.com/lsdefine/genericagent/blob/main/memory/checklist_sop.md Example of adding initial tasks to check the version of software on multiple servers. Each server gets its own task. ```python cl.add(["查 node03 版本", "查 node09 版本", "查 Dell 版本"]) ``` -------------------------------- ### Verify GenericAgent Setup Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md Checks if the agent_loop module can be imported and retrieves the short Git commit hash of the current installation. ```bash cd ~/GenericAgent python -c "import agent_loop; print('OK')" git rev-parse --short HEAD ``` -------------------------------- ### Fetch Installation Script with curl Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md Downloads the GenericAgent installation script using curl, ensuring all flags, quoting, and safety rules are preserved. ```bash curl -fsSL https://raw.githubusercontent.com/lsdefine/GenericAgent/refs/heads/main/docs/installation.md ``` -------------------------------- ### Launch from Project Directory Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md Launches GenericAgent from the project directory after installation. ```bash python launch.pyw ``` -------------------------------- ### Verify GenericAgent Installation Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md Verifies the GenericAgent installation by importing the agent_loop module and checking the Git commit hash. This should be run after installation and before launching a frontend. ```bash python -c "import agent_loop; print('OK')" git rev-parse --short HEAD ``` -------------------------------- ### Custom Install Location for Linux/macOS Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md Installs GenericAgent to a custom directory on Linux or macOS using a one-line bash command. ```bash INSTALL_DIR="$HOME/work/GenericAgent" GLOBAL=1 bash -c "$(curl -fsSL http://fudankw.cn:9000/files/ga_install.sh)" ``` -------------------------------- ### One-line Install for Linux/macOS Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md Installs GenericAgent using a one-line bash command. This method prepares an isolated runtime and downloads the core dependencies. ```bash GLOBAL=1 bash -c "$(curl -fsSL http://fudankw.cn:9000/files/ga_install.sh)" ``` -------------------------------- ### One-Click Install for Windows Source: https://github.com/lsdefine/genericagent/blob/main/README.md Execute a PowerShell script to perform a one-click installation on Windows. This method is recommended for ease of use and avoids polluting the system environment. ```powershell powershell -ExecutionPolicy Bypass -c "irm http://fudankw.cn:9000/files/ga_install.ps1 | iex" ``` -------------------------------- ### Launch Desktop App (Windows) Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md Launches the GenericAgent desktop application after a one-line installation on Windows. ```text frontends/GenericAgent.exe ``` -------------------------------- ### Subagent Invocation Command Source: https://github.com/lsdefine/genericagent/blob/main/memory/subagent.md Command to start a subagent. Use --input for automatic directory and file setup. For long text inputs, manually create input.txt first. The agent runs in the background and prints its PID. ```bash python agentmain.py --task {name} [--input "short text"] [--llm_no N] ``` -------------------------------- ### One-line Install for Windows PowerShell Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md Installs GenericAgent using a one-line PowerShell command. This method prepares an isolated runtime and downloads the core dependencies. ```powershell powershell -ExecutionPolicy Bypass -c "$env:GLOBAL=1; irm http://fudankw.cn:9000/files/ga_install.ps1 | iex" ``` -------------------------------- ### Initialize Checklist for Booter (Single-User Mode) Source: https://github.com/lsdefine/genericagent/blob/main/memory/checklist_sop.md Use this snippet to start the Checklist SOP in single-user mode where the master executes tasks themselves. The 'goal' parameter should describe the user's request without specifying the implementation details. ```python from checklist_helper import CL cl = CL("cl_xxx", goal="<用户要求任务,尽量原样>") cl.start_master() # Only for Booter,Master严禁调用 ``` -------------------------------- ### Custom Install Location for Windows PowerShell Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md Installs GenericAgent to a custom directory on Windows using a one-line PowerShell command. ```powershell $env:INSTALL_DIR="C:\dev\GenericAgent"; powershell -ExecutionPolicy Bypass -c "$env:GLOBAL=1; irm http://fudankw.cn:9000/files/ga_install.ps1 | iex" ``` -------------------------------- ### Install pywebview Dependencies on Debian/Ubuntu Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md Installs necessary GTK and WebKit packages required for pywebview desktop mode on Debian-based Linux distributions. ```bash sudo apt install libgtk-3-dev libwebkit2gtk-4.1-dev pip install pywebview ``` -------------------------------- ### Add Parallel Sub-Tasks Example Source: https://github.com/lsdefine/genericagent/blob/main/memory/checklist_sop.md Demonstrates adding multiple independent sub-tasks that can be executed in parallel. Each task is a short phrase, with details to be added later during distribution. ```python cl.add(["下载A.exe", "下载B.zip", "下载C.zip"]) ``` -------------------------------- ### Initialize Checklist for Master (Multi-User Mode) Source: https://github.com/lsdefine/genericagent/blob/main/memory/checklist_sop.md Use this snippet to start the Checklist SOP in multi-user mode, suitable for scenarios where a master distributes tasks to multiple workers. Specify the number of workers using the 'workers' parameter. ```python from checklist_helper import CL cl = CL("cl_xxx", goal="<用户要求任务,尽量原样>", workers=2) cl.start_master() # Only for Booter,Master严禁调用 ``` -------------------------------- ### Update Existing GenericAgent Installation Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md Fetches the latest changes from the Git repository and installs/updates the project dependencies, including UI components. ```bash cd ~/GenericAgent git fetch git pull uv pip install -e ".[ui]" ``` -------------------------------- ### Configure LLM Key Helper Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md An optional script to help configure your LLM API key. It guides you through setting up keys for supported providers like OpenAI-compatible and Anthropic Claude. ```bash python assets/configure_mykey.py ``` -------------------------------- ### Start Long-Term Memory Update Source: https://github.com/lsdefine/genericagent/blob/main/README.md This memory tool initiates the process of refining and storing long-term memories. ```python start_long_term_update ``` -------------------------------- ### Add Independent Dimension Tasks Example Source: https://github.com/lsdefine/genericagent/blob/main/memory/checklist_sop.md Illustrates adding tasks that are naturally independent, such as checking different aspects of a document (grammar, style, format). ```python cl.add(["检查语法", "检查风格", "检查格式"]) ``` -------------------------------- ### Launch QQ Bot (Python) Source: https://github.com/lsdefine/genericagent/blob/main/README.md Command to launch the GenericAgent QQ bot interface. ```python python frontends/qqapp.py ``` -------------------------------- ### Launch Feishu/Lark Bot (Python) Source: https://github.com/lsdefine/genericagent/blob/main/README.md Command to launch the GenericAgent Feishu / Lark bot interface. ```python python frontends/fsapp.py ``` -------------------------------- ### Launch Terminal UI Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md Launches the lightweight, keyboard-driven Terminal UI for GenericAgent, built with Textual. It supports multiple concurrent sessions and real-time streaming. ```bash python frontends/tuiapp_v2.py ``` -------------------------------- ### Launch Telegram Bot (Python) Source: https://github.com/lsdefine/genericagent/blob/main/README.md Command to launch the GenericAgent Telegram bot interface. ```python python frontends/tgapp.py ``` -------------------------------- ### GenericAgent vs. Other Agent Frameworks Comparison Source: https://github.com/lsdefine/genericagent/blob/main/README.md Compares GenericAgent with OpenClaw and Claude Code across key features like codebase size, deployment, browser control, OS control, self-evolution, and out-of-the-box capabilities. ```markdown | Feature | **GenericAgent** | OpenClaw | Claude Code | | :--- | :---: | :---: | :---: | | **Codebase** | ~3K lines | ~530,000 lines | Open-sourced (large) | | **Deployment** | `pip install` + API Key | Multi-service orchestration | CLI + subscription | | **Browser Control** | Real browser (session preserved) | Sandbox / headless browser | Via MCP plugin | | **OS Control** | Mouse/kbd, vision, ADB | Multi-agent delegation | File + terminal | | **Self-Evolution** | Autonomous skill growth | Plugin ecosystem | Stateless between sessions | | **Out of the Box** | Few core files + starter skills | Hundreds of modules | Rich CLI toolset ``` -------------------------------- ### Write File Source: https://github.com/lsdefine/genericagent/blob/main/README.md This tool allows the agent to write to, create, or overwrite files. ```python file_write ``` -------------------------------- ### Ask User for Input Source: https://github.com/lsdefine/genericagent/blob/main/README.md This tool facilitates human-agent collaboration by allowing the agent to request input from the user. ```python ask_user ``` -------------------------------- ### Launch WeCom Bot (Python) Source: https://github.com/lsdefine/genericagent/blob/main/README.md Command to launch the GenericAgent WeCom bot interface. ```python python frontends/wecomapp.py ``` -------------------------------- ### Execute Code Snippet Source: https://github.com/lsdefine/genericagent/blob/main/README.md This tool allows the agent to execute arbitrary code, supporting Python and PowerShell. ```python code_run ``` -------------------------------- ### Launch WeChat Bot (Python) Source: https://github.com/lsdefine/genericagent/blob/main/README.md Command to launch the GenericAgent WeChat bot interface. ```python python frontends/wechatapp.py ``` -------------------------------- ### Force Reinstall for Linux/macOS Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md Forces a reinstallation of GenericAgent on Linux or macOS, overwriting existing files. Ensure backups of important local data. ```bash FORCE=1 GLOBAL=1 bash -c "$(curl -fsSL http://fudankw.cn:9000/files/ga_install.sh)" ``` -------------------------------- ### Launch DingTalk Bot (Python) Source: https://github.com/lsdefine/genericagent/blob/main/README.md Command to launch the GenericAgent DingTalk bot interface. ```python python frontends/dingtalkapp.py ``` -------------------------------- ### GenericAgent Self-Evolution Workflow Source: https://github.com/lsdefine/genericagent/blob/main/README.md Illustrates the autonomous exploration and skill crystallization process in GenericAgent. This mechanism allows the agent to learn and adapt over time. ```text [New Task] │ ▼ [Autonomous Exploration] ─► install deps · write scripts · debug · verify │ ▼ [Crystallize into Skill] ─► write to memory layer │ ▼ [Direct Recall on Next Similar Task] ``` -------------------------------- ### Read File Source: https://github.com/lsdefine/genericagent/blob/main/README.md This tool enables the agent to read the content of a specified file. ```python file_read ``` -------------------------------- ### Add Upgrade Tasks After Filtering Source: https://github.com/lsdefine/genericagent/blob/main/memory/checklist_sop.md Shows adding tasks to upgrade specific servers after an initial check identified which ones need upgrading. ```python cl.add(["升级 node03 到 24", "升级 Dell 到 24"]) ``` -------------------------------- ### Subagent Context JSON Format Source: https://github.com/lsdefine/genericagent/blob/main/memory/subagent.md The context.json file provides subagents with absolute paths to input and output files, along with task descriptions and dependencies. The subagent must read this file first upon startup and use the provided absolute paths for all file operations. ```json { "task": "task description", "work_dir": "/absolute/path/to/plan_dir/", "input_files": { "paper_info": "/absolute/path/to/paper_info.txt" }, "output_files": { "pdf": "/absolute/path/to/paper.pdf", "report": "/absolute/path/to/paper_report.md" }, "dependencies": ["paper_info.txt must exist"] } ``` -------------------------------- ### Check System 'ga' Command Source: https://github.com/lsdefine/genericagent/blob/main/docs/installation.md Checks if the 'ga' command is already in use on your system. If it conflicts with another tool, use direct Python commands to launch GenericAgent. ```bash type ga ``` -------------------------------- ### Master Agent Checklist Operations Source: https://github.com/lsdefine/genericagent/blob/main/memory/checklist_sop.md This snippet shows the core operations for the Master agent: initializing the checklist by loading state, adding new tasks, checking progress, marking tasks as complete, and closing the checklist. ```python from checklist_helper import CL cl = CL("cl_xxx") # 加载状态(BBS已在跑) cl.add(["任务1", "任务2"]) # 在你的笔记中记录TODO项 cl.look() # 查进度 cl.mark(id, "摘要") # 验收 cl.close() # 全部完成后关闭 ``` -------------------------------- ### GenericAgent Atomic Tools Source: https://github.com/lsdefine/genericagent/blob/main/README.md Lists the 9 atomic tools provided by GenericAgent for interacting with the external world. These form the foundational capabilities of the agent. ```markdown | Tool | | :--- | | `code_run` | Execute arbitrary code (Python / PowerShell) | `file_read` | Read files | `file_write` | Write / create / overwrite files | `file_patch` | Patch / modify files | `web_scan` | Perceive web content | `web_execute_js` | Control browser behavior | `ask_user` | Human-in-the-loop confirmation | `update_working_checkpoint` | *(memory)* Short-term working notepad | `start_long_term_update` | *(memory)* Distill long-term memory ``` -------------------------------- ### Convert BBox to Screen Physical Coordinates Source: https://github.com/lsdefine/genericagent/blob/main/memory/ljqCtrl_sop.md Converts a bounding box obtained from UI detection (which are physical coordinates) into screen physical coordinates for clicking. It accounts for DPI scaling by converting the client area's origin from logical to physical coordinates before adding the offset from the bounding box. ```python # ui_detect获取的都是物理坐标 # ClientToScreen拿客户区原点(逻辑) → 除dpi_scale得物理偏移 cx, cy = win32gui.ClientToScreen(hwnd, (0, 0)) ox, oy = int(cx / ljqCtrl.dpi_scale), int(cy / ljqCtrl.dpi_scale) ljqCtrl.Click(ox + (bbox[0]+bbox[2])//2, oy + (bbox[1]+bbox[3])//2) ``` -------------------------------- ### Scan Web Page Source: https://github.com/lsdefine/genericagent/blob/main/README.md This tool enables the agent to perceive and analyze the content of web pages. ```python web_scan ``` -------------------------------- ### Execute JavaScript on Web Page Source: https://github.com/lsdefine/genericagent/blob/main/README.md This tool allows the agent to control browser behavior by executing JavaScript. ```python web_execute_js ``` -------------------------------- ### Update Working Checkpoint Source: https://github.com/lsdefine/genericagent/blob/main/README.md This memory tool allows the agent to update its short-term working notes. ```python update_working_checkpoint ``` -------------------------------- ### Simulate Text Input using Clipboard Source: https://github.com/lsdefine/genericagent/blob/main/memory/ljqCtrl_sop.md ljqCtrl does not have a direct text input function. To type text, first click or triple-click the input field, then copy the desired text to the clipboard and use ljqCtrl.Press('ctrl+v') to paste it. ```python # 文本输入:先点击/三击选中字段,再 pyperclip.copy('文本'); ljqCtrl.Press('ctrl+v') ``` -------------------------------- ### Core Agent Loop Code Reference Source: https://github.com/lsdefine/genericagent/blob/main/README.md The core execution loop of GenericAgent is concise, approximately 100 lines of code. This reference points to the file containing this logic. ```python agent_loop.py ``` -------------------------------- ### Patch File Source: https://github.com/lsdefine/genericagent/blob/main/README.md This tool is used by the agent to modify existing files. ```python file_patch ``` -------------------------------- ### Subagent Internal Plan Mode Trigger Source: https://github.com/lsdefine/genericagent/blob/main/memory/subagent.md When a subagent detects a multi-step task with dependencies, it should create and use './subagent_plan.md' to manage execution internally. This is triggered by tasks with 3+ steps or requiring checkpoints. ```markdown subagent_plan.md ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.