> ## Documentation Index
> Fetch the complete documentation index at: https://docs.simultaneous.live/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI

> Command-line interface for managing Simultaneous projects and agents

## Installation

```bash theme={null}
pip install simultaneous-cli
```

Verify installation:

```bash theme={null}
sim --help
```

## Quick Start

```bash theme={null}
# 1. Sign up
sim auth signup

# 2. Create a project
sim projects create "My Project"

# 3. List your projects
sim projects list
```

## Authentication

```bash theme={null}
# Sign up for a new account
sim auth signup

# Sign in (opens browser)
sim auth signin --web

# Check if you're signed in
sim auth status

# Show current user
sim auth whoami

# Sign out
sim auth signout
```

## Organization Management

### Create Organization

```bash theme={null}
sim orgs create "My Organization"
```

### List Organizations

```bash theme={null}
sim orgs list
```

## Project Management

### Create a Project

```bash theme={null}
# Basic project creation
sim projects create "My First Project"

# With custom slug
sim projects create "My First Project" --slug my-first-project
```

**Example:**

```bash theme={null}
$ sim projects create "Web Scraping Project"
Created project: abc123-def456-ghi789
Name: Web Scraping Project
```

### List Projects

```bash theme={null}
# List all projects
sim projects list

# List only active projects (exclude archived)
sim projects list --archived=false

# List archived projects
sim projects list --archived=true
```

**Example output:**

```bash theme={null}
$ sim projects list
ID                                    Name                  Status
abc123-def456-ghi789                  Web Scraping Project  active
xyz789-abc123-def456                  Test Project          archived
```

### Get Project Details

```bash theme={null}
sim projects get <project-id>
```

**Example:**

```bash theme={null}
$ sim projects get abc123-def456-ghi789
ID: abc123-def456-ghi789
Name: Web Scraping Project
Status: active
Created: 2024-01-15T10:30:00Z
```

### Delete Project

```bash theme={null}
sim projects delete <project-id>
```

**Warning:** This permanently deletes the project and all associated agents and runs.

## Agent Management

### Create an Agent

Create an agent with inline script:

```bash theme={null}
sim agents create <project-id> \
  --name my-scraper \
  --script "print('Hello from agent')" \
  --provider-project-id proj_xxx \
  --region sfo
```

Create an agent from a script file:

```bash theme={null}
sim agents create <project-id> \
  --name my-scraper \
  --script-file ./my_agent.py \
  --provider-project-id proj_xxx \
  --region sfo \
  --description "Scrapes job listings"
```

**Full example with all options:**

```bash theme={null}
sim agents create abc123-def456-ghi789 \
  --name google-search-agent \
  --script-file ./google_search.py \
  --provider-project-id proj_browserbase123 \
  --region sfo \
  --description "Searches Google and extracts results" \
  --env-vars '{"API_KEY":"secret123"}' \
  --timeout-sec 600
```

**Parameters:**

* `--name`: Agent name (required)
* `--script`: Inline Python script (mutually exclusive with `--script-file`)
* `--script-file`: Path to Python script file (mutually exclusive with `--script`)
* `--provider-project-id`: Browserbase project ID (required)
* `--region`: Browserbase region (default: "sfo")
* `--description`: Agent description (optional)
* `--env-vars`: JSON-encoded environment variables (optional)
* `--context-id`: Context ID for agent (optional)
* `--extension-id`: Browser extension ID (optional)
* `--timeout-sec`: Timeout in seconds (optional)

### List Agents

```bash theme={null}
# List all agents in a project
sim agents list <project-id>

# List only active agents
sim agents list <project-id> --active-only

# List all agents including inactive
sim agents list <project-id> --active-only=false
```

**Example:**

```bash theme={null}
$ sim agents list abc123-def456-ghi789
ID                                    Name                  Status
agent-123                             google-search-agent   active
agent-456                             test-agent           inactive
```

### Get Agent Details

```bash theme={null}
sim agents get <project-id> <agent-id>
```

**Example:**

```bash theme={null}
$ sim agents get abc123-def456-ghi789 agent-123
ID: agent-123
Name: google-search-agent
Status: active
Provider Project ID: proj_browserbase123
Region: sfo
Created: 2024-01-15T10:30:00Z
```

### Delete Agent

```bash theme={null}
sim agents delete <project-id> <agent-id>
```

**Example:**

```bash theme={null}
sim agents delete abc123-def456-ghi789 agent-123
```

## Running Agents

### Run an Agent

```bash theme={null}
sim run <agent-name> \
  --project-id <project-id> \
  --agent-id <agent-id> \
  --params '{"query":"test"}'
```

**Example:**

```bash theme={null}
# Run with simple parameters
sim run google-search-agent \
  --project-id abc123-def456-ghi789 \
  --agent-id agent-123 \
  --params '{"query":"python tutorials"}'

# Run with complex parameters
sim run google-search-agent \
  --project-id abc123-def456-ghi789 \
  --agent-id agent-123 \
  --params '{"query":"python","max_results":10,"filter":"recent"}'
```

**Parameters:**

* `--project-id`: Project ID (required)
* `--agent-id`: Agent ID (required)
* `--params`: JSON-encoded parameters (required)
* `--parallel`: Number of parallel runs (optional, default: 1)

## Complete Workflow Example

Here's a complete example of using the CLI from start to finish:

```bash theme={null}
# 1. Sign up or sign in
sim auth signup
# OR
sim auth signin --web

# 2. Create a project
sim projects create "My Scraping Project"
# Note the project ID from output: abc123-def456-ghi789

# 3. Create an agent
cat > my_agent.py << 'EOF'
import asyncio
from simultaneous import SimClient, Browsers, Models

async def main():
    sim = SimClient(project_id="abc123-def456-ghi789")
    browser = sim.browser_client(
        provider=Browsers.BROWSERBASE,
        model_name=Models.O4_MINI,
    )
    async with browser:
        page = browser.page
        await page.goto("https://example.com")
        await page.act("search for 'python'")
        await page.screenshot(path="result.png")

if __name__ == "__main__":
    asyncio.run(main())
EOF

sim agents create abc123-def456-ghi789 \
  --name my-scraper \
  --script-file ./my_agent.py \
  --provider-project-id proj_your_browserbase_id \
  --region sfo

# 4. List agents to get agent ID
sim agents list abc123-def456-ghi789

# 5. Run the agent
sim run my-scraper \
  --project-id abc123-def456-ghi789 \
  --agent-id agent-123 \
  --params '{"query":"test"}'

# 6. Check project status
sim projects get abc123-def456-ghi789
```

## Marketplace (Future)

```bash theme={null}
# Publish agent to marketplace
sim marketplace publish <agent-id> \
  --project-id <project-id> \
  --public

# List marketplace agents
sim marketplace list

# Deploy agent from marketplace
sim marketplace deploy <marketplace-agent-id> <project-id>
```

## Deployment (Future)

```bash theme={null}
# Deploy agent to cloud
sim deploy agent <project-id> <agent-id>
```

## Getting Help

```bash theme={null}
# General help
sim --help

# Help for specific command
sim auth --help
sim projects --help
sim agents --help
sim run --help
```

## Environment Variables

**Optional:**

* `SIMULTANEOUS_API_KEY` - API key (can use `sim auth` instead)
