Agent
Start Lightpanda as an interactive AI agent that can browse the web. See how to run the agent for practical documentation.
Options
usage: lightpanda agent [SCRIPT] [OPTIONS] [COMMON_OPTIONS]
Arguments:
[SCRIPT]
Optional path to a .js script, or `-` for stdin. Runs the script
(no LLM calls) and exits; `lightpanda run SCRIPT` is the preferred
spelling. With no script and no --task, the REPL starts; from
there /load runs a script and /save exports the session to a file.
Caution: .js files can contain evaluate(...) calls that run
arbitrary JavaScript in the page. Only run scripts you trust, the
same way you would a shell script.
Options:
-a, --attach <PATH>
Feed a local file to the model alongside --task. Repeatable, one
file per flag. Text files are inlined (max 512 KiB each);
images/audio/pdf are base64-encoded (max 20 MiB each).
Requires --task.
--base-url <URL>
Override the API base URL for the provider. Defaults to the
provider's standard endpoint.
Ollama default: http://localhost:11434/v1.
llama.cpp default: http://localhost:8080/v1.
Hugging Face default is the serverless router
(https://router.huggingface.co/v1);
point this at a dedicated Inference Endpoint to use one.
--effort <LEVEL>
Per-turn reasoning budget, mapped to each provider's native
thinking/reasoning knob. Default: low in the REPL (snappy turns),
medium in one-shot --task mode, unless the provider sets its own
default (Mistral defaults to none, as its default model rejects
effort). In the REPL, use /effort to change it.
Allowed values: none, minimal, low, medium, high, xhigh.
--list-models
Print the model IDs usable with `agent` for --provider, one per
line, sorted, and exit. Auto-detects the provider from env when
--provider is omitted.
--model <MODEL>
The model name to use. Defaults to a sensible default per
provider. In the REPL, use /model to list and change models for
the active provider.
--no-llm
Force the basic REPL even when an API key is present or
--provider is set. Useful for testing slash commands without
burning tokens, or for disabling the LLM in a saved command
without editing the existing flags. Wins over --provider.
--provider <PROVIDER>
The AI provider. When omitted, lightpanda auto-detects an API
key from your environment (ANTHROPIC_API_KEY, OPENAI_API_KEY,
GOOGLE_API_KEY/GEMINI_API_KEY, HF_TOKEN, AI_GATEWAY_API_KEY,
MISTRAL_API_KEY, OPENROUTER_API_KEY, VERTEX_API_KEY). With
exactly one key set:
that provider is used. With multiple keys on a TTY: you'll be
prompted to pick; in non-interactive contexts, pass --provider
explicitly. With no keys set: falls back to the basic REPL
(slash commands only, no natural-language input, no LOGIN /
ACCEPT_COOKIES keywords).
openai_compatible targets any OpenAI-style server via
OPENAI_BASE_URL + OPENAI_API_KEY; it is auto-detected when
OPENAI_BASE_URL is set.
Vertex project mode (GOOGLE_CLOUD_PROJECT + a gcloud token)
works with --provider vertex; it is only auto-detected when
GOOGLE_GENAI_USE_VERTEXAI=1 is set too.
Local servers (ollama, llama_cpp) are never auto-detected (they
need no key); select them explicitly with --provider ollama /
--provider llama_cpp. Same for codex, which uses a ChatGPT
subscription (OAuth) instead of an API key.
Allowed values: "anthropic", "openai", "gemini", "huggingface",
"vercel", "mistral", "openrouter", "ollama",
"llama_cpp", "vertex", "codex",
"openai_compatible".
In the REPL, use /provider to list and change providers.
--save <PATH>
Synthesize a replayable .js script from the --task run and write
it to PATH, instead of printing the answer. Replay it later with
`run PATH` (no LLM calls). Overwrites PATH if it exists.
Requires --task.
--search-engine <ENGINE>
Which web search API the `search` tool uses. Default: auto,
which takes the first with a key in the environment, in the
order brave, tavily, exa, keenable. `keenable` also works with
no key at all, through a rate-limited public endpoint.
Allowed values: auto, brave, tavily, exa, keenable.
--system-prompt <STRING>
Override the default system prompt.
--task <STRING>
One-shot mode: run a single user turn, print the final answer
to stdout, and exit. Conflicts with the positional script. With
--save, the answer is suppressed and a script is written instead.
--url <URL>
Open this page before the first turn. With --task it saves the
model a turn spent navigating; with --save the opening
navigation is the first line of the script.
--verbosity <LEVEL>
Stderr chatter level. Default: high when --task captures stderr
to a pipe or file; low otherwise. low/medium also raise
--log-level to err (mutes page-side console.error spam) unless
--log-level is set explicitly.
Allowed values:
low silent in --task mode (final answer to stdout only);
spinner + summary in REPL.
medium + one `● [tool: ...]` line per call.
high + the matching `[result: ...]` body (required by the
benchmarks harness).The provider, model, effort, and verbosity you choose in the REPL are remembered per-directory in .lp-agent.zon and reused on the next run.
API keys are read from the environment: ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY/GEMINI_API_KEY, HF_TOKEN, AI_GATEWAY_API_KEY, MISTRAL_API_KEY, or OPENROUTER_API_KEY. Any other OpenAI-compatible server is used through OPENAI_BASE_URL + OPENAI_API_KEY. The local servers (Ollama, llama.cpp) do not require an API key.
Examples
lightpanda agent (auto-detects API key from env)
lightpanda agent --provider anthropic --model claude-sonnet-4-6
lightpanda agent --provider huggingface (HF serverless router, HF_TOKEN)
lightpanda agent --provider openrouter --model anthropic/claude-sonnet-5
lightpanda agent --provider ollama --model qwen3.5:latest
lightpanda agent --no-llm (basic slash-command-only REPL)
lightpanda agent --task "..." --save out.js (synthesize a replayable script)The command also accepts the common options.
REPL commands
Inside the REPL, slash commands work alongside natural-language input:
| Command | Description |
|---|---|
/help [command] | List commands, or show help for one |
/quit | Exit the REPL |
/verbosity <level> | Set agent verbosity (low, medium, high) |
/effort <level> | Set per-turn reasoning effort (none, minimal, low, medium, high, xhigh) |
/stream [on|off] | Toggle streaming of assistant text |
/searchEngine <engine> | Change the web search engine (auto, brave, tavily, exa, keenable) |
/usage | Show token usage and cache stats for this session |
/clear | Clear conversation history and usage (keeps page and cookies) |
/reset | Reset conversation and browser session (drops page and cookies) |
/save [filename.js] [prompt] | Save this session to a file as a PandaScript |
/load <path> | Load and run a script from disk |
/model [name] | Change the model |
/provider [name] | Change the provider, or null to disable the LLM |
Search engine. An API key is optional. By default (auto mode) search uses Keenable’s keyless public endpoint, rate-limited per client IP. To route through a specific provider, set BRAVE_API_KEY, TAVILY_API_KEY, EXA_API_KEY, or KEENABLE_API_KEY; auto tries Brave, Tavily, Exa, then Keenable in that order, using whichever keys are set.
Three commands send a prebuilt prompt to the model instead of configuring the REPL:
| Command | Description |
|---|---|
/login | Log in using $LP_* credentials |
/logout | Log out of the current site |
/acceptCookies | Dismiss the cookie consent banner |
Every browser tool is also callable directly as a slash command with key=value arguments, with no LLM call, e.g. /goto url=https://example.com, /tree, or /nodeDetails backendNodeId=12.