Skip to main content

Agents

Agents are AI-powered coding assistants that execute tasks within AgentGate’s orchestration framework. AgentGate supports multiple agent drivers, each with different capabilities, billing models, and use cases.

What Are Agents

An agent is an AI system that can:
  • Read and write code: Understand codebases and make changes
  • Execute commands: Run tests, builds, and other shell commands
  • Use tools: Leverage MCP servers, browser automation, and custom tools
  • Iterate on feedback: Respond to verification failures and improve code
AgentGate abstracts agent interaction through drivers, allowing you to swap between different AI providers and billing models.

Available Drivers

Use your Claude Pro/Max subscriptionThe default driver that uses your Claude subscription for billing instead of API credits.
Requirements:
  • Active Claude Pro or Max subscription
  • OAuth credentials at ~/.claude/.credentials.json
  • Claude CLI installed
Capabilities:
This driver automatically excludes ANTHROPIC_API_KEY from the environment to ensure subscription billing is used.

Agent Specification

Configure agents in the execution.agent section of your TaskSpec:

Configuration Options

Agent Capabilities

Capabilities define what actions an agent can perform:

Standard Capabilities

AgentGate defines these standard capability names:

Capability Matching

When a task has capability requirements, AgentGate matches them against available agents:

Tools and MCP Servers

Tool Configuration

Enable or disable specific tools:

MCP Server Configuration

Configure Model Context Protocol servers:

Agent Request Flow

When AgentGate executes a task, it creates an AgentRequest:

Agent Result

Agents return structured results:

Constraints

Control agent behavior with constraints:

Permission Modes

Session Management

Agents can resume sessions for multi-iteration tasks:

Session Resume

When a gate fails and triggers iteration:
  1. AgentGate captures the sessionId from the result
  2. Next iteration passes sessionId in the request
  3. Agent resumes with full conversation context
  4. Feedback from failed gates is appended
Not all drivers support session resume. Check supportsSessionResume in capabilities.

Billing Methods

Subscription Billing

The claude-code-subscription driver uses your Claude Pro/Max subscription:
  • No per-token charges
  • Rate limits based on subscription tier
  • Requires OAuth authentication

API Billing

The claude-code-api and claude-agent-sdk drivers use API credits:
  • Pay-per-token pricing
  • Higher rate limits available
  • Cost tracked in totalCostUsd

Driver Selection

AgentGate uses a driver registry to select agents:

Automatic Selection

If you don’t specify a driver, AgentGate selects based on availability:
  1. Check if claude-code-subscription is available (subscription valid)
  2. Fall back to claude-code-api if API key is set
  3. Try other registered drivers

Best Practices

1

Choose the Right Driver

  • claude-code-subscription: Best for regular development work
  • claude-agent-sdk: Best for complex orchestration
  • claude-code-api: Best when you need cost tracking
2

Set Appropriate Limits

3

Use Constraints Wisely

  • Disable unused tools to reduce context
  • Set maxTurns to prevent infinite loops
  • Use additionalSystemPrompt for task-specific guidance
4

Leverage Session Resume

  • Use ralph strategy for session continuity
  • Provide context pointers for large codebases
  • Enable promptHotReload for iterative refinement

Troubleshooting

Check that:
  1. You have an active Claude Pro/Max subscription
  2. OAuth credentials exist at ~/.claude/.credentials.json
  3. The credentials are not expired
Verify your API key:
Increase timeout in your TaskSpec:
Check tool configuration:

TaskSpec

Configure agents within TaskSpec

Execution

Workspace and sandbox configuration

Convergence

Iteration and session management

Gates

Verification checkpoints for agents