Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

Fix ui instructions

f-trycua5e3ffcccf1db
diff --git a/libs/agent/README.md b/libs/agent/README.md
index 29974d5c50..7bbd365695 100644
--- a/libs/agent/README.md
+++ b/libs/agent/README.md
@@ -83,12 +83,34 @@ pip install "cua-agent[ui]"
# Create a simple launcher script
```python
+# launch_ui.py
from agent.ui.gradio.app import create_gradio_ui
app = create_gradio_ui()
app.launch(share=False)
```
+# Run the launcher
+python launch_ui.py
+```
+
+### Setting up API Keys
+
+For the Gradio UI to show available models, you need to set API keys as environment variables:
+
+```bash
+# For OpenAI models
+export OPENAI_API_KEY=your_openai_key_here
+
+# For Anthropic models
+export ANTHROPIC_API_KEY=your_anthropic_key_here
+
+# Launch with both keys set
+OPENAI_API_KEY=your_key ANTHROPIC_API_KEY=your_key python launch_ui.py
+```
+
+Without these environment variables, the UI will show "No models available" for the corresponding providers, but you can still use local models with the OMNI loop provider.
+
The Gradio UI provides:
- Selection of different agent loops (OpenAI, Anthropic, OMNI)
- Model selection for each provider
diff --git a/libs/agent/agent/core/types.py b/libs/agent/agent/core/types.py
index c1da69b1e1..27edd24cee 100644
--- a/libs/agent/agent/core/types.py
+++ b/libs/agent/agent/core/types.py
@@ -54,23 +54,6 @@ LLMModel = LLM
Model = LLM
-# Default models for each provider
-PROVIDER_TO_DEFAULT_MODEL: Dict[LLMProvider, str] = {
- LLMProvider.ANTHROPIC: "claude-3-7-sonnet-20250219",
- LLMProvider.OPENAI: "gpt-4o",
- LLMProvider.OLLAMA: "gemma3:4b-it-q4_K_M",
- LLMProvider.OAICOMPAT: "Qwen2.5-VL-7B-Instruct",
-}
-
-# Environment variable names for each provider
-PROVIDER_TO_ENV_VAR: Dict[LLMProvider, str] = {
- LLMProvider.ANTHROPIC: "ANTHROPIC_API_KEY",
- LLMProvider.OPENAI: "OPENAI_API_KEY",
- LLMProvider.OLLAMA: "none",
- LLMProvider.OAICOMPAT: "none",
-}
-
-
class AgentResponse(TypedDict, total=False):
"""Agent response format."""
diff --git a/notebooks/agent_nb.ipynb b/notebooks/agent_nb.ipynb
index b97a7a21d6..6699d15ed3 100644
--- a/notebooks/agent_nb.ipynb
+++ b/notebooks/agent_nb.ipynb
@@ -205,23 +205,41 @@
"source": [
"## Using the Gradio UI\n",
"\n",
- "The agent includes a Gradio-based user interface for easy interaction. To use it:\n",
+ "The agent includes a Gradio-based user interface for easy interaction. To use it:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import os\n",
+ "\n",
+ "# Get API keys from environment or prompt user\n",
+ "anthropic_key = os.getenv(\"ANTHROPIC_API_KEY\") or input(\"Enter your Anthropic API key: \")\n",
+ "openai_key = os.getenv(\"OPENAI_API_KEY\") or input(\"Enter your OpenAI API key: \")\n",
"\n",
- "```python\n",
+ "os.environ[\"ANTHROPIC_API_KEY\"] = anthropic_key\n",
+ "os.environ[\"OPENAI_API_KEY\"] = openai_key"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
"from agent.ui.gradio.app import create_gradio_ui\n",
"\n",
"app = create_gradio_ui()\n",
- "app.launch(share=False)\n",
- "```\n",
- "\n",
- "The Gradio UI provides:\n",
- "- Selection of different agent loops (OpenAI, Anthropic, OMNI)"
+ "app.launch(share=False)"
]
}
],
"metadata": {
"kernelspec": {
- "display_name": "cua",
+ "display_name": "Python 3",
"language": "python",
"name": "python3"
},
@@ -235,7 +253,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.11"
+ "version": "3.12.2"
}
},
"nbformat": 4,