AI Agent Skill Granularity: How to Decide What to Expose to the Model

    This article explains how to choose the right skill granularity when building an AI Agent. It separates code-level modularity from decision-level distribution, breaks total latency into model decision time, external interaction time, and local processing time, and proposes two questions for deciding whether a step should become a model-callable skill: whether a new business choice is needed there, and whether recovery is worth starting from that point. A competitor research pipeline illustrates the tradeoffs, along with a reusable checklist and notes on retry boundaries and separation of side-effect permissions.

    AI Agent Skill Granularity: The Design Logic Behind Splitting Skills

    When building an AI Agent, almost every team runs into the same question: how many “skills” should be handed to the model for orchestration? One common intuition is that finer splitting makes the Agent more flexible, so login, fetching, parsing, and validation are each wrapped as a separate entry point, forcing the model to make a choice at every step. The alternative is to encapsulate those steps internally and expose only a few entry points. On the surface this looks like a difference in skill size. In practice it is a difference in how control is allocated: which steps must be judged by the model, and which are executed by deterministic programs.

    This article proposes a practical splitting standard and uses a competitor data collection and comparison scenario to show the tradeoffs involved in granularity design.

    1. First, Clear Up a Confused Question: Small Modules Do Not Mean More Decisions

    Splitting a task into three internal functions and exposing it as three tools that the Agent must select in sequence are two completely different architectures.

    The former is modularity at the code level, with the call order fixed by the program. The latter is distribution at the decision level, where every step consumes one model inference and carries a probability of choosing wrong. Many teams compare two versions, observe latency rising from a few seconds to over ten seconds, and immediately conclude that “small modules hurt performance.” That inference is not rigorous. A more reasonable approach is to break total latency into three parts:

    • Model decision time: reading context and generating the tool choice;
    • External interaction time: network requests, API rate limiting, page load waits;
    • Local processing time: parsing, cleaning, field validation, and other compute overhead.

    Only with this attribution can you tell whether the bottleneck comes from more inference rounds or from unstable external dependencies. In practice, more rounds bring more than linear delay: they also amplify context length and error accumulation. That is the real cost of fine-grained exposure.

    2. The Splitting Standard: Two Questions You Must Answer

    I suggest using two questions as the basis for splitting:

    1. Does the business need to make a new choice at this point? If the next action is deterministic, the model should not be asked to think again.
    2. Is it worth recovering from this point after a failure? If a failed step only requires rerunning the whole flow, it does not need to be a separate entry point.

    These two questions correspond to “decision necessity” and “recovery value.” Steps where both answers are no should be sealed inside the implementation. Only steps where at least one answer is yes are worth exposing as skills the Agent can call.

    3. Applying It: A Competitor Data Collection Pipeline

    Take a “competitor analysis assistant” as an example. It can be divided into three boundaries: collecting evidence, comparing and identifying gaps, and producing a report. Note that the three segments are only a starting point for this scenario, not a fixed number that applies everywhere.

    1. Keep Small Internal Modules in the Collection Chain and Expose Only One Entry Point

    Internally you can still keep login state checks, page fetching, body text parsing, field validation, and adaptation logic for different site structures. But they are chained by a workflow or code and do not need the model to pick them one by one. The reason is simple: once you have the product link you fetch the page, and once you have the page you parse it. This order contains almost no business judgment, so a program is more stable and more predictable.

    More important is the return structure of the entry point. If it only returns a large block of page text, the upper layer cannot tell what is missing. A structured result is recommended:

    1. {
    2. "records": [
    3. {"name": "Product A", "price": 99, "unit": "per user/month", "source": "..."}
    4. ],
    5. "collected_at": "2025-01-01T10:00:00Z",
    6. "missing_fields": ["price"],
    7. "page_status": [
    8. {"url": "...", "ok": true},
    9. {"url": "...", "ok": false, "reason": "timeout"}
    10. ]
    11. }

    “Collected 3 pages, 1 of which is missing the price” is a result the upper layer can act on. “Collection failed” leaves it with nowhere to start. At the same time, internal modules can be reused by scenarios such as public opinion monitoring, while the entry point for competitor analysis only handles composition, so reuse does not depend on the model assembling the flow on the spot every time.

    2. Return Control to Where Judgment and Authorization Actually Change

    After collection, suppose two products use different billing models, one priced per user and one per API call. This is where the Agent is genuinely needed: whether to unify the basis, whether missing data is acceptable, and whether it is worth further lookups. These judgments depend on business semantics and cannot be hard-coded in advance.

    The report step can include one model call to organize the wording, but that does not require introducing another Agent that autonomously selects tools. If the comparison result is already structured, generating tables and source references from a template is actually easier to validate.

    Publishing the report, sending notifications, and modifying external systems should have separate authorization and execution checks. Being able to generate a file does not mean you have permission to send it externally. These two things must be separated.

    3. Write the Allowed Scope of Local Retries Clearly

    You do not need to constrain all internal logic with the rule that “skills can only execute, not judge.” A reasonable approach is to allow local retries but make their boundaries explicit: a retry may adjust pagination depth, switch parsing strategies, or relax timeouts; it may not change the target objects or the business basis. When the boundary is written into the skill description, the model will not mistake a retry for replanning.

    4. A Reusable Checklist

    • Can every externally exposed skill explain why the model needs to choose it once?
    • Is the return value structured enough for the upper layer to identify gaps directly?
    • Have fixed-order flows been pushed down into code?
    • Are side-effect operations authorized separately from generation operations?
    • Are internal modules shared by multiple entry points rather than copied per entry point?

    In agent development practice on platforms such as Baidu AI Cloud, pushing deterministic flows down and exposing decision points early, combined with logging services and monitoring alerts for latency attribution, usually improves stability and verifiability more than simply adjusting the number of skills. The essence of granularity design is not how finely you split, but making every model decision worth its cost.