Skip to main content

Installation

  • pnpm
  • npm
  • npx
  • bunx
pnpm install -g agentuse

Authentication

# Option 1: Interactive OAuth login (recommended for Anthropic)
agentuse auth login

# Option 2: Use environment variables
export ANTHROPIC_API_KEY="sk-ant-..."
export OPENAI_API_KEY="sk-proj-..."
Get API keys: Anthropic | OpenAI
OAuth authentication is supported for Anthropic and provides automatic token refresh. API keys are required for OpenAI and other providers.

Supported Models

AgentUse supports multiple AI providers with the format provider:model-name: Anthropic:
  • anthropic:claude-3-5-haiku-latest
  • anthropic:claude-sonnet-4-20250514
  • anthropic:claude-opus-4-1
OpenAI:
  • openai:gpt-4-turbo
  • openai:gpt-4o
  • openai:gpt-5
  • openai:gpt-5-mini
OpenRouter:
  • openrouter:qwen/qwen-2.5-72b-instruct
  • openrouter:anthropic/claude-3.5-sonnet
You can also use custom environment variables for API keys: anthropic:claude-sonnet-4-20250514:CUSTOM_API_KEY

Your First Agent

Create hello.agentuse:
---
model: anthropic:claude-3-5-haiku-latest
description: "Simple greeting agent that welcomes users"
---

Greet the user.
Run it:
agentuse run hello.agentuse

# Or run with additional instructions
agentuse run hello.agentuse "speak like a pirate"

# Run with options
agentuse run hello.agentuse --verbose
agentuse run hello.agentuse --quiet
agentuse run hello.agentuse --timeout 600

# Override the model at runtime
agentuse run hello.agentuse --model openai:gpt-5-mini
agentuse run hello.agentuse -m anthropic:claude-3-5-sonnet-20241022

File System Agent

Create project-analyzer.agentuse:
---
model: anthropic:claude-3-5-haiku-latest
description: "Analyzes project structure and identifies key components"
mcp_servers:
  filesystem:
    command: "npx"
    args: ["-y", "@modelcontextprotocol/server-filesystem", "."]
    # Optional: Environment variables to pass to the MCP server
    env:
      DEBUG: "true"
    # Optional: Required environment variables
    requiredEnvVars: []
    # Optional: Allowed environment variables to pass through
    allowedEnvVars: ["HOME", "PATH"]
    # Optional: Tools to disable from this server
    disallowedTools: []
  
  # HTTP MCP Server example
  remote_api:
    url: "https://api.example.com/mcp"
    sessionId: "session-123"
    auth:
      type: "bearer"
      token: "${API_TOKEN}"
    headers:
      X-Custom-Header: "value"
    allowedEnvVars: ["API_TOKEN"]
---

You are a code analyzer. When asked about a project:
1. List the main files and folders
2. Identify the project type (Node.js, Python, etc.)
3. Summarize what the project does based on README or package.json
Run it in any project directory:
# Navigate to a project
cd /path/to/your/project

# Run the analyzer
agentuse run project-analyzer.agentuse

Model Override

Test your agents with different models without editing files:
# Original agent uses claude-3-5-haiku
cat analyzer.agentuse | grep model
# model: anthropic:claude-3-5-haiku-latest

# Test with a more powerful model
agentuse run analyzer.agentuse --model anthropic:claude-3-5-sonnet-20241022

# Compare with OpenAI
agentuse run analyzer.agentuse --model openai:gpt-5

# Use cheaper model for development
agentuse run analyzer.agentuse -m openai:gpt-5-mini

# Use different API key via environment suffix
agentuse run analyzer.agentuse --model openai:gpt-4o:dev
# This uses OPENAI_API_KEY_DEV instead of OPENAI_API_KEY
Perfect for CI/CD pipelines, A/B testing models, or optimizing costs between dev and production.

Sub-agents Support

AgentUse supports calling other agents as sub-agents:
---
model: anthropic:claude-3-5-haiku-latest
description: "Orchestrates tasks by delegating to specialized sub-agents"
subagents:
  - path: "./helper-agent.agentuse"
    name: "helper"
    maxSteps: 50
---

You can call the helper agent using the sub-agent tools.

Remote Agents

You can run agents directly from HTTPS URLs:
# AgentUse will prompt for confirmation before executing remote agents
agentuse run https://example.com/path/to/agent.agentuse

# Preview the agent content first
# Choose 'p' when prompted to preview before execution
Only HTTPS URLs with .agentuse extensions are supported for security. Always review remote agents before execution.

Environment Variables

Configure AgentUse behavior with environment variables:
# Set maximum execution steps (default: 1000)
export MAX_STEPS=2500

# API keys for different providers
export ANTHROPIC_API_KEY="sk-ant-..."
export OPENAI_API_KEY="sk-proj-..."
export OPENROUTER_API_KEY="sk-or-..."

# Custom API key variables
export ANTHROPIC_API_KEY_WORK="sk-ant-..."
export OPENAI_API_KEY_PERSONAL="sk-proj-..."
Use custom API key suffixes to manage multiple accounts: anthropic:claude-sonnet-4:WORK will use ANTHROPIC_API_KEY_WORK

What’s Next?

I