AI Agent Skill Granularity: A Practical Guide to Tool Splitting

    This article explains how to split skills for an AI Agent based on decision boundaries rather than module size. It separates decision cost from execution cost, introduces two questions for deciding whether a step should become a model-selectable tool, and shows a competitor-analysis collection pipeline as an example. It also covers when to split external skills, a three-layer architecture, and observability-based tuning. Readers will learn how to balance flexibility, stability, and cost by reducing the number of choices the model must make.

    1. The Real Problem: Granularity Is About the Number of Decisions, Not Size

    When building an AI Agent, many teams fall into an intuitive trap: they assume that the finer the skills are split, the more “intelligent” and flexible the agent becomes. As a result, they break a complete business flow into multiple external tools, such as login, scraping, parsing, and validation, and let the model orchestrate them step by step. In practice, however, the chain grows longer, latency increases, and the failure rate goes up.

    It is important to be clear about one thing: implementing login, scraping, and parsing as three internal functions is completely different from exposing them as three tools that the model must select in sequence. The former is modularization at the code level; the latter is exposure at the decision level. What truly affects performance and stability is not whether the modules are small enough, but whether the model has to think again at every step.

    Before discussing granularity, we therefore need to distinguish two types of cost:

    • Decision cost: the model reads tool descriptions, matches intent, and generates call parameters. This is a full inference overhead.
    • Execution cost: the actual computation and I/O overhead of network requests, page parsing, field validation, and so on.

    If a solution is noticeably slower, you cannot attribute it directly to “modules being too small.” Instead, break down where the time goes: how much is spent on model decisions, how much on network requests, and how much on parsing. Only after locating the real bottleneck can granularity adjustments be justified.

    2. Core Principle: Draw the Line at Decision Boundaries and Recovery Boundaries

    The splitting standard proposed in this article comes down to two self-check questions:

    1. At this point, does the business need to make a choice again?
    2. After a failure, is it worth recovering from here separately?

    If the answer to both questions is “no,” then this step should not become a model-selectable entry point; it should be encapsulated inside a workflow or code. Conversely, if either answer is “yes,” it is worth promoting to an independent skill entry.

    The value of these two criteria is that they completely separate “implementation complexity” from “exposure complexity.” Internally, you can stay highly modular for easier testing and reuse; externally, you keep things minimal to reduce the model’s choice space and the probability of errors.

    3. Practical Example: The Collection Pipeline of a Competitor Analysis Assistant

    Take a competitor analysis assistant as an example. After the user provides a product link, the system needs to perform a series of actions: login check, page retrieval, content parsing, and field validation. If all of these are exposed to the model, the chain becomes “select the login tool → select the scraping tool → select the parsing tool,” and each step carries the risk of a wrong selection, a missing selection, or failed parameter assembly.

    A more reasonable approach is to keep small modules internally and expose only a single “collect product information” entry point externally.

    1. # Internal small modules: called by code or workflows, invisible to the model
    2. def check_session(session): ...
    3. def fetch_page(url, session): ...
    4. def parse_product(html): ...
    5. def validate(fields): ...
    6. # The only external entry point: the model only needs to make one selection
    7. def collect_product_info(url):
    8. session = check_session(load_session())
    9. html = fetch_page(url, session)
    10. data = parse_product(html)
    11. return validate(data)

    The benefits are significant:

    • Under normal conditions, once the link is obtained, the next step is inevitably to fetch the page, and once the page is fetched, it must be parsed. These steps have no business branches and do not require the model to make decisions.
    • The model only intervenes at real branch points, for example, “does the user want to compare prices or features” or “are additional similar products needed.”
    • Failure recovery points are explicitly defined at the entry-point level, rather than scattered across every small step.

    4. When You Should Split External Skills

    Splitting is not a case of “the fewer the better.” The key is to identify real branches. The following situations are suitable for becoming independent skills:

    • Different business goals: collecting information and generating a comparison report are two different intents, with large differences in parameters and output structures.
    • Different recovery strategies: a scraping failure can be retried, while an authentication failure requires human intervention; the two have different recovery paths.
    • Different permission and audit boundaries: some operations require separate authorization and logging.
    • Limited context length: too many tool descriptions crowd out the context, in which case low-frequency entries should be merged.

    Conversely, if two actions always happen consecutively, roll back together on failure, and their parameters depend entirely on the output of the previous step, they should be merged into one entry point, with the internal steps handed over to deterministic code.

    A three-layer structure is recommended so that “flexibility” and “determinism” each stay in their proper place:

    1. Intent layer: exposes only a small number of high-value skills, responsible for understanding the user’s goal and making a one-time selection.
    2. Orchestration layer: driven by workflows or code, it chains internal small modules and handles retries, timeouts, and degradation.
    3. Execution layer: purely functional atomic capabilities, easy to unit test and to swap implementations.
    1. User intent → [Intent layer: a few skill entries] → [Orchestration layer: deterministic flow] → [Execution layer: atomic modules]

    Under this structure, the model takes on the responsibility of “making a choice,” while code takes on the responsibility of “executing according to the flow,” and neither oversteps the other. When adding a site adapter or replacing a parser, only the execution layer is affected, and the model’s decision space does not change.

    6. Observability and Tuning

    Whether the granularity is reasonable must ultimately be verified with data. It is recommended to record three durations for each call: decision time, execution time, and waiting and retry time, and to track the selection rate and failure rate of each entry point.

    Follow this order when tuning:

    • If decision time accounts for a high proportion, there are too many entries or the descriptions are vague; merge skills and simplify descriptions.
    • If execution time accounts for a high proportion, optimize the network and parsing rather than continuing to split modules smaller.
    • If failures are concentrated in a certain step, promote that step to a boundary that can be recovered independently, and add idempotency and retries.

    7. Conclusion

    The correct measure of skill granularity is not the number of modules, but the number of times the model is forced to make a choice. Keep internal small modules to ensure maintainability, converge external entries to reduce decision risk, and use “whether a new choice is needed” and “whether it is worth recovering separately” as the basis for splitting. Only in this way can you strike a balance among flexibility, stability, and cost.