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

# search

> Search for companies and people using natural language

Build a company or people audience from a natural-language query. Searches return a JSON envelope with a dataset handle and, for asynchronous work, a workflow run handle.

## Usage

```bash theme={null}
landbase-cli search "<query>" [flags]
```

The shorthand `landbase-cli "<query>"` invokes the same search command.

## Flags

| Flag | Description | |
| - | - | - |
| \`--mode=default | research\` | Select the search mode. Omitting it defaults to `default`. `research` uses Advanced Dataset Creator for quoted SQL-backed research. |
| `--agent=<name>` | Legacy agent selector; ignored when `--mode` is provided. | |
| `--session=<label-or-id>` | Save or continue a multi-turn session. Labels are stored locally; UUID-shaped values are used as-is. | |
| `--download[=<path>]` | Download the result. Bare `--download` uses `results.jsonl`; extensions select JSONL, compressed JSONL, CSV, or Parquet behavior. | |
| \`--format=json | table\` | Output format; defaults to JSON. `table` prints prose only. |
| `--limit=<n>` | Maximum result count. | |
| `--timeout=<seconds>` | Request timeout; must be at least 1 second and defaults to 300 seconds. | |
| `--async` | Return the run ID immediately; recover it with `runs status` or `runs wait`. | |
| `--idempotency-key=<key>` | Retry an uncertain submission without starting duplicate work. Preserve the original query, session, mode or agent, and account. | |
| `--account=<id>` | Use a specific platform account for this request. | |
| `--open` / `--no-open` | Force or suppress opening the project URL. The default comes from `config open-in-browser`. | |
| `--no-update-check` | Skip the daily version check. | |
| `--verbose` | Print request and response details to stderr. | |

## Default mode

Use the default mode for ordinary audience building:

```bash theme={null}
landbase-cli search "find B2B SaaS companies in San Francisco"
landbase-cli search "find AI engineers in London" --limit=20 --format=table
```

To refine a prior search, reuse its session:

```bash theme={null}
landbase-cli search "find SaaS companies in London" --session=uk-saas
landbase-cli search "only show ones with 50-200 employees" --session=uk-saas
```

To scope a search to an uploaded dataset, name the onboarded dataset ID in the query. Use the onboarding workflow's `output_dataset_id`, not the raw upload ID.

## Research mode

Use `--mode=research` for SQL-backed research over the Landbase database. The flow drafts a query and quote first, then requires confirmation in the same session before starting the work:

```bash theme={null}
landbase-cli search --mode=research --session=state-counts \
  "How many companies are in each US state, sorted by count? Return the top 10."
landbase-cli search --mode=research --session=state-counts "yes, run it"
```

Drafting is free. The second turn starts the SQL work and may return a `workflow_run_id`; a completed response with a dataset ID is not necessarily the final workflow result. Poll the workflow with `workflow status` or `workflow wait`.

Research can be refused when the quote exceeds the account balance or cannot be priced. In that case the command exits successfully with the reason in `content` and no dataset is created.

## Advanced Dataset Creator compatibility

`--agent=advanced_dataset_creator` remains accepted as a legacy equivalent for custom SQL, aggregations, exact filters, ratios, and custom output columns. Prefer `--mode=research` for new scripts.

```bash theme={null}
landbase-cli search --agent=advanced_dataset_creator --session=sales-ratio \
  "Find companies where the AE-to-SDR ratio is between 1.5 and 3.0. Return company name, website, AE count, SDR count, and ratio."
```

## Asynchronous and recovery behavior

Use `--async` when you want the accepted run immediately:

```bash theme={null}
landbase-cli search "find fintech startups in NYC" --async --session=nyc-fintech
landbase-cli runs wait <run-id> --session=nyc-fintech
```

If a request times out or the connection drops after submission, do not repeat the search blindly. Reuse the same session and idempotency key, or recover the run with `runs latest` / `runs status`.

## Output

Successful search output has this shape:

```json theme={null}
{
  "run_id": "run_abc123",
  "session_id": "ses_xyz789",
  "status": "complete",
  "content": "Found 142 B2B SaaS companies in New York...",
  "download_url": null,
  "dataset_id": "ds_def456",
  "workflow_run_id": null,
  "workflow_name": null,
  "project_url": "https://gtm.landbase.com/project/ses_xyz789",
  "created_at": "2026-06-05T10:00:00Z"
}
```

`dataset_id` is the dataset handle for later workflow operations. `workflow_run_id` and `workflow_name` are populated when the search starts asynchronous workflow work. See [runs](https://www.landbase.com/docs/reference/cli/runs.md) and [workflow](https://www.landbase.com/docs/reference/cli/workflow.md) for recovery and polling.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.