Small Models + Agent Skills: Implementing Localized Agents via POMDP
Skill-based AI agents have gained popularity by decomposing model capabilities into composable skills. However, deploying these frameworks in highly compliant, localized environments—such as finance or military—requires shifting from public APIs to local small-parameter models. This article explores how to achieve this by modeling the agent system as a Partially Observable Markov Decision Process (POMDP). It covers the POMDP formulation, the Skill Triplet architecture (descriptors, internal policies, and reference mechanisms), and the division of labor between small, medium, and large models. Finally, it outlines engineering practices to build a robust evaluation loop, from skill registration and context budget management to security compliance and online monitoring.
1. Problem Background: Localized Agents Are Not Simple Replacements for Public APIs
Skill-based agents (Agent Skills) have rapidly gained popularity in engineering by decomposing “model capabilities” into composable skills. Instead of completing all reasoning in a single pass, a model first selects a skill, reads the skill description, loads referenced resources if necessary, and finally executes a tool call or workflow. This pattern works well in environments with internet access, abundant computing power, and loose invocation budgets. However, in scenarios like financial risk control, military-grade data isolation, strict compliance auditing, or private delivery environments, continuous reliance on public APIs faces quadruple constraints: compliance, budget, latency, and data boundaries.
The question then becomes: Can skill frameworks originally designed for massive models be delegated to small and medium-sized models running locally? The answer is not a simple “yes” or “no,” but “conditionally usable.” The key lies not in the parameter count itself, but in whether the control plane is sufficiently engineered. Are skills explicitly described? Are referenced resources layered? Is the context bound by budgets? Does the model route based on uncertainty? Are failures recoverable? Are outcomes quantitatively evaluated? Without this control plane, small models will be overwhelmed by long contexts, ambiguous skill descriptions, and open-ended planning. With it, small models can serve as the primary engine for high-frequency, closed, and verifiable skills.
2. Reconstructing Agent Skills with POMDP: Turning “Intuition” into Computable Policies
Research often abstracts skill-based agents as controllers searching for information in partially observable environments. At each step, the agent does not know the true task state: user intent may be incomplete, task progress may be hidden, and environmental facts may not yet be retrieved. It must weigh task progress against limited attention/context resources based on current observations and choose an action: submit and execute a skill, reveal more information about a skill or reference resource, take direct action in the environment, or perform internal planning and reasoning.
Since the underlying system follows Markov dynamics and the agent cannot directly observe the true state, the system can be naturally modeled as a Partially Observable Markov Decision Process (POMDP), with explicit information-gathering actions added to trade extra cost for better observations. Formally, this can be defined as:
- State (S): Potentially hidden task contexts, including the user’s true intent, task phases and progress, and unretrieved environmental facts.
- Observation (O): Accessible content at time (t), such as the current user message, history, revealed skill descriptions, loaded reference resources, and tool returns.
- Action (A): Skill selection, paid context acquisition, skill execution, environment/tool invocation, and internal planning/reasoning.
- Belief state (b_t(s)): The agent’s belief distribution over the hidden state, given the history of observations and actions.
- Transition and observation kernels: Describe how actions change the hidden state and how new observations are generated from states and actions.
- Reward/Cost: Task progress gains minus context cost, latency cost, tool invocation cost, and error penalties.
The belief update can be written as:
[
b{t+1}(s’) \propto O(o’|s’,a)\sum_s T(s’|s,a)b_t(s)
]
The policy objective is not to “select the most similar skill,” but to maximize long-term expected reward:
[
\pi^*=\arg\max\pi \mathbb{E}\left[\sumt \gamma^t(R{\text{task}}-\lambdac C{\text{ctx}}-\lambda_l L-\lambda_e E)\right]
]
This explains why small model scenarios particularly need POMDP-style control: small parameters mean limited single-step reasoning capacity. If skill selection, reference reading, and tool invocation are mixed into a single generation, errors will accumulate rapidly. Explicitly separating actions allows budget constraints and uncertainty thresholds to control each step.
3. The Skill Triplet: Descriptors, Internal Policies, and Reference Mechanisms
Each skill should not just be a prompt snippet; it should be defined as an abstract triplet:
- Text Descriptor: Skill name, applicable conditions, I/O constraints, failure modes, and examples. Descriptors are the primary observation for routing and selection and must be short and highly distinguishable.
- Internal Policy: The time-extended strategy within the skill, i.e., an option-level process or workflow that triggers a sequence of actions. It can be fixed steps, a state machine, script orchestration, or a sub-agent process.
- Reference Mechanism: Pointers that reveal additional skill context, tool descriptions, or even other skills, which can be formalized as Markov kernels. The reference mechanism determines “when to pay to read more information” and is key to controlling context bloat.
In engineering, the reference mechanism should be layered: Level 1 provides only the skill summary; Level 2 gives the parameter schema and examples; Level 3 loads long documents or tool details. Small models should prioritize routing on Level 1 summaries, triggering Level 2 and Level 3 reveals only when confidence is low or slots are missing. This preserves the expressiveness of the skill framework while avoiding stuffing the entire context into the window every time.
4. Small Model Feasibility: Capability Boundaries and Routing Division of Labor
Small models are not incapable of being Agents; they are just unsuitable for “doing everything without constraints.” A more feasible division of labor is:
- Small models handle high-frequency, closed, verifiable actions: Skill coarse ranking, slot extraction, intent classification, parameter validation, simple tool calls, and result formatting.
- Medium models handle multi-step planning and ambiguity resolution: Upgraded when the small model’s belief entropy is high, slot conflicts occur, or tool returns are abnormal.
- Larger models serve as hard-case fallbacks or offline teachers: Used to generate skill descriptions, construct evaluation sets, and distill routing samples, rather than handling all online traffic.
- Rules and retrieval act as deterministic supplements: Permissions, compliance, required fields, and dangerous action whitelists should be prioritized for rule-based handling and not left entirely to the model.
The routing strategy can adopt a cascade structure of “front-end rules + lightweight classifier + uncertainty threshold + cost constraint + fallback escalation.” The core metric is not single-model accuracy, but success rate per unit task cost, context usage, latency, and fallback rate. If building the runtime foundation on Baidu AI Cloud, container platforms, object storage, log services, and monitoring alerts can serve as general support components, but skill registration, routing strategies, and evaluation loops should still be managed by the business side.
5. Engineering Implementation: From Skill Registration to Evaluation Loop
When deploying, it is recommended to follow this process:
- Skill Registration Standardization: Maintain name, applicable/inapplicable conditions, I/O schema, permission levels, cost tags, reference levels, and failure codes for each skill. Descriptors must be distinguishable by small models to avoid massive overlaps among synonymous skills.
- Context Budget Management: Set token/character budgets, upper limits for reference reads, and tool call counts for each step. Treat “revealing more information” as a priced action rather than a default behavior.
- Belief Summary: Local small models have limited context. Maintain a structured task state: known slots, pending questions, executed skills, recent tool results, and unresolved risks. Inject only the summary and necessary references per turn.
- Evaluation Set Construction: Cover normal paths, ambiguous paths, tool failures, permission denials, budget overruns, and adversarial inputs. Metrics include task success rate, context cost, latency, tool call accuracy, escalation rate, false rejection rate, and audit traceability.
- Security and Compliance: Sandbox skill execution, minimize tool permissions, require secondary confirmation for dangerous actions, and desensitize full-link logs. The value of localized deployment is not just cost saving, but controllable data boundaries.
- Online Monitoring and Replay: Record belief summaries, candidate skills, reveal actions, execution results, and escalation reasons to support offline replay and parameter tuning, avoiding routing adjustments based solely on subjective experience.
Pseudo-code illustration:
def policy_step(belief, obs, budget):# Rank candidate skills based on observation and beliefcandidates = rank_skills(obs, belief, top_k=8)best = Nonefor skill in candidates:p_success = estimate_success(skill, belief)info_gain = estimate_info_gain(skill, belief)cost = skill.cost + reveal_cost(skill)utility = p_success * task_value + info_gain * info_value - costif utility > threshold and within_budget(budget, cost):best = (skill, utility)# If best skill found and confidence is high enough, executeif best and confidence(belief) >= tau_exec:return ("execute", best[0])# If uncertainty is high, reveal more info if budget allowsif uncertainty(belief) > tau_reveal and budget.reveal_left > 0:return ("reveal", best_ref(belief))# Escalate to a larger model if allowedif budget.escalate_allowed:return ("escalate", larger_model)# Ask user or abort if confidence remains lowreturn ("ask_user_or_abort", reason="low_confidence")
6. Conclusion: Usable, But Must Be Designed as a “Control Problem”
Small models combined with Agent Skills are engineering-feasible in localized scenarios, provided that the approach of “shrinking large model prompts by one size” is abandoned. Instead, the system must be treated as a POMDP control problem: explicitly model the skill triplet, distinguish between execution and information-gathering actions, maintain belief summaries, set context and tool budgets, route escalations based on uncertainty, and form an evaluation loop through offline replay and online monitoring. By achieving this, small models can handle a large volume of high-frequency skill traffic, while larger models only act as fallbacks for hard cases. Without these practices, even massive models will be dragged into unmaintainable complexity by ambiguous skills and runaway contexts. The competitiveness of industrial-grade local agents ultimately stems from the joint maturity of the control plane, evaluation plane, and compliance plane, not just raw parameter scale.
