CUGA Agent

0.2.21 · active · verified Thu Apr 16

CUGA is an open-source generalist agent for the enterprise, supporting complex task execution on web and APIs, OpenAPI/MCP integrations, composable architecture, reasoning modes, and policy-aware features. It is under active development, with minor versions released frequently introducing new features and improvements.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a `CugaAgent` and invoke it with a simple task. It relies on environment variables (like `OPENAI_API_KEY`) for LLM configuration, which can be loaded from a `.env` file using `python-dotenv`.

import os
from dotenv import load_dotenv
from cuga.agent import CugaAgent

# Load environment variables from a .env file if present
load_dotenv()

# Ensure your OpenAI API key is set in your environment (e.g., in a .env file or directly)
# For testing, you can explicitly set it or retrieve it safely.
# os.environ['OPENAI_API_KEY'] = os.environ.get('OPENAI_API_KEY', 'your-openai-api-key-here')

# Initialize the agent. It will pick up LLM configurations from environment variables.
cuga_agent = CugaAgent()

# Define a task for the agent
task = "Explain the concept of quantum entanglement in simple terms."

# Invoke the agent with the task
try:
    response = cuga_agent.invoke(task=task)
    # Print the agent's response
    print(f"Agent's response: {response.result}")
except Exception as e:
    print(f"An error occurred: {e}")
    print("Please ensure your LLM API keys (e.g., OPENAI_API_KEY) are correctly set in your environment.")

view raw JSON →