# Add to your Claude Code skills
git clone https://github.com/Optim-Agent/optim-agentoptim-agent is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by Optim-Agent. LLM agents as your hyperparameter optimizer. It has 51 GitHub stars.
optim-agent's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/Optim-Agent/optim-agent" and add it to your Claude Code skills directory (see the Installation section above). optim-agent ships a SKILL.md manifest, so compatible agents can discover and load it automatically.
optim-agent is primarily written in Python. It is open-source under Optim-Agent on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh optim-agent against similar tools.
No comments yet. Be the first to share your thoughts!
Unlocks once the catalog security scan passes (runs nightly).
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
Act as the sampler inside any coding-agent session: Claude Code, Codex, OpenCode/OpenClaw, or another agent that can read project files and run shell commands. Read the project to understand parameter meaning and interactions, propose one configuration, run the real evaluator, and record the result through optim-agent's ask/tell API. Let the measured objective, not the agent's intuition, decide what works.
Use this file as the operating guide for the active coding agent. In Codex, it can be installed directly from GitHub:
$skill-installer install https://github.com/Optim-Agent/optim-agent
In Claude Code, OpenCode/OpenClaw, or another coding-agent environment, place
this repository or SKILL.md in the agent-visible workspace and ask the agent
to follow the optim-agent workflow. The workflow does not depend on Codex-only
APIs; it needs file access, shell access, and Python.
Ensure the Python package is importable. Choose one source; do not install both:
# Stable release from PyPI
python -m pip install optim-agent
# Latest source from GitHub
python -m pip install "optim-agent @ git+https://github.com/Optim-Agent/optim-agent.git"
For a reproducible GitHub install, append @<tag-or-commit> after .git.
Understand the system. Read the evaluation entry point and every file that defines the target parameters. Record each parameter's type, legal range, semantics, interactions, and operational constraints.
Define the experiment. Confirm the scalar objective, minimize or
maximize, trial budget, evaluation command, runtime/cost limit, and fixed
workload or seed. For multiple metrics or hard constraints, agree on one
scalar feasibility or penalty rule before running trials.
Establish a baseline. Evaluate the current/default configuration with the same command and environment used for every later trial.
Initialize or resume. Keep artifacts in the repository's ignored
.optim-agent-runs/ directory:
if git rev-parse --git-dir >/dev/null 2>&1 && ! git check-ignore -q .optim-agent-runs/; then
printf '/.optim-agent-runs/\n' >> "$(git rev-parse --git-path info/exclude)"
fi
from pathlib import Path
import optim_agent as oa
run_dir = Path(".optim-agent-runs")
run_dir.mkdir(exist_ok=True)
study = oa.create_study(
direction="minimize",
storage=run_dir / "skill-study.json",
seed=0,
)
print([(t.params, t.value, t.state) for t in study.trials])
Run one informed trial. Choose parameters from code understanding and all completed history, then use explicit ask/tell:
params = {"threshold": 0.72, "budget": 80}
trial = study.ask(params)
try:
value = evaluate_system(**trial.params)
except Exception:
study.tell(trial, state="failed")
raise
else:
study.tell(trial, value)
For a deliberately stopped trial, report the latest valid intermediate
metric first, then call study.tell(trial, state="pruned").
Select the next point. Avoid accidental repeats, explore broadly before exploiting, respect bounds and constraints, and treat failed regions as evidence. If the evaluator is noisy, repeat promising configurations under the same workload before declaring a winner.
Stop and report. Stop at the approved budget or stopping condition. Report the baseline, best value and parameters, trial count, failed/pruned trials, convergence trend, and exact reproduction command.
JSON storage records a trial when study.tell runs. Before launching an
expensive external evaluation, save its parameters, command, and output path in
a per-trial directory under .optim-agent-runs/. After interruption, inspect
that output before rerunning: if a valid result exists, recreate the same point
with study.ask(params) and record it; otherwise rerun it deliberately.
Use SQLite storage (skill-study.db) only when the user explicitly wants
multiple processes. Sequential trials are the default because each proposal
should use the complete prior history.
AgentSampler when the session agent is meant to read and reason over code.failed; record intentional early stops as pruned.optim-agent uses Claude Code, Codex, or OpenCode to optimize any system that exposes configurable parameters and a measurable objective. It combines what each parameter means with what the trial history shows, then proposes the next configuration to evaluate. Objective evaluations remain authoritative: optim-agent proposes values, validates them against the declared space, records outcomes, and falls back to safe sampling when an agent reply is invalid.
| Models | Systems | Research |
|---|---|---|
| Training, architecture, and RL experiments | Inference, latency, cost, control, and decision rules | Quant signals, simulations, and scientific workflows |
Install from PyPI or GitHub:
# Stable release from PyPI
python -m pip install optim-agent
# Latest source from GitHub
python -m pip install "optim-agent @ git+https://github.com/Optim-Agent/optim-agent.git"
Requires one authenticated agent CLI on PATH:
claude,
codex, or
opencode.
import optim_agent as oa
def objective(trial):
threshold = trial.suggest_float(
"threshold", 0.05, 0.95,
context="decision threshold; higher values trade recall for precision",
)
budget = trial.suggest_int(
"budget", 10, 200, log=True,
context="compute or operating budget; larger values may improve quality",
)
return evaluate_system(threshold=threshold, budget=budget) # domain code
study = oa.create_study(
direction="maximize",
sampler=oa.AgentSampler(
backend="claude", # or "codex" / "opencode"
effort="high",
context="maximize system quality under a strict operating-cost budget",
history=5,
explicit_reasoning=True,
qualitative_notes=True,
),
storage="study.json", # optional: persist and resume
)
study.optimize(objective, n_trials=20)
print(study.best_value, study.best_params)
Optional context gives domain meaning to the study and parameters. Provide it
study-wide on AgentSampler(context=...), per parameter on
suggest_*(..., context=...), or both.
| Area | Parameters optim-agent can tune | Example objective |
|---|---|---|
| Model training | learning rates, architectures, augmentation, regularization | validation quality, compute, robustness |
| Inference and serving | quantization, batching, decoding, caching, routing | quality, latency, throughput, cost |
| Quantitative research | signal windows, thresholds, rebalance rules, risk controls | walk-forward return, drawdown, turnover |
| Reinforcement learning and decisions | objective weights, exploration schedules, environment settings, policy thresholds | return, safety, sample efficiency |
| Scientific workflows | simulation inputs, solver settings, experimental controls | fit, error, runtime, resource use |
| Black-box systems | any bounded categorical, integer, or continuous configuration | scalar objective score |
For reinforcement learning, optim-agent tunes the system around the learning loop; it does not replace the policy-learning algorithm.

This seed-0 Branin trace compares TPE and GPT-5.5 under the same 10-trial budget, with incumbent objective values after each trial. It is a trajectory illustration; aggregate benchmark results and reproduction commands follow.
Hard-function agents receive no supplied task context: only generic
x1...x5 parameter names, numeric bounds, and trial history. Runs use 10 trials
over five seeds; Random and TPE are unchanged baselines.

| method | mean best Branin ↓ | mean best Ackley-5D ↓ |
|---|---|---|
| Random | 5.008 | 19.639 |
| TPE | 11.395 | 18.843 |
| GPT-5.5 | 1.326 | 3.960 |
| Opus-4.8 | 0.398 | 0.061 |
| Sonnet-5 | 3.850 | 0.143 |
| GLM-5.2 | 3.609 | 15.023 |
The pinned models are gpt-5.5, claude-opus-4-8, claude-sonnet-5, and
glm-5.2.
Opus-4.8 reaches the Branin optimum on average and has the strongest five-seed
Ackley mean.

| method | mean best Branin ↓ | mean best Ackley-5D ↓ |
|---|---|---|
| Random | 5.008 | 19.639 |
| TPE | 11.395 | 18.843 |
| Big-pickle | 4.734 | 15.951 |
| DeepSeek-V4-Flash | 4.410 | 4.608 |
| Nemotron-3-Ultra | 16.051 | 18.459 |
| MiMo-v2.5 | 3.682 | 15.597 |
OpenCode-hosted models require no paid model API. The free pool rotates; this
refresh pins opencode/big-pickle, opencode/deepseek-v4-flash-free,
opencode/nemotron-3-ultra-free, and opencode/mimo-v2.5-free. DeepSeek V4
Flash has the strongest free-model Ackley mean, while MiMo-v2.5 has the
strongest free-model Branin mean.
The classification benchmark compares Random, Optuna TPE,
GPT-5.5 w/ context, and GPT-5.5 w/o context over five seeds (0..4) and
10 trials. The context condition receives natural-language study and parameter
descriptions; the no-context condition receives only bounds and trial history.
For classification, the primary metric emphasizes fast improvement:
cumulative_best_so_far_error = sum(best_test_error_so_far_at_i for i in 1..10)
Lower is better.

| method | MNIST cumulative error ↓ | MNIST final error ↓ | CIFAR-10 cumulative error ↓ | CIFAR-10 final error ↓ |
|---|---|---|---|---|
| Random | 9.174 | 0.648% | 278.920 | 25.072% |
| TPE | 7.166 | 0.580% | 279.936 | 25.596% |
| GPT-5.5 w/ context | 5.668 | 0.506% | 220.994 | 21.322% |
| GPT-5.5 w/o context | 8.910 | 0.632% | 281.466 | 25.960% |
GPT-5.5 w/ context reduces cumulative best-so-far error by 20.9% relative to TPE on MNIST and by 20.8% relative to Random on CIFAR-10. Without context, it is 24.3% worse than TPE on MNIST and 0.9% worse than Random on CIFAR-10. The gap includes both semantic parameter information and earlier access to agent-guided proposals.
Both examples/mnist.py and
examples/cifar10.py tune learning rate, batch size,
weight decay, label smoothing, three stage widths, three stage depths, and four
dropout controls. MNIST adds translation and rotation; CIFAR-10 uses crop
padding and flip probability.
![CPU-only Gymnasium RL control benchmar