Skip to main content

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 .env files
  • Finding plugins in .agentuse/plugins/
  • Owning shared stores in .agentuse/store/
  • Grouping session state
For 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

Where:
  • provider: A built-in provider (anthropic, openai, openrouter, opencode-go, bedrock) or a custom provider name
  • model: The specific model name (e.g., claude-sonnet-4-6, gpt-5.5, glm-5-flash:q4_K_M), or a version alias such as claude-sonnet
  • env: Optional environment suffix for API keys (e.g., dev, prod, or full env var name), built-in providers only
A configured @name alias also works: --model @fast.

Examples

When overriding models, provider-specific options (like OpenAI’s reasoningEffort) will be ignored if you switch to a different provider.
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.
Plus the common run options (--quiet, --debug, --no-tty, --compact, --timeout, -C, --env-file, -m/--model, --json).
Gated scope is the closed-loop testing mode: only the bash commands matching the agent’s 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 reserved metrics store 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-approved entry but no bash-spawn entry; that absence is the audit signal it never executed.
  • An agent with no tools.bash.gated patterns under gated scope gets a warning: nothing is mocked, everything runs real (with gates auto-resolved).
Only gated bash commands are fabricated under gated scope. Effectful MCP tools or channel posts still run for real; pair with a scratch copy of the project when the agent writes through those. And a fabricated command changes nothing on disk, so a later real command that checks its effect (e.g. git log after a fabricated git push) will see the unchanged state.

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:
Use the lowest-end model you can reach for --mock-model. Mocking is not a reasoning task: the model only has to fabricate a plausible result for a tool given its name and arguments. Your agent’s actual reasoning still runs on its own model, untouched. A small, fast model produces fine mock output while keeping cost and rate-limit pressure low, which matters because mock fires one LLM call for every tool result (and they run concurrently when the agent batches tool calls).Good low-end picks, by provider:Pick one in a provider you’re authenticated for. (Model IDs drift over time; the current low-end tier is the rule, not these exact names.)
  • 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 via AGENTUSE_MOCK_MODEL in the shell, ~/.agentuse/.env, or the env block 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_human still suspends so you can verify the agent pauses for approval. Pass --mock-approval for fully-unattended runs (agentuse test defaults 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’s changes[] exactly like a real reviewer approval, so tools.bash.gated flows complete end-to-end. On a pick gate the recommended option is chosen (else the first), returned as choice.
    • --mock-approval reject forces 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:
  1. HTTPS Only: Only HTTPS URLs are allowed for security
  2. File Extension: Remote agents must have .agentuse extension
  3. 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)
Example security prompt:

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

List options:

Show a Session

Show options:

Resume a Session

Use agentuse sessions resume for local continuation. It supports suspended approval sessions and ended sessions. For a suspended approval session:
The CLI uses local session access as the trust boundary, so approval resumes do not require a resume token. --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:
For a completed or errored session, AgentUse starts a new run from the original agent file with continuation context:
Resume options:

Reconcile Stuck Sessions

Settle sessions still marked running 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.
Reconcile options:
A run that is still executing anywhere is never touched: a live worker, a worker released across a daemon restart, or a plain terminal 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:
Project ids default to the -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 (not 127.0.0.1 or localhost), API key authentication is required:
Clients must include the key in requests:
Use --no-auth to bypass authentication (dangerous for production).

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):
Error Response:

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.
The browsable agent detail hub is at /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:
Supplying 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 the Accept header:
Each line is a JSON object representing an execution event:

Examples

API Usage Examples:

Scheduled Agents

Agents with a schedule 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 running agentuse serve daemon.
Shows PID, port, project summary, total agent/schedule counts, and uptime. Multi-project daemons show the first project id plus +N additional projects.
Use --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 live GET /api/agents endpoint).
Omit 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 live GET /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.
The Version aliases section shows what each version-less id (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.
Then use: 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 the installed subcommand to inspect project and user-installed skills.

Syntax

Subcommands

Options

Builtin Skills

Builtin skills are stored in the AgentUse package skill-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:
For local development, install from this checkout:
This installs the thin 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):
  1. .agentuse/skills/ - Project-specific skills
  2. $AGENTUSE_CONFIG_DIR/skills/ - User-global skills (defaults to ~/.agentuse/skills/)
  3. .claude/skills/ - Claude ecosystem compatibility
  4. ~/.claude/skills/ - Claude ecosystem compatibility
  5. ~/.agents/skills/ - Shared agent skills compatibility
Symlinked skill directories and SKILL.md files are supported. AgentUse skips dangling links, resolves directory real paths, and avoids circular traversal.

Examples

Output Example

Installed skills:
With verbose mode (-v):
For detailed information on creating and using skills, see the Skills Guide.

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 allow grants.
  • 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.max and so never reach the model, with agentuse 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), a by channel: breakdown of what captured them (corrections, tool-errors, custom, agent, or legacy for entries predating channels), and every quarantined entry with the reason it failed the vet. It prints the resolved learnings file: path, echoes any one-time notice about a legacy learning: 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.commands snippet.

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.
Use --last-run after an agent fails or behaves unexpectedly. It uses real tool errors and is more accurate than static skill-doc extraction.

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.
Learnings no longer live beside your agent file. As of v0.17.0 they live under the AgentUse state directory, and the old location is never read. Run agentuse learnings migrate --all once per repo to copy them across; it will ask before removing the originals. migrate exits non-zero if it refused any file.

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/repo or user/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

Ensure AgentUse is installed globally:
On Unix systems, you may need sudo:
If you see authentication errors, AgentUse will show specific guidance:
Increase timeout for long-running agents:
Enable debug output:

Next Steps

Agent Syntax

Learn agent file format

Quick Start

Create your first agent