Skip to content

Latest commit

ย 

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒ AgentEverywhereFlow (AEFlow)

Agent on Everywhere: Instant screen & window casting for embodied desktop agents.
ไปปไฝ•้กต้ขไธŽ็ช—ๅฃ็š†ๅฏไธ€้”ฎๆŠ•ๅฑๅฌๅ”ค็š„ๅ…ท่บซๆ™บ่ƒฝไฝ“ๅŸบ็ก€่ฎพๆ–ฝใ€‚

Family: *Flow CI Status License: MIT Python: 3.11+ Code Style: Ruff PRs Welcome

English | ็ฎ€ไฝ“ไธญๆ–‡


๐ŸŽฌ Real-World Autonomous Demos

๐Ÿฑ Scenario 1: 9-Grid Visual CAPTCHA Solving & Spatial Grounding

AEFlow 9-Grid Captcha Demo

Zero-shot multimodal spatial grounding: Agent targets browser window, identifies all 3 cat tiles in a 9-grid challenge, clicks each with visual checks, and passes verification.

# Reproduce in Chrome or Edge (try it yourself with examples/captcha_demo.html):
aef run --target "Chrome" --task "ๅœจๅฝ“ๅ‰ไนๅฎซๆ ผไบบๆœบ้ชŒ่ฏไธญ๏ผŒๆ‰พๅ‡บๆ‰€ๆœ‰ๅŒ…ๅซ็Œซๅ’ช็š„ๆ–นๆ ผไพๆฌก็‚นๅ‡ป้€‰ไธญ๏ผŒ็„ถๅŽ็‚นๅ‡ปๅณไธ‹่ง’็š„้ชŒ่ฏๆŒ‰้’ฎ"

๐Ÿ“Š Scenario 2: Office Spreadsheet Automation & Formula Calculation

AEFlow Excel Summation Demo

Desktop productivity: Agent targets Microsoft Excel window, locates target Total cell, injects =SUM(D2:D6) formula, and calculates total sales.

# Reproduce in Excel or WPS (try it yourself with examples/sales_demo.xlsx):
aef run --target "Excel" --task "ๅœจ้”€ๅ”ฎ้ขๅˆ—ไธ‹ๆ–น็š„ๆ€ป่ฎก็ฉบ็™ฝๅ•ๅ…ƒๆ ผ็‚นๅ‡ป๏ผŒ่พ“ๅ…ฅๆฑ‚ๅ’Œๅ…ฌๅผ่ฎก็ฎ—ๆ€ป้‡‘้ขๅนถๆŒ‰ๅ›ž่ฝฆ"

๐Ÿ’ก Why AgentEverywhereFlow?

Existing computer-use and GUI automation agents suffer from three major roadblocks:

  1. Unfocused Global Viewports: Grabbing the entire desktop leads to visual noise, popup interference, and negative/distorted coordinates across multiple monitors.
  2. Lack of Instant Targeting: There is no lightweight experience akin to Zoom / Tencent Meeting screen-sharingโ€”allowing users to freely cast either an entire monitor or a specific application window (VS Code, Chrome, Terminal, etc.) to the agent.
  3. Execution Rigidity vs. Safety: Either agents are constrained to sluggish step-by-step clicks or given unconstrained bash access that risks destructive missteps.

AgentEverywhereFlow (AEFlow) solves this by introducing Screen-Cast Style Viewport Isolation for autonomous GUI agents:

  • ๐ŸŽฏ Screen-Cast Target Picker: Discover and bind agents to any physical display or active application window with zero-copy capture and precise viewport coordinate projection.
  • โšก Instant Summon (aef summon): Cast and summon an agent in seconds via an interactive terminal UI or global shortcut.
  • ๐Ÿ“ Explicit Resolution Contract: Native pixel-space calibration (0, 0) -> (width, height) paired with optional coordinate grids and Set-of-Mark (SoM) indicators.
  • ๐Ÿ›ก๏ธ Dual-Mode Execution Architecture:
    • Minimal Mode (CodeAct REPL): High-speed, pythonic chaining of actions (click, type_text, press, wait, hotkey) with multi-block sequence merging.
    • Guarded Mode (JSON Schema): Strict atomic action schemas with safety policy filters and human-in-the-loop confirmation gates.
  • ๐ŸŽฏ Recursive Sub-Widget Hit Testing: Deep X11 and Win32 tree inspection ensuring clicks reliably trigger nested buttons, inputs, and controls without event dropping.

๐Ÿ—๏ธ Architecture Blueprint

flowchart TD
    subgraph UI["1. Target Discovery & Summoning"]
        CLI["CLI: aef summon / aef run"] --> Selector["Screen-Cast Selector (Displays & Windows)"]
        Selector --> Target["TargetInfo (HWND / XID / Rect)"]
    end

    subgraph Perception["2. Viewport Capture & Geometry"]
        Target --> CapturerRouter{"OS Dispatch"}
        CapturerRouter -->|Windows| WinCap["Win32 DWM / PrintWindow (PW_RENDERFULLCONTENT)<br/>+ Per-Monitor DPI-v2 Awareness"]
        CapturerRouter -->|Linux| LinCap["X11 Drawable Capture (XGetImage)<br/>+ mss multi-monitor fallback"]
        CapturerRouter -->|macOS| MacCap["ScreenCaptureKit (Planned)"]
        WinCap --> ViewportImg["Target-Relative Viewport Image"]
        LinCap --> ViewportImg
        MacCap --> ViewportImg
    end

    subgraph Calibration["3. Spatial Calibration & Vision"]
        ViewportImg --> Calib["Resolution Contract: (0,0) -> (W,H)"]
        Calib --> Grid["Optional Grid Ruler & SoM Markings"]
        Grid --> VLM["Vision-Language Model (GPT-4o, Claude 3.5, Qwen2-VL)"]
    end

    subgraph Execution["4. Dual-Mode Execution & Event Injection"]
        VLM --> Router{"Execution Mode"}
        Router -->|Minimal / CodeAct| REPL["Python REPL Sandbox (click, type, press, wait)"]
        Router -->|Guarded| GuardedEngine["JSON Schema Guarded Engine (Safety Intercepts)"]
        REPL --> Projector["CoordinateProjector (Local -> Screen / Window)"]
        GuardedEngine --> Projector
        Projector --> Driver["InputDriver (Win32 SendInput / X11 XSendEvent)"]
        Driver --> HitTest["Recursive Child Hit-Testing (_find_x11_child_at)"]
    end
Loading

โš–๏ธ Dual-Mode Execution Comparison

Feature โšก Minimal Mode (CodeAct REPL) ๐Ÿ›ก๏ธ Guarded Mode (Structured JSON)
Protocol Python code block (python ... ) JSON Schema (json ... )
API click(x, y), type_text(), press(), wait() {"action": "click", "x": 100, "y": 200}
Throughput High (multi-action chaining in single LLM turn) Deterministic (strict atomic step verification)
Safety Net Restricted sandbox built-ins Policy interceptors & Human confirmation prompts
Best For Prototyping, web browsing, form filling Financial operations, sensitive infrastructure, production

โšก Quick Start

Installation

AEFlow is built using modern Python packaging with uv:

# Clone the repository
git clone https://github.com/mcocdaa/AgentEverywhereFlow.git
cd AgentEverywhereFlow

# Install dependencies based on your operating system
# On Linux:
uv pip install -e ".[linux]"

# On Windows:
uv pip install -e ".[windows]"

# Developer / Contributor setup:
uv pip install -e ".[dev,linux]"

Configuration

AEFlow supports multiple flexible configuration methods with automatic cascading fallbacks (default model: deepseek-flash | default base URL: https://api.deepseek.com):

Method 1: Instant CLI Configuration (Recommended)

Persist credentials globally to ~/.aef/.env without editing files:

# 1. Set your API Key (default is already configured for DeepSeek):
aef config --set-key "sk-your-api-key"

# 2. (Optional) Switch to OpenAI, Claude, or custom providers if desired:
aef config --set-model "gpt-4o"
aef config --set-base "https://api.openai.com/v1"

Method 2: Standard Environment Variables

AEFlow automatically falls back to standard environment variables:

export OPENAI_API_KEY="sk-your-api-key"

# Optional overrides (defaults to https://api.deepseek.com and deepseek-flash):
export OPENAI_BASE_URL="https://api.deepseek.com"
export OPENAI_MODEL_NAME="deepseek-flash"

Method 3: Local .env File

You can also place a .env in the current working directory:

AEF_MODEL_NAME=deepseek-flash
AEF_BASE_URL=https://api.deepseek.com
AEF_API_KEY=your_api_key_here
AEF_DEFAULT_MODE=minimal

๐Ÿ•น๏ธ CLI Usage

# 1. Interactive screen-cast target picker and agent summoner
aef summon

# 2. List all available physical displays and active application windows with Target IDs
aef list-targets

# 3. Summon agent by Window Title substring
aef run --target "Chrome" --task "Search for GitHub Trending repositories"

# 4. Summon agent by Target ID or Native HWND (Precision targeting)
aef run --target hwnd:0x409dc --task "ๅธฎๆˆ‘่ฟ‡ไธ€ไธ‹ไบบๆœบ้ชŒ่ฏ"

# 5. Summon agent onto an entire physical display
aef run --target display:1 --task "Organize desktop icons"

# 6. Run with step diagnostics and debug logging
aef run --target "Excel" --task "Calculate total" --debug

# 7. View current configuration
aef config

# 8. Check system info & installed version
aef version

๐Ÿ’ป Programmatic Usage

You can embed AEFlow directly into your Python workflows:

from agenteverywhereflow.capturer import get_capturer
from agenteverywhereflow.agent.loop import AgentLoop
from agenteverywhereflow.config import AppConfig, ExecutionMode

# 1. Discover target windows
capturer = get_capturer()
targets = capturer.list_targets()
target = targets[0]  # E.g. VS Code, Terminal, or Display 1

# 2. Initialize Agent Loop
loop = AgentLoop(app_config=AppConfig(default_mode=ExecutionMode.MINIMAL_PYTHON))

# 3. Run autonomous task
loop.run(target=target, user_task="Fill the form and click submit")

See examples/ for more scripts, including custom model planner callbacks and interactive captcha demos.


๐Ÿงช Comprehensive Benchmarks

AEFlow includes a high-fidelity end-to-end benchmark suite testing real GUI windows and multi-step agent actions:

# Run comprehensive multi-scenario suite (Form, Calculator, Guarded Mode)
uv run python -m benchmarks.bench_suite

# Run autonomous goal convergence benchmark
uv run python -m benchmarks.bench_autonomous

# Run standard unit tests
uv run pytest tests/ -v

See benchmarks/README.md for benchmark specifications and results.


๐Ÿ“‚ Repository Layout

AgentEverywhereFlow/
โ”œโ”€โ”€ .github/                    # CI/CD workflows, issue templates, dependabot
โ”œโ”€โ”€ agenteverywhereflow/        # Core package (CLI: aef)
โ”‚   โ”œโ”€โ”€ actions/                # InputDriver & CoordinateProjector
โ”‚   โ”œโ”€โ”€ agent/                  # AgentLoop, Prompts & VisionPipeline (SoM)
โ”‚   โ”œโ”€โ”€ capturer/               # Win32, X11 & interactive TargetSelector
โ”‚   โ”œโ”€โ”€ engine/                 # Minimal (CodeAct REPL) & Guarded engines
โ”‚   โ”œโ”€โ”€ cli.py                  # Typer CLI application
โ”‚   โ””โ”€โ”€ config.py               # Pydantic v2 application configuration
โ”œโ”€โ”€ benchmarks/                 # Multi-scenario autonomous benchmark suite
โ”œโ”€โ”€ docs/                       # Architecture, vision pipeline, and engine docs
โ”œโ”€โ”€ examples/                   # Developer invocation examples & interactive demo assets
โ”œโ”€โ”€ tests/                      # Unit tests (pytest)
โ”œโ”€โ”€ pyproject.toml              # Build & dependency declarations
โ”œโ”€โ”€ CONTRIBUTING.md             # Developer contribution guide
โ”œโ”€โ”€ SECURITY.md                 # Security reporting policy
โ”œโ”€โ”€ AGENTS.md                   # AI Coding Agent invariants & guidelines
โ””โ”€โ”€ CHANGELOG.md                # Release version history

๐Ÿ—บ๏ธ Roadmap

  • v0.1.0 ~ v0.1.3 (Foundation & Ergonomics):
    • Viewport abstractions: Display & Window enumeration with Target ID precision.
    • Windows native DWM / PrintWindow capture with Per-Monitor DPI-v2 awareness.
    • Linux X11 native drawable window capture & child hit-testing (_find_x11_child_at).
    • Hardware-level Win32 mouse/keyboard injection & clipboard Unicode typing.
    • Dual-mode execution engines (CodeAct REPL & Guarded Action Engine).
    • Multi-block CodeAct sequence extraction & execution.
    • Global configuration (~/.aef/.env) & aef config CLI tool.
    • Real-world benchmark suite (Form, Calculator, Guarded) & interactive showcases.
  • v0.2.0 (Interactive HUD & Hotkeys):
    • Transparent floating HUD showing real-time agent reasoning steps.
    • Global hotkey summoning (Win+Shift+A / Ctrl+Shift+A) and instant emergency stop (ESC).
  • v0.3.0 (Ecosystem Expansion):
    • Linux Wayland / PipeWire portal integration.
    • macOS ScreenCaptureKit integration.

๐Ÿค Contributing

Contributions are welcome! Please read CONTRIBUTING.md and AGENTS.md before submitting pull requests.


๐Ÿ“„ License

This project is licensed under the MIT License.

About

๐ŸŒ Instant screen & window casting for embodied desktop agents. ไปปไฝ•้กต้ขไธŽ็ช—ๅฃ็š†ๅฏไธ€้”ฎๆŠ•ๅฑๅฌๅ”ค็š„ๅ…ท่บซๆกŒ้ขๆ™บ่ƒฝไฝ“ใ€‚

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages