Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

added extra validations.

Sandeep46009337fd7d
diff --git a/browser_use/__init__.py b/browser_use/__init__.py
index e67fe8f4e..cf7a277f7 100644
--- a/browser_use/__init__.py
+++ b/browser_use/__init__.py
@@ -85,6 +85,7 @@ _LAZY_IMPORTS = {
'ChatAnthropic': ('browser_use.llm.anthropic.chat', 'ChatAnthropic'),
'ChatGroq': ('browser_use.llm.groq.chat', 'ChatGroq'),
'ChatAzureOpenAI': ('browser_use.llm.azure.chat', 'ChatAzureOpenAI'),
+ 'ChatOCIRaw': ('browser_use.llm.oci_raw.chat', 'ChatOCIRaw'),
'ChatOllama': ('browser_use.llm.ollama.chat', 'ChatOllama'),
# LLM models module
'models': ('browser_use.llm.models', None),
@@ -130,6 +131,7 @@ __all__ = [
'ChatAnthropic',
'ChatGroq',
'ChatAzureOpenAI',
+ 'ChatOCIRaw',
'ChatOllama',
'Tools',
'Controller',
diff --git a/browser_use/cli.py b/browser_use/cli.py
index 54ffe2922..aeb6dd527 100644
--- a/browser_use/cli.py
+++ b/browser_use/cli.py
@@ -23,6 +23,7 @@ from dotenv import load_dotenv
from browser_use.llm.anthropic.chat import ChatAnthropic
from browser_use.llm.google.chat import ChatGoogle
+from browser_use.llm.oci_raw.chat import ChatOCIRaw
from browser_use.llm.openai.chat import ChatOpenAI
load_dotenv()
@@ -245,6 +246,10 @@ def get_llm(config: dict[str, Any]):
print('⚠️ Google API key not found. Please update your config or set GOOGLE_API_KEY environment variable.')
sys.exit(1)
return ChatGoogle(model=model_name, temperature=temperature)
+ elif model_name.startswith('oci'):
+ # OCI models require additional configuration
+ print('⚠️ OCI models require manual configuration. Please use the ChatOCIRaw class directly with your OCI credentials.')
+ sys.exit(1)
# Auto-detect based on available API keys
if api_key or CONFIG.OPENAI_API_KEY:
diff --git a/browser_use/llm/models.py b/browser_use/llm/models.py
index d09cd4c36..66ffdf386 100644
--- a/browser_use/llm/models.py
+++ b/browser_use/llm/models.py
@@ -15,6 +15,7 @@ from typing import TYPE_CHECKING
from browser_use.llm.azure.chat import ChatAzureOpenAI
from browser_use.llm.google.chat import ChatGoogle
+from browser_use.llm.oci_raw.chat import ChatOCIRaw
from browser_use.llm.openai.chat import ChatOpenAI
if TYPE_CHECKING:
@@ -108,8 +109,14 @@ def get_llm_by_name(model_name: str):
api_key = os.getenv('GOOGLE_API_KEY')
return ChatGoogle(model=model, api_key=api_key)
+ # OCI Models
+ elif provider == 'oci':
+ # OCI requires more complex configuration that can't be easily inferred from env vars
+ # Users should use ChatOCIRaw directly with proper configuration
+ raise ValueError(f"OCI models require manual configuration. Use ChatOCIRaw directly with your OCI credentials.")
+
else:
- available_providers = ['openai', 'azure', 'google']
+ available_providers = ['openai', 'azure', 'google', 'oci']
raise ValueError(f"Unknown provider: '{provider}'. Available providers: {', '.join(available_providers)}")
@@ -123,6 +130,8 @@ def __getattr__(name: str) -> 'BaseChatModel':
return ChatAzureOpenAI # type: ignore
elif name == 'ChatGoogle':
return ChatGoogle # type: ignore
+ elif name == 'ChatOCIRaw':
+ return ChatOCIRaw # type: ignore
# Handle model instances - these are the main use case
try:
@@ -135,6 +144,7 @@ __all__ = [
'ChatOpenAI',
'ChatAzureOpenAI',
'ChatGoogle',
+ 'ChatOCIRaw',
'get_llm_by_name',
# OpenAI instances - created on demand
'openai_gpt_4o',
diff --git a/docs/customize/agent/supported-models.mdx b/docs/customize/agent/supported-models.mdx
index 499a14976..9ed6e8e2e 100644
--- a/docs/customize/agent/supported-models.mdx
+++ b/docs/customize/agent/supported-models.mdx
@@ -196,6 +196,43 @@ Required environment variables:
GROQ_API_KEY=
```
+## Oracle Cloud Infrastructure (OCI) [example](https://github.com/browser-use/browser-use/blob/main/examples/models/oci_models.py)
+
+OCI provides access to various generative AI models including Meta Llama, Cohere, and other providers through their Generative AI service.
+
+```python
+from browser_use import Agent, ChatOCIRaw
+
+# Initialize the OCI model
+llm = ChatOCIRaw(
+ model_id="ocid1.generativeaimodel.oc1.us-chicago-1.amaaaaaask7dceya...",
+ service_endpoint="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com",
+ compartment_id="ocid1.tenancy.oc1..aaaaaaaayeiis5uk2nuubznrekd...",
+ provider="meta", # or "cohere"
+ temperature=0.7,
+ max_tokens=800,
+ top_p=0.9,
+ auth_type="API_KEY",
+ auth_profile="DEFAULT"
+)
+
+# Create agent with the model
+agent = Agent(
+ task="Your task here",
+ llm=llm
+)
+```
+
+Required setup:
+1. Set up OCI configuration file at `~/.oci/config`
+2. Have access to OCI Generative AI models in your tenancy
+3. Install the OCI Python SDK: `uv add oci` or `pip install oci`
+
+Authentication methods supported:
+- `API_KEY`: Uses API key authentication (default)
+- `INSTANCE_PRINCIPAL`: Uses instance principal authentication
+- `RESOURCE_PRINCIPAL`: Uses resource principal authentication
+
## Ollama
1. Install Ollama: https://github.com/ollama/ollama