Skip to content

CLI

The @philschmid/agent package includes a CLI that lets you send prompts to the agent directly from your terminal — as an argument or via piped stdin.


Install the package globally to use the agent command:

Terminal window
bun add -g @philschmid/agent

Set your API key:

Terminal window
export GEMINI_API_KEY="your-api-key"

Terminal window
agent "Explain what a closure is in JavaScript"
Terminal window
echo "Summarize this" | agent
cat README.md | agent "Explain this file"
cat src/index.ts | agent --tools read,grep --system "You are a code reviewer"

FlagShortTypeDefaultDescription
--model-mstringgemini-3-flash-previewModel ID
--tools-tstringAll toolsComma-separated tool names
--system-sstringSystem instruction
--help-hbooleanShow usage

sleep, plan, read, write, grep, bash, web_fetch, web_search, skills, subagent

When --tools is omitted, all tools are loaded. Restrict tools to limit what the agent can do — e.g. --tools read,grep for read-only analysis.


Code review a file:

Terminal window
cat src/utils.ts | agent --system "Review this code for bugs and suggest improvements"

Summarize with a specific model:

Terminal window
cat report.md | agent -m gemini-3-flash-preview "Summarize in 3 bullet points"

Read-only analysis (no write/bash access):

Terminal window
agent --tools read,grep "Find all TODO comments in the src/ directory"