or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

apis

agents.mdhooks.mdmcp.mdmessages.mdoptions.mdpermissions.mdquery-api.mdsandbox.mdtools.md
index.mdpatterns.mdquick-reference.mdtypes.md
tile.json

agents.mddocs/apis/

Custom Agents

Define custom subagents with specific tools, prompts, and models.

Agent Definition

interface AgentDefinition {
  description: string;
  tools?: string[];
  disallowedTools?: string[];
  prompt: string;
  model?: 'sonnet' | 'opus' | 'haiku' | 'inherit';
  criticalSystemReminder_EXPERIMENTAL?: string;
}

Configuration

agents: {
  'reviewer': {
    description: 'Reviews code for bugs and style',
    tools: ['Read', 'Grep', 'Glob'],  // Read-only
    prompt: 'You are a code reviewer. Analyze for bugs, style, performance, security.',
    model: 'opus'
  },

  'tester': {
    description: 'Writes comprehensive tests',
    tools: ['Read', 'Write', 'Grep', 'Glob'],
    disallowedTools: ['Bash'],
    prompt: 'You are a test engineer. Write comprehensive tests covering edge cases.',
    model: 'sonnet'
  },

  'refactorer': {
    description: 'Refactors code',
    tools: ['Read', 'Edit', 'Grep', 'Glob'],
    prompt: 'You are a refactoring specialist. Extract functions, reduce complexity, improve naming.',
    model: 'sonnet',
    criticalSystemReminder_EXPERIMENTAL: 'NEVER break functionality'
  },

  'documenter': {
    description: 'Generates documentation',
    tools: ['Read', 'Write', 'Grep', 'Glob'],
    disallowedTools: ['Bash', 'Edit'],
    prompt: 'You are a documentation specialist. Create clear API docs, examples, architecture overviews.',
    model: 'haiku'
  }
}

Invocation

Agents are automatically invoked via the Task tool based on task requirements:

const result = query({
  prompt: `
    1. Review authentication module
    2. Write tests for any bugs
    3. Document the auth flow
  `,
  options: {
    agents: {
      'reviewer': { /* ... */ },
      'tester': { /* ... */ },
      'documenter': { /* ... */ }
    }
  }
});

// Claude automatically:
// 1. Uses 'reviewer' to review auth
// 2. Uses 'tester' to write tests
// 3. Uses 'documenter' to create docs

Tool Access

agents: {
  // Explicit whitelist
  'analyzer': {
    description: 'Analyzes code without changes',
    tools: ['Read', 'Grep', 'Glob'],
    prompt: '...'
  },

  // Inherit all, blacklist some
  'builder': {
    description: 'Builds and tests',
    disallowedTools: ['Edit', 'Write'],
    prompt: '...'
  },

  // Inherit all tools
  'full-access': {
    description: 'Full access',
    prompt: '...'
  }
}

Tool Inheritance

Parent: ['Read', 'Write', 'Edit', 'Bash', 'Grep']

Agent A (tools: ['Read', 'Grep']):
  → Gets: Read, Grep

Agent B (disallowedTools: ['Bash']):
  → Gets: Read, Write, Edit, Grep

Agent C (no tools/disallowedTools):
  → Gets: Read, Write, Edit, Bash, Grep

Model Selection

agents: {
  'quick-formatter': {
    description: 'Fast formatting',
    model: 'haiku',  // Fast & cheap
    prompt: '...'
  },

  'architect': {
    description: 'System architecture design',
    model: 'opus',  // Most capable
    prompt: '...'
  },

  'general-coder': {
    description: 'General coding',
    model: 'sonnet',  // Balanced
    prompt: '...'
  },

  'adaptive': {
    description: 'Uses parent model',
    model: 'inherit',
    prompt: '...'
  }
}

Complete Example

const result = query({
  prompt: 'Improve payment processing module',
  options: {
    model: 'claude-sonnet-4-5-20250929',
    agents: {
      'security-auditor': {
        description: 'Security audits for vulnerabilities',
        tools: ['Read', 'Grep', 'Glob'],
        prompt: `Audit for:
- SQL injection
- XSS vulnerabilities
- Auth/authz issues
- Data validation problems
Provide findings with severity and remediation.`,
        model: 'opus'
      },

      'performance-optimizer': {
        description: 'Optimizes performance',
        tools: ['Read', 'Edit', 'Grep', 'Glob', 'Bash'],
        prompt: `Improve:
- Algorithm efficiency
- Memory usage
- DB query performance
- Caching strategies
Measure before/after.`,
        model: 'sonnet'
      },

      'integration-tester': {
        description: 'Creates integration tests',
        tools: ['Read', 'Write', 'Bash', 'Grep', 'Glob'],
        disallowedTools: ['Edit'],
        prompt: `Create tests for:
- Complete workflows
- Integration points
- Realistic test data
Run automated suites.`,
        model: 'sonnet',
        criticalSystemReminder_EXPERIMENTAL: 'Test environment only'
      }
    }
  }
});

for await (const msg of result) {
  if (msg.type === 'system' && msg.subtype === 'init') {
    if (msg.agents) {
      console.log('Available agents:', msg.agents);
    }
  }
}