# Dedicated Tools vs. Skills and General Executors: Trade-offs for AI Agent Capabilities

> Discover the trade-offs between dedicated tools and skills for AI agent capabilities. Learn when to use each for optimal performance and determinism in complex operations.

- Repository: [Bojie Li/ai-agent-book](https://github.com/bojieli/ai-agent-book)
- Tags: architecture
- Published: 2026-07-30

---

**AI agents should use dedicated tools with strict JSON-Schema definitions for complex, high-risk operations requiring determinism, while leveraging natural-language skills paired with generic executors for frequently changing procedures when using capable models.**

When building AI agents, the `bojieli/ai-agent-book` repository demonstrates that the fundamental architectural decision involves choosing between two capability exposure patterns. This analysis of dedicated tools vs. skills and general executors for AI Agent capabilities reveals critical trade-offs affecting token efficiency, maintenance overhead, and system security as documented in [`book-en/chapter4.md`](https://github.com/bojieli/ai-agent-book/blob/main/book-en/chapter4.md).

## The Two Architectural Approaches

### Dedicated Code Tools

Dedicated tools wrap each capability in a concrete function with a strict JSON-Schema definition. For example, a `send_email` tool explicitly defines parameters like `to`, `subject`, and `body` with type constraints and validation rules. According to the source code in [`book-en/chapter4.md`](https://github.com/bojieli/ai-agent-book/blob/main/book-en/chapter4.md), this approach benefits complex, nested arguments by guiding the model to pass correct values through structured schemas.

### Skills and General Executors

Skills describe capabilities in natural-language documents, while the agent invokes a small set of generic executors—such as a bash shell or code interpreter—to carry out the steps. As implemented in the repository's examples like [`chapter2/agent-skills-ppt/skills/pptx/scripts/generate_pptx.py`](https://github.com/bojieli/ai-agent-book/blob/main/chapter2/agent-skills-ppt/skills/pptx/scripts/generate_pptx.py), this pattern allows rapidly evolving procedures to be updated by editing text rather than redeploying compiled code.

## Decision Framework: Three Dimensions

The choice between these patterns follows a three-dimensional framework analyzed in [`book-en/chapter4.md`](https://github.com/bojieli/ai-agent-book/blob/main/book-en/chapter4.md): parameter complexity, frequency of change, and model capability.

### Parameter Complexity

Complex, nested arguments benefit from dedicated tools with structured schemas that constrain the model's outputs. Simple parameters can be passed through generic CLI tools without the overhead of formal schema definitions.

### Frequency of Change

Rapidly evolving procedures are cheaper to maintain as natural-language skill documents. Editing a skill requires only updating text, whereas changing a dedicated tool necessitates redeploying code, compiling, and testing new implementations.

### Model Capability

Powerful LLMs can generate and reason about code, making general executors sufficient for task completion. Weaker models require the extra scaffolding that dedicated tools provide to reduce invocation errors and ensure valid parameter passing.

## Critical Trade-offs in Implementation

### Token Cost and KV-Cache Efficiency

Each dedicated tool adds hundreds of tokens to the system prompt and invalidates the KV cache when the tool list grows. Skill documents remain outside the prompt until explicitly retrieved via a `read_skill` tool, significantly saving tokens and preserving cache warmth during long conversations.

### Determinism vs. Flexibility

Dedicated tools offer deterministic, testable behavior—calling `send_email(to, subject, body)` produces known results with validated inputs. Skills rely on the executor's ability to interpret textual instructions, offering greater flexibility for novel tasks but introducing variability in execution accuracy.

### Security and Permission Boundaries

High-risk actions like modifying production databases require dedicated, permission-restricted wrappers to enforce audit trails and input validation. While general executors can be sandboxed, they expose a broader attack surface if not tightly controlled, as noted in the security analysis of [`book-en/chapter4.md`](https://github.com/bojieli/ai-agent-book/blob/main/book-en/chapter4.md).

## Architectural Pattern: From Discovery to Execution

The repository proposes a hybrid pattern implemented across the codebase, including references in [`chapter8/self-evolving-tools/tool_manager.py`](https://github.com/bojieli/ai-agent-book/blob/main/chapter8/self-evolving-tools/tool_manager.py).

### The Discovery and Selection Layer

The agent first scans the skill catalog containing metadata about available capabilities. Based on the task requirements, the model decides either to load a dedicated tool or to retrieve a skill document for interpretation by a generic executor.

### Execution Paths

When a dedicated tool is selected, the model sends a JSON-encoded function call directly to the tool server, as managed by systems like the MCP ecosystem. When a skill is selected, the skill text is retrieved and handed to a generic executor (e.g., `bash` or `code_interpreter`) that carries out the described steps sequentially while returning structured results.

## Code Examples

### Skill Document with Generic Bash Executor

A skill document for deploying an application might contain:

```markdown

# Deploy Application (skill)

1. Run `npm run build` to compile the project.
2. Run `docker build -t myapp:latest .` to create a container image.
3. Run `kubectl apply -f deploy.yaml` to roll out the service.

```

The generic executor implementation in Python:

```python

# generic_executor.py

import subprocess, json

def run_bash(commands: list[str]) -> dict:
    results = []
    for cmd in commands:
        proc = subprocess.run(cmd, shell=True, capture_output=True, text=True)
        results.append({
            "command": cmd,
            "returncode": proc.returncode,
            "stdout": proc.stdout,
            "stderr": proc.stderr,
        })
    return {"steps": results}

```

The agent flow retrieves the skill text using a `read_skill` tool, parses it into commands, and calls `run_bash(commands)` to receive structured results for continued reasoning.

### Dedicated Tool with JSON-Schema

A strict tool definition for email functionality:

```json
{
  "name": "send_email",
  "description": "Send an email to a specified address.",
  "parameters": {
    "type": "object",
    "properties": {
      "to": { "type": "string", "description": "Recipient email address." },
      "subject": { "type": "string", "description": "Email subject line." },
      "body": { "type": "string", "description": "Plain-text body content." }
    },
    "required": ["to", "subject", "body"]
  }
}

```

The corresponding Python wrapper with validation:

```python

# send_email_tool.py

import re

def send_email(to: str, subject: str, body: str) -> dict:
    # Input validation and safety checks

    if not re.fullmatch(r"[^@]+@[^@]+\.[^@]+", to):
        return {"success": False, "error": "invalid email address"}
    # Implementation would call SMTP server or third-party API

    # ...send email...

    return {"success": True, "message_id": "msg-12345"}

```

This approach guarantees correct parameter types and enables strict permission checks before execution.

## Summary

- **Dedicated tools** excel when handling complex parameters, infrequent changes, or weaker models requiring structured guidance.
- **Skills and general executors** reduce token costs by keeping capability descriptions out of the prompt until needed, and enable rapid iteration without code deployment.
- **Security-sensitive operations** should use dedicated tools with explicit permission boundaries rather than general executors.
- **Hybrid architectures** allow agents to discover and select the appropriate execution path based on task requirements.

## Frequently Asked Questions

### When should I use a dedicated tool instead of a skill?

Use a dedicated tool when the operation involves complex, nested parameters that require strict schema validation, when the functionality rarely changes, or when working with weaker models that need explicit structural guidance. High-risk operations like database modifications also warrant dedicated tools for security auditing.

### How do skills affect token costs compared to dedicated tools?

Skills significantly reduce token costs because they remain outside the system prompt until explicitly retrieved. Dedicated tools add hundreds of tokens to every prompt and invalidate the KV cache when the tool list changes, while skills loaded via `read_skill` only consume tokens during their specific execution window.

### Can I mix both approaches in the same agent?

Yes, the recommended architectural pattern involves a discovery layer where the agent scans both available dedicated tools and skill catalogs. The model selects the appropriate execution path—either invoking a JSON-Schema defined tool or retrieving a natural-language skill for processing by a generic executor like `bash` or `code_interpreter`.

### What security considerations apply to general executors?

General executors expose a broader attack surface than dedicated tools because they interpret natural-language instructions that may be ambiguous or malicious. While sandboxing helps, high-risk actions require dedicated wrappers with explicit permission checks, input validation, and audit logging as implemented in the tool server architecture.