agentuse run
Execute an agent file.Syntax
Arguments
string
required
Path to agent file (.agentuse or .md extension) or HTTPS URL
string
Optional additional prompt to append to the agent’s instructions
Options
The
--quiet and --debug options cannot be used together.You can also set
NO_TTY=true to force plain logging without spinners.Directory and Path Resolution
Directory Override (-C, —directory)
The-C or --directory option is the starting directory for the command:
Project Root Detection
AgentUse searches from the current directory upward for.agentuse/, .git/, or package.json. If none are found, the starting directory is the project root.
The project root is used for:
- Loading
.envfiles - Finding plugins in
.agentuse/plugins/ - Owning shared stores in
.agentuse/store/ - Grouping session state
agentuse serve, -C also defines the served scope: only .agentuse files under that directory are exposed, while state still belongs to the detected project root.
This is useful for:
- Running agents from different projects
- CI/CD environments with complex directory structures
- Testing with different configurations
Path Resolution Rules
Subagent paths and MCP server commands are resolved relative to the agent file’s directory.See Agent Syntax - Subagents for complete path resolution examples.
Model Override
The--model option allows you to override the model specified in an agent file at runtime. This is useful for:
- Testing: Compare agent behavior across different models
- Cost Optimization: Use cheaper models for development/testing
- Environment-Specific Models: Different models for dev/staging/production
- Quick Experiments: Try new models without editing files
Format
provider: A built-in provider (anthropic,openai,openrouter,opencode-go,bedrock) or a custom provider namemodel: The specific model name (e.g.,claude-sonnet-4-6,gpt-5.5,glm-5-flash:q4_K_M), or a version alias such asclaude-sonnetenv: Optional environment suffix for API keys (e.g.,dev,prod, or full env var name), built-in providers only
@name alias also works: --model @fast.
Examples
An explicit model override propagates to every nested sub-agent. Without
--model, each agent uses the model declared in its own file; a parent’s
configured model is not inherited. Alias fallback candidates and cooldowns
propagate as one resolved policy and remain stable across session resume.agentuse test
Test an agent in mock mode: side effects fabricated, approval gates auto-resolved, stores isolated. This is the recommended way to validate a new or changed agent before letting it run for real.--quiet, --debug, --no-tty, --compact, --timeout, -C, --env-file, -m/--model, --json).
tools.bash.gated patterns (the irreversible subset the author already fenced off) are fabricated, and the gates guarding them auto-approve. Every other tool (reads, non-gated bash, MCP, skills) runs for real, so the agent grounds itself in real project state. The run completes end-to-end, unattended, with zero irreversible side effects, and the session log shows the full gate flow (the await_human call with its changes[], the deterministic approval, the fabricated command result) for review.
- Stores are isolated under mock: reads are seeded by copying the real store, writes land in
<projectRoot>/.agentuse/store-mock/<timestamp>-<pid>/(kept for inspection), and the real store, including the reservedmetricsstore behind dashboards, is never touched. - Test runs stay out of the ops views: mock sessions are excluded from the serve home dashboard (latest results, failure triage), agent health/sparklines, and the sessions list by default, and they never fire push notifications. Flip the sessions view’s “mock runs” filter to
shown/only mock(API:?mock=include|only) to see them; a mock session’s detail page is always reachable by id. - In the effect WAL, a fabricated gated command has a
lease-approvedentry but nobash-spawnentry; that absence is the audit signal it never executed. - An agent with no
tools.bash.gatedpatterns under gated scope gets a warning: nothing is mocked, everything runs real (with gates auto-resolved).
Full mock (--scope all, or run --mock)
Full-scope mock answers every tool call with an LLM-generated result instead of executing it. The agent runs for real; only tool execution is faked. The same mode is available as low-level plumbing on run:
- A mock model is required. Mock fires an LLM call for every tool result, so it must run on a model you can reach. It is deliberately not defaulted to the agent’s own model: that ran mock onto the agent’s premium, rate-limited token and produced opaque
429s. Provide it per run with--mock-model, or set a global default once viaAGENTUSE_MOCK_MODELin the shell,~/.agentuse/.env, or theenvblock of~/.agentuse/config.json. The flag wins over all of them. - Sub-agents run for real; their leaf tools are mocked.
- The approval gate stays real under
run --mock:await_humanstill suspends so you can verify the agent pauses for approval. Pass--mock-approvalfor fully-unattended runs (agentuse testdefaults to this): the gate resolves deterministically (no LLM plays the reviewer) instead of suspending.--mock-approval(or--mock-approval approve) auto-approves. The approval grants the gated-command lease derived from the gate’schanges[]exactly like a real reviewer approval, sotools.bash.gatedflows complete end-to-end. On a pick gate the recommended option is chosen (else the first), returned aschoice.--mock-approval rejectforces the reject branch: the gate seals (terminal for the run) so you can test the agent’s cleanup path.--mock-approval comment:<text>forces the revise-and-re-gate branch with<text>as the reviewer comment. The comment applies to the first gate only; the re-gate that follows is approved, so the run exercises the revision path and still finishes. (Repeating the comment on every gate would loop an obedient agent until it gave up.)
MCP servers still connect at startup for tool discovery, but no tool executes (no mutations). Mock outputs are non-deterministic; mocked approval decisions are deterministic.
Remote Agent Security
When running agents from remote URLs:- HTTPS Only: Only HTTPS URLs are allowed for security
- File Extension: Remote agents must have
.agentuseextension - Interactive Confirmation: AgentUse will show a security warning with options:
[p]review- Fetch and display the agent content before running[y]es- Execute the agent directly[N]o- Abort execution (default)
Examples
agentuse sessions
View and resume AgentUse sessions.Syntax
agentuse sessions is a shortcut for agentuse sessions list.
Session data is stored globally and partitioned by project. CLI session commands default to the current project; use --all or --all-search when you are not sure which project owns a session.
List Sessions
Show a Session
Resume a Session
Useagentuse sessions resume for local continuation. It supports suspended approval sessions and ended sessions.
For a suspended approval session:
--remember saves the comment as a future instruction, and requires --comment (a non-empty one). Bare --remember reuses the comment text; passing a value (--remember "...") overrides it. Passing --remember is itself the opt-in, so saving needs no learning config on the agent. The comment is still the feedback for this revision; the instruction is distilled from it, stored as src:manual, and injected into future runs once the agent has learning.apply enabled. It is also vetted against the agent’s own instructions: a note that contradicts them is still saved, but quarantined with the conflict named rather than injected.
For a suspended non-approval await_* tool:
Reconcile Stuck Sessions
Settle sessions still markedrunning whose owning process is gone. This is the same owner-liveness check agentuse serve performs at startup, but it sweeps as far back as you ask instead of the daemon’s 30-day window.
agentuse run all keep their session as-is, because the session records its owning process and reconcile checks that the process is actually alive. A 10-minute recency window backs that up, so a session written to very recently is left alone even if it comes from a build that predates owner tracking.
Sessions suspended on a subagent that died are settled the same way, so a manager waiting on a child that will never report back stops sitting in limbo.
Why this exists: runs orphaned before serve’s 30-day startup window stayed
running forever, inflating the dashboard’s needs-attention counts with work that ended long ago.Show Storage Path
agentuse serve
Start the AgentUse HTTP daemon to run agents via API. This enables integration with external applications, webhooks, approvals, Slack notifications, or any system that can make HTTP requests.Syntax
Options
Serving Multiple Projects
AgentUse runs one serve daemon at a time. Repeat-C on that daemon to serve multiple scopes/projects:
-C directory basename. Duplicate ids fail startup. Each scope detects its project root independently, and each project loads its own .env / .env.local in its worker process.
Use the request project field to choose a project. In multi-project mode, omitting it returns 400 PROJECT_REQUIRED unless --default <id> is set.
Starting a second daemon fails with the PID, address, projects, and log path of the daemon that is already running. This keeps approval links, Slack replies, session resumes, and API traffic routed through one owner.
Global Config
You can put serve defaults in~/.agentuse/config.json. See Configuration Files for the schema and CLI override behavior.
Authentication
When binding to exposed hosts (not127.0.0.1 or localhost), API key authentication is required:
API Endpoints
All JSON endpoints are served under the/api/* prefix; the un-prefixed root
paths (/, /agents, /sessions, /schedules, /stores, /approvals) serve
HTML dashboard pages. GET / is the dashboard home: it links to those pages and
lists the served projects with their agent and schedule counts. The per-session
page /sessions/:id and its action
subroutes (/decision, /continue, /status) carry their own capability auth
(session token / API key / local). POST /run, POST /resume/:id, and the
POST /approvals/:id/... action endpoints remain reachable at their original
paths for backward compatibility, and GET /approvals/:id redirects to
/sessions/:id (prefer the /api/* and /sessions paths; the legacy aliases
will be removed later).
GET /api
Returns version, default project, and served projects. (GET / serves the HTML
dashboard built from the same data.)
update is present only when the cached npm registry result contains a newer
AgentUse version from npm’s latest dist-tag. The dashboard uses it for its
dismissible update banner.
default is null in multi-project mode without --default; single-project mode returns the sole project id.
POST /api/run
Execute an agent and receive the result. (Legacy alias:POST /run.)
Request Body:
Response (JSON):
GET /api/agents
Lists the agents loaded by the daemon as JSON.path is relative to the project
root, exactly as accepted by POST /api/run. Agents that fail to parse are
reported in errors rather than failing the request. The browsable HTML page is
at /agents.
description and schedule are present only when the agent declares them.
GET /api/agents/detail
Returns the capability summary and raw.agentuse source for one loaded agent.
The endpoint is operator-gated like the rest of /api/*, and path must match
an agent already loaded by the project.
/agents/<project>/<agent-path>.
GET /api/schedules
Lists the scheduled agents currently registered with the running daemon as JSON, sorted by next run (soonest first, disabled last). The browsable HTML page is at/schedules.
nextRun and lastRun are ISO timestamps (or null). lastResult is included
once a scheduled run has completed, and carries the run’s sessionId so the
dashboard can deep-link to its log.
GET /api/sessions
Lists top-level runs as JSON, live first and then by most recent activity. Filters:?agent=<id>, ?trigger=scheduled|manual|slack|api, and
?window=<1h|6h|24h|7d|30d|90d|all> (default 24h). Time windows use the
last update, so a recently completed long-running session remains visible. The
browsable HTML page is at /sessions.
trigger is scheduled, api, slack, or manual (CLI runs and the default).
For large histories, opt into cursor pagination with limit (maximum 100) and
the opaque nextCursor returned by the prior response:
limit changes only the list length and adds limit and (when more
records exist) nextCursor; requests without it retain the complete legacy
response. Cursors are bound to the active filters and should be treated as
opaque.
GET /api/sessions/:id
Returns one session including its run-log entries (logs). API-key gated. The
human-facing view + approve page is /sessions/:id; see
Approval Gates.
Streaming Response
For real-time output, request NDJSON streaming by setting theAccept header:
Examples
Scheduled Agents
Agents with aschedule config in their frontmatter are automatically executed on schedule:
Scheduled Agents Guide
See the complete guide for intervals and cron expressions.
The server enables CORS by default. For production, run behind a reverse proxy with authentication.
serve ps
Show the runningagentuse serve daemon.
+N additional projects.
--json for scripting. Stale entries are automatically cleaned up.
While serve ps shows counts across daemons, use serve agents and serve schedules to inspect what a single running daemon actually loaded.
serve agents
List the agents loaded by the running daemon (queries its liveGET /api/agents endpoint).
pid when only one daemon is running. Agents that failed to parse are listed after the table. Use --json for the raw payload. When the daemon requires an API key, set AGENTUSE_API_KEY so the command can authenticate.
serve schedules
List the scheduled agents in the running daemon (queries its liveGET /api/schedules endpoint), sorted by next run.
agentuse schedules
Inspect and control deployment-local schedule state without changing agent frontmatter.agentuse schedules lists declared schedules and whether each one is active or
paused. pause and resume persist the override for the current deployment and
notify a running daemon, when present. The declared cron expression or interval
stays in the agent file and remains visible in the dashboard.
agentuse models
List the recommended models, the aliases they can be reached by, and your configured default.anthropic:claude-sonnet) resolves to right now. Your aliases and Default model appear when a models block is configured (see Configuration Files).
models unpin
Replace pinned model versions in agent files with version aliases, so those files track the newest release and stop needing edits:models bump
Move superseded pins forward to the current model of the same product line, for files you want to keep pinned:Both commands only rewrite model references inside an agent file’s YAML frontmatter. Instructions below the frontmatter are left alone, since prose may legitimately name a specific model version. Version aliases are never rewritten by
bump: they already track the line.agentuse provider
Manage providers and authentication credentials. (auth still works as a hidden alias.)
provider login
Amazon Bedrock authenticates via standard AWS environment variables (
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, optional AWS_SESSION_TOKEN) or AWS_BEARER_TOKEN_BEDROCK. There is no provider login bedrock command.provider add
Add a custom OpenAI-compatible endpoint from the CLI (Ollama, LM Studio, vLLM, etc.). The dashboard can additionally configure OpenAI Responses and Anthropic Messages endpoints; see Model Configuration.agentuse run agent.agentuse -m ollama:glm-5-flash:q4_K_M
Colons in model names are supported,
ollama:qwen3.5:0.8b parses as provider ollama, model qwen3.5:0.8b.provider remove / logout
provider list
agentuse skills
List and retrieve AgentUse builtin skills that ship with the installed CLI version. Use theinstalled subcommand to inspect project and user-installed skills.
Syntax
Subcommands
Options
Builtin Skills
Builtin skills are stored in the AgentUse packageskill-data/ directory and match the installed CLI version. This mirrors the agent-browser skills model: agents can fetch current official instructions without reading a user’s entire local skill library.
AI Coding Assistants
Install the assistant-facing AgentUse skill stub:agentuse skill from skills/agentuse/SKILL.md. The stub points assistants at agentuse skills get core, so the real workflow guidance stays version-aligned with the installed AgentUse CLI.
Installed Skill Locations
Installed skills are discovered from these directories (in priority order):.agentuse/skills/- Project-specific skills$AGENTUSE_CONFIG_DIR/skills/- User-global skills (defaults to~/.agentuse/skills/).claude/skills/- Claude ecosystem compatibility~/.claude/skills/- Claude ecosystem compatibility~/.agents/skills/- Shared agent skills compatibility
SKILL.md files are supported. AgentUse skips
dangling links, resolves directory real paths, and avoids circular traversal.
Examples
Output Example
-v):
agentuse doctor
Diagnose an agent’s skill capability configuration. Static mode inspects the agent file;--last-run inspects the most recent recorded session.
Syntax
What It Checks
Static mode:- Recurring prompt cost per model request: the agent body, the full text of each preloaded skill, and the visible skill catalog, with a total.
- Explicit skills that don’t exist on disk.
- Explicit skills with no
allowgrants. - Commands mentioned in skill docs vs. what the agent has granted (advisory; not a permission manifest).
- Learnings: how many of the stored ones are actually applied per run, and how many are over
learning.maxand so never reach the model, withagentuse learnings tidy <file>as the fix. It also reports how many are stale (the agent instructions changed since they were vetted, so they are held out of injection until the next capture or tidy re-vets them), aby channel:breakdown of what captured them (corrections,tool-errors,custom,agent, orlegacyfor entries predating channels), and every quarantined entry with the reason it failed the vet. It prints the resolvedlearnings file:path, echoes any one-time notice about a legacylearning:form, and warns when learnings are still sitting beside the agent file at the pre-0.17.0 location where nothing reads them.
--last-run mode:
- Finds the latest non-subagent session for this agent.
- Reports blocked bash commands from runtime and prints a suggested
tools.bash.commandssnippet.
Examples
Prompt Size Warnings
Two costs recur on every model request, so doctor flags them:
The fix for either is the same shape: preload only what every run needs, and close discovery with
skills.auto: false plus a shorter explicit list. Open discovery is the expensive default at scale, a machine with 100 skills installed pays roughly 11k tokens per request for the catalog alone.
agentuse learnings
Inspect and tidy an agent’s stored learnings. Only the top few apply per run (15 by default,learning.max); anything past that is stored but never reaches the model, and so are entries that are quarantined (failed the vet) or stale (the agent instructions changed since they were vetted). See the Learning guide.
Syntax
Subcommands
Options
Examples
A tidy-up writes proven learnings into a marked block in your
.agentuse file. Only the bytes inside the markers change, frontmatter, comments and formatting are left exactly as they were, and undo restores both files byte for byte.agentuse agents
Discover and list all agent files in the current project.Syntax
Options
Examples
Output Example
agentuse add
Add skills and agents from GitHub repos or local paths.Syntax
Arguments
string
required
Source to add. Supports:
- GitHub shorthand:
user/repooruser/repo#branch - Git URL:
https://github.com/user/repo.git - Local path:
./path/to/repo - Direct skill:
./path/to/skill(directory containing SKILL.md)
Options
What Gets Added
Examples
Conflict Handling
When a skill or agent already exists, you’ll be prompted:agentuse help
Show help information.Syntax
Examples
The
agentuse config command is not yet implemented.
Configuration is currently managed through environment variables only.Global Options
Environment Variables
Control AgentUse behavior with environment variables. See Environment Variables Reference for complete documentation.Exit Codes
AgentUse uses standard exit codes:Available Commands
AgentUse currently supports these commands:The
agentuse auth command still works as a backward-compatible alias for agentuse provider.Advanced Usage
Piping
Shell Integration
Batch Processing
Troubleshooting
Command not found
Command not found
Ensure AgentUse is installed globally:
Permission denied
Permission denied
On Unix systems, you may need sudo:
Authentication errors
Authentication errors
If you see authentication errors, AgentUse will show specific guidance:
Timeout issues
Timeout issues
Increase timeout for long-running agents:
Debugging issues
Debugging issues
Enable debug output:
Next Steps
Agent Syntax
Learn agent file format
Quick Start
Create your first agent