6 min read21 hours ago
β
CUGA (Configurable Generalist Agent)
Press enter or click to view image in full size
Introduction β What is CUGA?
CUGA (ConfigUrable Generalist Agent) is an open-source generalist agent framework from IBM Research, purpose-built for enterprise automation. Designed for developers, CUGA combines and improves the best of foundational agentic patterns such as ReAct, CodeAct, and Planner-Executor β into a modular architecture enabling trustworthy, policy-aware, and composable automation across web interfaces, APIs, and custom enterprise systems.
CUGA achieves state-of-the-art performance on leading benchmarks:
- π₯ #1 on AppWorld β a benchmark with 750 real-world tasks across 457 APIs, and
- π₯ #2 on [WebArena](https:β¦
6 min read21 hours ago
β
CUGA (Configurable Generalist Agent)
Press enter or click to view image in full size
Introduction β What is CUGA?
CUGA (ConfigUrable Generalist Agent) is an open-source generalist agent framework from IBM Research, purpose-built for enterprise automation. Designed for developers, CUGA combines and improves the best of foundational agentic patterns such as ReAct, CodeAct, and Planner-Executor β into a modular architecture enabling trustworthy, policy-aware, and composable automation across web interfaces, APIs, and custom enterprise systems.
CUGA achieves state-of-the-art performance on leading benchmarks:
- π₯ #1 on AppWorld β a benchmark with 750 real-world tasks across 457 APIs, and
- π₯ #2 on WebArena β a complex benchmark for autonomous web agents across application domains.
Key features
- Complex task execution: State of the art results across Web and APIs.
- Flexible tool integrations: CUGA works across REST APIs via OpenAPI specs, MCP servers, and custom connectors.
- Composable agent architecture: CUGA itself can be exposed as a tool to other agents, enabling nested reasoning and multi-agent collaboration.
- Configurable reasoning modes: Choose between fast heuristics or deep planning depending on your taskβs complexity and latency needs.
- Policy-aware instructions (Experimental): CUGA components can be configured with policy-aware instructions to improve alignment of the agent behavior.
- Save & Reuse (Experimental): CUGA captures and reuses successful execution paths, enabling consistent and faster behavior across repeated tasks.
ReAct Agents β TL;DR
ReAct (Reasoning and Acting) agents are a powerful framework for AI agents that enhance a Large Language Modelβs (LLM) ability to handle complex, multi-step tasks by integrating logical reasoning (Thought) with external action (Action) in a continuous, interleaved loop. The core idea is to prompt the LLM to alternate between articulating its chain-of-thought to plan and track its progress, and executing actions like using a search engine, calling an API, or interacting with a database. This continuous cycle of Thought β Action β Observation allows the agent to dynamically gather external information, adjust its plan based on the results of its actions, overcome issues like factual hallucinations, and ultimately reach a more accurate and reliable final answer than reasoning-only or action-only approaches.
CodeAct Agents β TL;DR
CodeAct agents are a specialized type of AI agent that use executable Python code as a unified action space to interact with their environment, rather than being limited to pre-defined tools or formatted text commands. Integrated with a sandboxed Python interpreter, a CodeAct agent can generate a code snippet (its βactionβ), execute it, and then receive the output or any error message as an Observation. This iterative code execution and self-debugging loop allows the agent to dynamically utilize existing software packages, handle complex logic like loops and conditionals, and correct its mistakes in real-time, making it exceptionally powerful for sophisticated tasks such as data analysis, model training, and composing multiple APIs in a flexible manner. Essentially, the CodeAct paradigm turns the Large Language Model (LLM) into an autonomous developer, enabling it to write, run, and refine its own solutions.
Planner-Executor Agents β TL;DR
Planner-Executor agents represent an architectural pattern designed to enhance the reliability and efficiency of Large Language Model (LLM) agents by explicitly separating the thinking phase from the action phase. In this framework, the Planner (often a powerful LLM) first generates a comprehensive, multi-step strategy to achieve a complex goal. Subsequently, a separate Executor component is responsible for carrying out the plan one step at a time, using tools or APIs to perform specific actions. This separation provides several benefits: it enforces long-term planning, allows for a faster execution loop by reducing the need to consult the large LLM after every action, and permits the use of smaller, more cost-effective models for the execution phase. If an execution step fails or new information is observed, the agent can re-engage the planner to dynamically revise the remaining plan.
In short, the **CUGA **project offers enterprise agent builders a powerful, open-source, and modular framework specifically designed for enterprise automation. It combines the foundational agentic patterns mentioned above, into a single architecture.
Testing CUGA Locally
Hereafter the steps to try CUGA locally β¬οΈ
- Python 3.12
- uv package manager
# In terminal, clone the repository and navigate into itgit clone https://github.com/cuga-project/cuga-agent.gitcd cuga-agent# 1. Create and activate virtual environmentuv venv --python=3.12 && source .venv/bin/activate# 2. Install dependenciesuv sync# 3. Set up environment variables# Create .env file with your API keysecho "OPENAI_API_KEY=your-openai-api-key-here" > .env# 4. Start the democuga start demo# Chrome will open automatically at https://localhost:8005# then try sending your task to CUGA: 'get top account by revenue from digital sales'
CUGA supports multiple LLM providers with flexible configuration options. You can configure models through TOML files or override specific settings using environment variables.## Supported Platforms- **OpenAI** - GPT models via OpenAI API (also supports LiteLLM via base URL override)- **IBM WatsonX** - IBM's enterprise LLM platform- **Azure OpenAI** - Microsoft's Azure OpenAI service- **RITS** - Internal IBM research platform## Configuration Priority1. **Environment Variables** (highest priority)2. **TOML Configuration** (medium priority)3. **Default Values** (lowest priority)### Option 1: OpenAI π**Setup Instructions:**1. Create an account at [platform.openai.com](https://platform.openai.com)2. Generate an API key from your [API keys page](https://platform.openai.com/api-keys)3. Add to your `.env` file: ```env # OpenAI Configuration OPENAI_API_KEY=sk-...your-key-here... AGENT_SETTING_CONFIG="settings.openai.toml" # Optional overrides MODEL_NAME=gpt-4o # Override model name OPENAI_BASE_URL=https://api.openai.com/v1 # Override base URL OPENAI_API_VERSION=2024-08-06 # Override API version
Examples
There are several ready-to-run examples available on the repository and you can even access one online.
Press enter or click to view image in full size
Below you can see the CUGA as MCP sample π
from cuga.backend.activity_tracker.tracker import ActivityTrackerfrom cuga.backend.cuga_graph.utils.controller import AgentRunner as CugaAgent, ExperimentResult as AgentResultfrom fastmcp import FastMCPimport os# Initialize componentstracker = ActivityTracker()mcp = FastMCP("CUGA Running as MCP π")# Set the environment file to the .env file in the current directoryos.environ["ENV_FILE"] = os.path.join(os.path.dirname(__file__), ".env")os.environ["MCP_SERVERS_FILE"] = os.path.join(os.path.dirname(__file__), "mcp_servers.yaml")@mcp.toolasync def run_api_task(task: str) -> str: """ Run a task using API mode only - headless browser automation without GUI interaction Args: task: The task description to execute Returns: str: The result of the task execution """ os.environ["DYNA_CONF_ADVANCED_FEATURES__MODE"] = "api" cuga_agent = CugaAgent(browser_enabled=False) await cuga_agent.initialize_appworld_env() task_result: AgentResult = await cuga_agent.run_task_generic(eval_mode=False, goal=task) return task_result.answerasync def run_web_task(task: str, start_url: str) -> str: """ Run a task using web mode only - browser automation with GUI interaction Args: task: The task description to execute start_url: The starting URL for the task Returns: str: The result of the task execution """ os.environ["DYNA_CONF_ADVANCED_FEATURES__MODE"] = "web" cuga_agent = CugaAgent(browser_enabled=False) try: await cuga_agent.initialize_freemode_env(start_url=start_url, browser_mode="browser_only") task_result: AgentResult = await cuga_agent.run_task_generic(eval_mode=False, goal=task) except Exception: if hasattr(cuga_agent, "env") and cuga_agent.env: cuga_agent.env.close() raise else: cuga_agent.env.close() return task_result.answer@mcp.toolasync def run_hybrid_task(task: str, start_url: str) -> str: """ Run a task using hybrid mode - combination of API and web interaction Args: task: The task description to execute start_url: The starting URL for the task Returns: str: The result of the task execution """ os.environ["DYNA_CONF_ADVANCED_FEATURES__MODE"] = "hybrid" cuga_agent = CugaAgent(browser_enabled=False) try: await cuga_agent.initialize_freemode_env(start_url=start_url, browser_mode="browser_only") task_result: AgentResult = await cuga_agent.run_task_generic(eval_mode=False, goal=task) except Exception: if hasattr(cuga_agent, "env") and cuga_agent.env: cuga_agent.env.close() raise else: cuga_agent.env.close() return task_result.answerdef main(): """Main function to run the MCP server.""" print("Starting FastMCP server...") print("Server must be running before starting the main application.") mcp.run(transport="sse")if __name__ == "__main__": main()
# API Mode - Headless executionresult = await mcp_client.call_tool("run_api_task", { "task": "get my top account by revenue"})# Web Mode - Browser GUI executionresult = await mcp_client.call_tool("run_web_task", { "task": "navigate to dashboard and get revenue data", "start_url": "https://example.com"})# Hybrid Mode - Combined executionresult = await mcp_client.call_tool("run_hybrid_task", { "task": "analyze data from API and web interface", "start_url": "https://example.com"})
Once the pre-required environment is set-up and all the API keys are provided, the code could be tested locally.
Conclusion
CUGA (ConfigUrable Generalist Agent) is an exemplary open-source agent framework from IBM Research that establishes a new benchmark for trustworthy enterprise automation. It achieves state-of-the-art performance, securing the #1 rank on AppWorld and #2 on WebArena, demonstrating superior capability in complex task execution across web and APIs. By combining and improving foundational agentic patterns like ReAct, CodeAct, and Planner-Executor into a modular, composable, and policy-aware architecture, CUGA offers developers an indispensable, flexible solution. Ultimately, CUGA is the definitive framework for building robust, reliable, and scalable agents, ready to take on the most intricate workflows across modern enterprise systems.
Thanks for reading π€
Links
- CUGA Site: https://ibm-cuga.19pc1vtv090u.us-east.codeengine.appdomain.cloud/
- CUGA Project: https://github.com/cuga-project/cuga-agent?tab=readme-ov-file
- CUGA Examples: https://github.com/cuga-project/cuga-agent/tree/main/docs/examples
- ReAct Agents: https://www.ibm.com/think/topics/react-agent
- CodeAct Agents: https://machinelearning.apple.com/research/codeact
- Planner-Executor Agents: https://www.emergentmind.com/topics/planner-executor-architecture
- What is AI agent planning?: https://www.ibm.com/think/topics/ai-agent-planning