SuperAPIAI Directory

weco-cli

github.com · AI agents

Autoresearch CLI that optimizes code (GPU kernels, ML models, prompts) by editing a file, running your eval, and keeping changes only when the metric improves.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsmacOS · Linux · API

About this tool

Weco is a production-grade automated research (Autoresearch) tool, provided in the form of a command-line interface (CLI), designed to systematically optimize code, with the optimization process directly guided by user-defined evaluation metrics.

Purpose

Weco is suitable for any code optimization task with a measurable objective. Typical applications include:

  • Agent and framework engineering: improve the framework around LLM agents, including prompts, tools, and agent scaffolding, optimizing accuracy, win rate, or cost.
  • Prompt engineering: refine prompts for LLMs (for example, for math problems), or compress prompts while maintaining accuracy, optimizing win rate, relevance, or format adherence.
  • Model development: adjust feature transformations, architecture, or the entire training pipeline, optimizing validation accuracy, AUC, or Sharpe ratio.
  • General performance optimization: accelerate any code with a measurable objective, including CUDA or Triton GPU kernels, optimizing latency, throughput, or memory bandwidth.

Key capabilities

The Weco CLI uses an LLM-guided tree search method to iteratively explore and improve code. It automatically applies changes, runs evaluation scripts, parses results, and suggests further improvements based on the specified objective.

Weco is also released as a Skill for AI coding assistants. A Skill is a set of instructions that teaches the assistant to use Weco end to end—from setting up an optimization to interpreting results. After installation, simply describe in natural language what you want to optimize, and the assistant will inspect the code, write the evaluation, configure weco run, monitor iterations, and explain the results, with no need to manually enter CLI flags.

In addition, weco observe allows users to track experiments in their own optimization loops (run by LLM agents, custom scripts, or manual workflows), providing tree visualization, code diffs, and metric tracking in the Weco dashboard, without having to hand over control of the optimization.

Usage

Installation:

  • macOS / Linux (recommended): pip install weco
  • Windows PowerShell: pip install weco

Quick start: you can quickly get started with the example project, or directly use the weco run command to configure optimization parameters yourself.

Example: optimize a simple PyTorch operation. Note: if you have an NVIDIA GPU, change the device in --eval-command to cuda; if running on Apple Silicon, set it to mps.

Multi-file optimization: If the code spans multiple files, use --sources to optimize them together; Weco will optimize all specified files at the same time, allowing changes across file boundaries.

Note: It is recommended to remove any backticks from the code. Backticks are currently not supported, but will be in the future.

For the arguments of weco run, command reference, basic usage patterns, etc., see the official documentation.

Run subcommand: inspect and manage optimization runs; all output is JSON, designed specifically for programmatic access (AI coding agents, scripts). When using --source with revise or submit, you can map local files to the run's source paths via the target_path=local_path syntax (for example, --source module.py=./optimized.py). If there is no explicit mapping, files will be matched to the run's original source paths by position.

Observe command: track experiments from your own optimization loop in the Weco dashboard. Failure information is printed to stderr; init exits non-zero on any failure, while log exits non-zero only on caller errors, and retries, reports, and exits with 0 for transient issues on Weco's side, so it will not crash the agent's loop—pass --strict to change this behavior. For branches, explicitly pass --parent-step.

Setup command (experimental): The setup command installs the Weco skill for AI coding assistants:

  • Claude Code: Downloads the Weco skill to ~/.claude/skills/weco/ and writes CLAUDE.md inside the installed skill
  • Cursor: Downloads the Weco skill to ~/.cursor/skills/weco/
  • Codex: Downloads the Weco skill to $CODEX_HOME/skills/weco/ (defaults to ~/.codex/skills/weco/)
  • OpenClaw: Downloads the Weco skill to ~/.openclaw/skills/weco/

Model selection: You can use the -M or --model flag to specify an LLM model. Available models include the GPT-6 series, GPT-5 series, O-series reasoning models, GPT-4 series, Anthropic Claude (via Vertex AI), Gemini series, managed open-source models (Concentrate AI gateway, also callable via concentrate/<model>), via Concentrate AI (prefix required), Kimi (official Moonshot API), etc. All models are available through Weco. If no model is specified, Weco will automatically select the best model for the optimization task.

Resume interrupted runs: If an optimization run is interrupted (network issues, restart, etc.), it can be resumed from the most recent checkpoint. This only applies to interrupted runs (status error, terminated, etc.). The system will prompt to confirm that the evaluation environment (source file + evaluation command) has not changed. The source file will be restored to the most recent solution before continuing. All progress and metrics from the original run are preserved. The log directory, save-log behavior, and evaluation timeout are all reused from the original run.

Performance and Expectations

Weco is powered by the AIDE algorithm, which iteratively optimizes code based on evaluation results. Achieving significant improvements on complex research-level tasks typically requires substantial exploration time. The charts in the independent Research Engineering Benchmark (RE-Bench) report show the performance of AIDE (the algorithm behind Weco) on challenging ML research engineering tasks under different time budgets. AIDE demonstrates strong performance gains over time, surpassing lower human expert percentiles within hours and continuing to improve. This demonstrates the potential of evaluation-driven optimization, but also indicates that reaching a high level of performance comparable to human experts on difficult benchmarks may require considerable time (tens of hours in that particular benchmark, corresponding to many --steps in the Weco CLI). This should be taken into account when planning the number of --steps for an optimization run.

Saving Execution Logs

When using the --save-logs flag, Weco saves the execution output of each optimization step to aid debugging and analysis. Logs are organized as follows: each run is organized by source file name (e.g., spaceship-titanic.py corresponds to spaceship-titanic) and a unique UUID. The outputs/ directory and exec_output.jsonl file are only created when the --save-logs flag is used. Each line of the exec_output.jsonl file contains a JSON object with fields including: step (optimization step number), timestamp (execution time), output_file (the relative path of the complete output file), output_length (the total output length). When using --parallel K, artifacts are keyed by node UUID rather than step number (steps are assigned on the server side and may complete out of order): code snapshots are located under nodes/<node-id>/, outputs are outputs/node_<node-id>.out.txt, and exec_output.jsonl entries carry a node_id field instead of step.

This is particularly useful for the following situations: debugging why certain optimizations fail, analyzing patterns in evaluation results, keeping records of long optimization sessions, and troubleshooting evaluation script issues.

Important Notes About Evaluation

The command specified by --eval-command is critical. It is responsible for executing the possibly modified code from --source (or --sources) and evaluating its performance. This command must print the metric specified by --metric and its numerical value to the terminal (standard output or standard error). Weco reads this output to understand the performance of each code version and guide the optimization process. For example, if --metric speedup is set, the evaluation script should output something like a line containing the metric name and its numerical value. Weco will parse this output to extract the numerical value associated with the metric name.

Output truncation note: when the evaluation output exceeds 51,000 characters, Weco truncates it to display the first 25,000 and the last 25,000 characters. For best results, make sure the evaluation script prints the metric value near the end of the output.

Limitations

  • Backticks (backticks) in code are currently not supported; they will be supported in the future.
  • Achieving a high level of performance on complex research-level tasks may require a large amount of exploration time (tens of hours, corresponding to many --steps).
  • Evaluation output is truncated when it exceeds 51,000 characters.
  • The resume feature only applies to interrupted runs (with states such as error, terminated, etc.).
  • The setup command is an experimental feature.

Contributing

Contributions are welcome; see contributing.md for details. For larger changes, please open an issue first to discuss the approach.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools