Manuscript Offprint

arXiv:2609.11682

COBRA-Skills: Contextual Bandit-Guided Evolution for Agent Skill Optimization

Pingchen Lu, Xiangyi Wang, Xiang Li, Jie Mao, Zikun Qu, Junfeng Luo, Yao Shu, Bryan Kian Hsiang Low, Zhongxiang Dai

ABSTRACT

Large language model (LLM) agents can benefit from reusable skills distilled from prior task experience, yet existing skill optimization methods often rely on costly execution-based evaluation and substantial task data. We introduce COBRA-Skills, an efficient framework that formulates skill optimization as budgeted sequential optimization over a dynamically evolving candidate space. COBRA-Skills couples contextual-bandit-guided prioritization with evidence-grounded skill evolution, selectively allocating evaluations to promising or informative candidates while continually refining the skill population from execution feedback. Across six heterogeneous agent benchmarks and three target models, COBRA-Skills consistently achieves the strongest average performance among compared methods, while reducing optimization cost by 55–58% relative to SkillOpt and using only 50 unique optimization examples per benchmark. Further analyses show that COBRA-Skills remains robust to changes in the agent harness and performs effectively when the target model itself is used for skill generation and refinement. Code is available at https://github.com/Jerry-LuP/COBRA-Skills.

1 INTRODUCTION

Large language model (LLM) agents often encounter tasks that share recurring objectives, procedures, tools, and failure modes (Yao et al., 2022; Wang et al., 2023; Zhao et al., 2024; Wang et al., 2024b). Agent skills provide a lightweight way to capture such reusable procedural knowledge: a skill can encode task-specific guidelines, reasoning strategies, or tool-use procedures and be injected into the agent's context when solving new instances (Xu & Yan, 2026; Ling et al., 2026; Zhou et al., 2026b). However, obtaining reliable skills remains challenging. Manually authoring high-quality skills requires substantial effort and domain expertise (Ni et al., 2026), while directly generating skills from an LLM's parametric knowledge may produce plausible but ungrounded guidance that does not reliably improve downstream performance (Li et al., 2026). Recent work therefore grounds skill construction in actual agent trajectories and execution feedback (Ni et al., 2026; Xia et al., 2026), with several methods further adopting iterative evolutionary refinement to generate, revise, and select stronger skills from accumulated experience (Zhang et al., 2026; Alzubi et al., 2026).

While experience grounding and evolutionary refinement can improve skill quality, their reliance on execution feedback creates two related efficiency bottlenecks. First, candidate utility is expensive to assess: existing approaches commonly use execution-based generate-evaluate-refine loops, in which candidate skills must be executed on tasks or held-out validation instances before their actual utility can be observed (Yang et al., 2026a; Liu et al., 2026c; Zhang et al., 2026). Consequently, substantial optimization budgets can be spent evaluating low-quality or unpromising skills before they can be identified as such. Second, skill refinement itself can be expensive: existing methods often repeatedly invoke LLMs to analyze execution trajectories, diagnose failures, and generate

†^{\dagger}Corresponding author. Correspondence to daizhongxiang@cuhk.edu.cn.

Figure

Figure 1: Overview of COBRA-Skills. At each round, skills in PtP_t are prioritized using a neural reward predictor and LinearUCB bonus based on Ht−1\mathcal{H}_{t-1} (①), and the highest-priority skill is evaluated by the target agent (②). The resulting reward and trajectories update the optimization history and scoring model (③). At scheduled population updates (performed periodically rather than after every round), new skills are evolved from accumulated evidence (④), and the updated priority scores from ① identify low-priority skills, which are replaced by the newly evolved skills to form Pt+1\mathcal{P}_{t+1} (⑤). Dashed borders and arrows indicate scheduled-only operations.

or aggregate skill modifications (Ni et al., 2026; Yang et al., 2026a). Although grounding skill construction in actual execution evidence can yield promising candidates, repeatedly re-analyzing trajectories and revising skills throughout optimization can incur substantial additional token cost. Under limited computation and task experience, the key challenge is therefore to selectively allocate candidate evaluations and efficiently reuse the resulting execution evidence for skill refinement, rather than exhaustively evaluating and repeatedly rewriting candidates.

The need to allocate limited evaluations among uncertain candidates naturally motivates a bandit formulation. Each candidate skill is treated as an arm represented by its semantic embedding, and its observed target-agent performance provides the reward. Meanwhile, we also seek to use the skill execution trajectories to evolve the candidate skills, creating a changing set of candidate arms. This fits a contextual bandit setting, in which the available arms are described by features and can vary across rounds (Li et al., 2010; Chu et al., 2011). Conditioning reward prediction on these arm features allows previous evaluations to inform the prioritization of semantically related skills, including those not yet evaluated. By balancing predicted utility and uncertainty, the bandit algorithm can prioritize promising or insufficiently explored skills among an evolving set of skills under a limited evaluation budget.

We propose COBRA-Skills, which closes the loop between contextual-bandit-guided skill prioritization and evidence-grounded skill evolution (Fig. 1, Alg. 1). COBRA-Skills maintains a population of candidate skills and uses a lightweight neural reward predictor together with a LinearUCB-style uncertainty bonus to prioritize skills for both evaluation and population retention. Periodically, the population is refreshed through three evidence-grounded evolutionary operators: regeneration, rollout mutation, and crossover. Regeneration derives independent skills from the original no-skill trajectories to introduce new search directions; rollout mutation revises the currently evaluated skill using its successful and failed trajectories; and crossover refines a high-performing backbone skill using another strong skill as positive evidence and low-performing skills as negative evidence. These operators introduce new candidates while low-priority skills with limited predicted utility and exploration value are pruned. Newly generated skills receive no inherited reward and must re-enter the

Qwen3.6-35B-A3B

Figure

GPT-5.4-Nano

Figure

Gemma4-26B-A4B-it

Figure

Figure

(e)

(f)

Figure 2: Overall performance and cost-effectiveness across target models. Top: average test performance across six benchmarks for three target models. Bottom: the relationship between average test performance and total optimization cost under the native harness.

same contextual-bandit-guided evaluation loop. In this way, the contextual bandit efficiently allocates evaluation effort within the current population, while evolution continually refines and expands the candidate search space.

We evaluate COBRA-Skills on six heterogeneous agent benchmarks spanning question answering, spreadsheet manipulation, visual document understanding, mathematical reasoning, social reasoning, and embodied decision making, using three target models with different capability levels. COBRA-Skills achieves the highest average performance among all compared methods for every target model, improving over the corresponding no-skill agents by 13.1, 26.9, and 22.5 percentage points on Qwen3.6-35B-A3B, GPT-5.4-Nano, and Gemma-4-26B-A4B-it, respectively (Fig. 2 & Table 1). Compared with SkillOpt (Yang et al., 2026a), COBRA-Skills reduces total optimization cost by 55%–58% and cost per point of improvement by 60%–69%, while using only 50 unique optimization examples per benchmark (Table 2). We further observe consistent effectiveness under external agent harnesses (Table 3) and in a self-teaching setting (Sec. 5.2), suggesting that the gains are not tied to a particular execution interface or a stronger external teaching model.

Our contributions are threefold:

• We formulate agent skill optimization as a budgeted sequential optimization problem over a dynamically evolving candidate space, where candidate utilities are uncertain and can only be revealed through costly target-agent evaluations.

• We propose COBRA-Skills, which couples contextual-bandit prioritization with evidence-grounded population evolution to jointly improve evaluation allocation, candidate retention, and continual skill refinement.

• We conduct extensive experiments across six agent benchmarks, three target models, and multiple execution harnesses. COBRA-Skills consistently improves downstream performance while achieving favorable performance–cost and sample-efficiency trade-offs.

References (56)