Hybrid Mode (Browser + API)
Use CUGA in hybrid mode to combine browser automation with API interactions
CUGA's hybrid mode combines the power of both browser automation and API interactions, allowing you to seamlessly work with web pages while leveraging backend services.
🎯 What is Hybrid Mode?
Hybrid mode enables CUGA to:
- 🌐 Browser Automation: Navigate, interact with, and manipulate web pages
- 🔌 API Interactions: Make API calls to backend services
- 🔄 Combined Workflows: Use both capabilities in a single task
- 📊 Data Integration: Fetch data via APIs and display it on web pages
🎬 Example in Action
Watch CUGA seamlessly combine web and API operations in a single workflow:
Example Task: get top account by revenue from digital sales, then add it to current page
🎯 What happens: CUGA will fetch data from the Digital Sales API and then interact with the web page to add the account information directly to the current page - demonstrating seamless API-to-web workflow integration!
🚀 Quick Start
📋 Prerequisites (click to expand)
- Python 3.12+ - Download here
- uv package manager - Installation guide
- CUGA installed - Follow the Installation Guide
🔧 Optional: Local Digital Sales API (only if remote endpoint fails)
The demo comes pre-configured with the Digital Sales API → 📖 API Docs
Only follow these steps if you encounter issues with the remote Digital Sales endpoint:
# Navigate to cuga-agent directory
cd cuga-agent
# Start the Digital Sales API locally on port 8000
uv run fastapi dev docs/examples/digital_sales_openapi/main.py --port 8000
# Then update ./src/cuga/backend/tools_env/registry/config/mcp_servers.yaml
# Change the digital_sales URL from:
# url: https://digitalsales.19pc1vtv090u.us-east.codeengine.appdomain.cloud/openapi.json
# To:
# url: http://localhost:8000/openapi.jsonSetup Steps
-
Switch to hybrid mode:
Edit
./src/cuga/settings.toml:[advanced_features] mode = 'hybrid' # Change from 'api' to 'hybrid' -
Install browser support (if not already installed):
# Install Playwright and Chromium browser playwright install chromium -
Start CUGA:
# Start both registry and demo services cuga start demo # Chrome will open automatically at http://localhost:8005 -
Enable the browser extension:
- Click the extension puzzle icon in your browser toolbar
- Find and toggle the CUGA extension to activate it
- This will open the CUGA side panel in your browser
-
Open the test application:
Navigate to the sales demo app: https://samimarreed.github.io/sales/
-
Try the hybrid task:
In the CUGA interface, enter:
get top account by revenue from digital sales then add it to current page
🎯 What you'll see: CUGA will:
- Query the Digital Sales API for account data
- Identify the top revenue account
- Interact with the web page to add the account information
- Display the results on the current page
📊 How It Works
The Workflow
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Web Page │ │ CUGA Agent │ │ Digital │
│ (Browser) │◄──►│ (Hybrid) │◄──►│ Sales API │
│ │ │ │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘Step-by-Step Process
- Task Analysis: CUGA analyzes your request and determines it requires both API and web operations
- API Query: Makes API call to Digital Sales service to fetch account data
- Data Processing: Processes the response and identifies the top account by revenue
- Browser Interaction: Uses browser automation to modify the current web page
- Content Injection: Adds the account information to the page DOM
- User Feedback: Provides confirmation of the completed operation
⚙️ Configuration
Task Mode Settings
CUGA supports three task execution modes:
| Mode | Description |
|---|---|
api | API-only mode - executes API tasks (default) |
web | Web-only mode - executes web tasks using browser extension |
hybrid | Hybrid mode - executes both API tasks and web tasks using browser extension |
Edit ./src/cuga/settings.toml:
[demo_mode]
# Starting URL when CUGA opens (for web and hybrid modes)
start_url = "https://opensource-demo.orangehrmlive.com/web/index.php/auth/login"
[advanced_features]
# Set the task execution mode
mode = 'api' # Options: 'api', 'web', or 'hybrid'Understanding CUGA Modes
Important: CUGA has two separate mode settings that serve different purposes:
-
Agent Execution Mode (
features.cuga_mode):- Controls how the agent reasons and executes tasks
- Options:
fast,balanced,accurate,custom,save_reuse_fast - Located in
[features]section
-
Task Execution Mode (
advanced_features.mode):- Controls where tasks run (API, browser, or both)
- Options:
api,web,hybrid - Located in
[advanced_features]section
[features]
cuga_mode = "balanced" # How the agent reasons
[advanced_features]
mode = 'hybrid' # Where tasks execute💬 Example Queries for Hybrid Mode
These queries demonstrate the power of combining browser and API operations:
Data Fetching & Display:
"get top account by revenue from digital sales and add it to current page"Form Population:
"fetch customer data from the API and fill out the contact form on this page"Dynamic Updates:
"retrieve user profile from the backend and populate the profile page"Multi-Source Integration:
"get sales analytics and create a chart on the current page"🔍 Verifying Your Setup
Check Current Configuration
# View current settings
cat ./src/cuga/settings.toml | grep -A 2 "advanced_features"Expected output:
[advanced_features]
mode = 'hybrid'Check Service Status
# Check if demo services are running
cuga status demoExpected output:
Registry service: Running (PID: xxxxx)
Demo service: Running (PID: xxxxx)Verify Digital Sales API
The Digital Sales API should be accessible at the configured endpoint. You can test it directly:
# Test the remote API (default)
curl https://digitalsales.19pc1vtv090u.us-east.codeengine.appdomain.cloud/openapi.json
# Or test local API (if running locally)
curl http://localhost:8000/openapi.json🚨 Troubleshooting
Browser extension not appearing
- Make sure you're running in hybrid mode (
mode = 'hybrid'in settings.toml) - Verify Chromium is installed:
playwright install chromium - Check that the browser opened by CUGA (not a separate browser instance)
- Look for the CUGA extension icon in the browser toolbar
Digital Sales API not responding
If using remote API:
- Check your internet connection
- Verify the URL in
mcp_servers.yamlis correct - Try accessing the API docs: https://digitalsales.19pc1vtv090u.us-east.codeengine.appdomain.cloud/docs
If using local API:
- Make sure the API is running:
uv run fastapi dev docs/examples/digital_sales_openapi/main.py --port 8000 - Test the endpoint:
curl http://localhost:8000/openapi.json - Check the port isn't already in use
CUGA can't modify the web page
- Ensure you're on a web page that allows JavaScript modification
- Check browser console for errors (F12 → Console)
- Verify the browser extension is activated
- Some pages with strict Content Security Policy may block modifications
Services won't start
# Stop any running services
cuga stop demo
# Kill processes on the default ports if needed
# (Only if services are stuck)
lsof -ti:8001 | xargs kill -9 # Registry port
lsof -ti:8005 | xargs kill -9 # Demo port
# Restart
cuga start demo📚 Next Steps
After mastering hybrid mode, explore:
- Save & Reuse - Capture and reuse successful workflows
- MCP Integration - Add custom MCP servers and tools
- API Configuration - Integrate your own APIs
- Execution Modes - Fine-tune agent reasoning modes
📖 Additional Resources
- Digital Sales API Docs: https://digitalsales.19pc1vtv090u.us-east.codeengine.appdomain.cloud/docs
- CUGA Repository: https://github.com/cuga-project/cuga-agent
- Example Sales App: https://samimarreed.github.io/sales/
Hybrid mode working? You're all set!
