Skip to main content
Glama

optimize_bandit

Read-only

Select the optimal variant from a set of options using multi-armed bandit algorithms to balance exploration and exploitation based on observed rewards.

Instructions

Pick the best option from a set of variants (Multi-Armed Bandit: UCB1, Thompson sampling, or ε-greedy). Use this when you have N options with observed reward history and need to choose the next one with optimal explore/exploit tradeoff (A/B test arm selection, ad/email variant routing, recommendation ranking). For context-dependent selection (different best option per user/situation), use optimize_contextual instead. For continuous parameter tuning, use optimize_cmaes. Returns the selected arm + score breakdown in <1ms.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
armsYesCandidate options to choose between (at least 2).
algorithmNoSelection algorithm (default: ucb1). UCB1 is deterministic; thompson/epsilon-greedy sample.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectedYesThe chosen arm.
scoreYesCombined exploitation + exploration score.
algorithmYesWhich algorithm produced the selection.
exploitationNoPure mean-reward component.
explorationNoUncertainty bonus added to exploitation.
regretNoCumulative regret estimate (lower is better).
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare readOnlyHint=true (safe read). Description adds return info (arm + score breakdown) and performance guarantee (<1ms). No contradictions. Adds value beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with core purpose, then usage guidance, then return/performance. Every sentence adds value, no fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Comprehensive for a bandit selection tool: purpose, use cases, alternatives, parameter semantics, output description, performance. No gaps given existing schema and annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Adds meaning beyond 100% schema coverage: clarifies that arms need reward history (pulls, totalReward) and explains algorithmic behavior (UCB1 deterministic, thompson/epsilon-greedy sample).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states 'Pick the best option from a set of variants' and specifies algorithms (UCB1, Thompson, ε-greedy). Distinguishes from siblings optimize_contextual and optimize_cmaes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly tells when to use (options with reward history, explore/exploit tradeoff) and when not to use (context-dependent → optimize_contextual, continuous tuning → optimize_cmaes).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Whatsonyourmind/oraclaw'

If you have feedback or need assistance with the MCP directory API, please join our Discord server