Building a Localized Small-Model Agent with POMDP-Based Skills

    This article explains how to design and deploy local AI Agents powered by small language models (SLMs) for high-security industrial environments. It introduces a formal POMDP model for Agent Skills, defines states, observations, actions, belief states, and skill components, and discusses model selection, routing, context acquisition, and failure recovery across models ranging from 270M to 80B parameters. The goal is to balance data compliance, infrastructure cost, and Agent performance.

    In highly sensitive environments such as financial risk control and defense research, strict data isolation is often a fundamental project requirement. Although commercial coding assistants and closed-source large-model APIs can perform code generation and task orchestration effectively within Agent frameworks, continuously sending internal data to public APIs creates significant compliance risks. API usage costs can also place considerable pressure on project budgets.

    These constraints have encouraged organizations to explore locally deployed open-source small language models (SLMs). However, Agent Skills frameworks were originally designed with much larger models in mind. Can these capabilities be transferred to SLMs while still delivering meaningful performance improvements? Researchers have addressed this question through a formal reconstruction of Agent Skills based on partially observable Markov decision processes (POMDPs), followed by broad stress testing across models on real-world industrial datasets.

    1. Modeling Agent Skills with POMDPs

    To convert a model’s opaque “intuition” into measurable engineering indicators, researchers model the Agent Skill system as a constrained controller that searches for information in a partially observable environment.

    At each decision step, the Agent must balance task progress against limited attention and context resources. It faces three primary choices:

    1. Submit and execute a skill: When the Agent believes that its current information is sufficient, it directly invokes a predefined skill module.
    2. Reveal more information: When available information is insufficient, the Agent pays an additional cost to obtain more context about the skill or the resources it references.
    3. Take a direct action: The Agent performs a basic operation or calls a tool directly in the environment.

    Because the underlying system state changes over time according to Markov dynamics, while the Agent cannot directly observe the true state of the Agent–task interaction, the system naturally fits a POMDP formulation.

    This formulation explicitly includes actions such as paid context acquisition. The Agent can therefore exchange additional computation or retrieval cost for higher-quality observations. Instead of executing blindly under uncertainty, it can actively obtain the information needed to resolve ambiguity.

    2. POMDP State Space and Mathematical Representation of Skills

    Within the POMDP framework, the key elements of the Agent system are defined as follows:

    • State (S): The potentially hidden task situation, including the user’s underlying intent, the current task phase and progress, and environmental facts that have not yet been retrieved.
    • Observation (O): All information available to the Agent at time t, including the current user message, accessible interaction history, and any resources or skills that have already been revealed or loaded.
    • Action (A): Skill selection, paid context acquisition, skill execution, environment and tool calls, as well as internal planning and reasoning steps.
    • Belief state (B): The Agent’s estimated probability distribution over the current true state, based on its observation history and previously executed actions.

    Each individual skill is further represented as an abstract tuple consisting of three components:

    1. Text descriptor: The skill name and its natural-language description, which guide the Agent in determining when the skill should be invoked.
    2. Internal policy: A time-extended execution policy that generates a sequence of lower-level actions, such as an option-level process or workflow.
    3. Reference mechanism: A mechanism for revealing additional skill-related context and tools. It may also point to other skills and is formally represented as a Markov kernel.

    This structure provides a way to describe not only what a skill does, but also how the Agent discovers the skill, executes it, and obtains additional information when required.

    3. Engineering Practice: Model Selection and Routing for Local Agents

    Once the theoretical model is established, the main engineering question is how to select model sizes and configure routing under limited hardware budgets.

    Researchers evaluated open-source models ranging from 270M to 80B parameters using real industrial datasets and subjected them to extensive stress testing. The results indicate that transferring Agent Skills to smaller models is not a simple model replacement exercise. Careful engineering adaptation is required.

    For highly resource-constrained edge nodes, models in the hundreds-of-millions to 1B-parameter range have limited reasoning capabilities. However, they can compensate by frequently using the POMDP-defined paid context acquisition action to retrieve information from external knowledge bases. Repeated calls to retrieval and memory mechanisms can help maintain task accuracy despite the models’ limited internal capacity.

    Models in the 7B to 34B range provide a practical balance between internal policy coherence and complex logical reasoning. They can interpret complex text descriptors and maintain belief states more effectively, making them strong candidates for local Agent deployments.

    Models around 80B parameters generally achieve the best results across evaluation metrics, but their demanding memory and compute requirements make high-concurrency deployment difficult on conventional industrial servers.

    In practice, organizations can host these open-source models on container platforms or general-purpose compute instances provided by services such as Baidu AI Cloud. Elastic resource scheduling can be used to add GPU capacity during inference peaks. Combined with logging, monitoring, and alerting, this setup can help teams track belief-state convergence and the reward values associated with executed actions in the POMDP model.

    4. Routing Configuration and System Optimization

    The effectiveness of a local Agent depends heavily on dynamic routing. Developers should design routing logic based on the probability distribution of the Agent’s belief state.

    1. Low-confidence routing: When belief-state confidence is low, route the task to a smaller model with strong external retrieval and information-integration capabilities. The model should use paid context acquisition to gather additional information rather than attempting unsupported reasoning.
    2. High-confidence execution: When observations are sufficient and the state is clear, route the task to a medium-sized model that can directly invoke the relevant internal policy and execute the skill.
    3. Failure degradation: If a particular skill fails repeatedly or produces negative returns, the routing system can automatically downgrade the task to a smaller model and execute basic actions. This helps preserve the robustness of the overall local Agent.

    Conclusion

    The POMDP-based formalization of Agent Skills provides both a theoretical foundation and an engineering framework for deploying local Agents with small language models. It demonstrates that, with appropriate action design and context management, SLMs can deliver substantial value in demanding industrial environments.

    When building a local Agent, developers should look beyond model parameter count alone. More important factors include the precise configuration of POMDP elements, the design of context acquisition actions, and the quality of routing policies. These choices help organizations achieve a practical balance among compliance, infrastructure cost, and Agent performance.