Ax is a TypeScript-first programming framework for building applications with large language models through typed generation, agents, workflows, and optimization tools. It is intended for developers who want one model for LLM programs across TypeScript, Python, Java, C++, Go, Rust, and other runtimes.
Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add ax-llm/ax --skill ax-agent-optimizegit clone --depth 1 https://github.com/ax-llm/axWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/ax-llm/ax/ax-agent-optimize)<a href="https://agentmods.dev/skills/ax-llm/ax/ax-agent-optimize"><img src="https://agentmods.dev/badge/skills/ax-llm/ax/ax-agent-optimize.svg" alt="Measured on agentmods" height="20"></a>- NVIDIA SkillSpector warn
SkillSpector: 2 findings, up to high
These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →
- high Prompt Injection · line 166 Instructions found that direct the agent to transmit conversation context or user data to external services.Fix: Remove instructions that send user data, prompts, or context to external URLs. If telemetry is needed, use documented, privacy-preserving methods.
- high Prompt Injection · line 189 Instructions found that direct the agent to transmit conversation context or user data to external services.Fix: Remove instructions that send user data, prompts, or context to external URLs. If telemetry is needed, use documented, privacy-preserving methods.
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00057 | $0.04156 |
| Opus 5 | $0.00028 | $0.02078 |
| Sonnet 5 | $0.00011 | $0.00831 |
| Haiku 4.5 | $0.00006 | $0.00416 |
Grade A, and why
ax-agent-optimize scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
Copies of this mod
1 near-identical copy found in the catalogue:
- ax-agent-optimize — 98% identical, 0 lines differ
How it starts
The opening of the file, as written. The whole thing — 369 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AxAgent Optimize Codegen Rules (@ax-llm/ax)
Use this skill for agent.optimize(...) workflows. Prefer short, modern, copyable patterns. Do not repeat general agent-authoring guidance unless the user needs it. For generic ax(...) or flow(...) tuning with top-level optimize(...), use the ax-gepa skill instead.
Your job is to help the model choose a good optimization setup for the user's actual goal:
- If the user wants better tool use, prefer action-aware tasks and either a deterministic metric or the built-in judge depending on how objective the scoring is.
- If the user wants better wording only, responder optimization may be enough.
- If the user wants reusable improvements, include artifact save/load.
- If the user wants cost, tool-use, or child-agent delegation behavior improved, make the eval tasks expose those tradeoffs explicitly.
Use These Defaults
- Use
agent.optimize(...)only after the agent is already configured and runnable. - Prefer the built-in judge path first for normal agent tuning. Most users should start with tasks that include
inputandcriteria, then letagent.optimize(...)use its default actor target and judge-based metric. - Keep top-level
optimize(program, train, metric, options)for non-agent generators and flows; do not rewrite normal agent task-record examples to the generic helper. - Prefer a deterministic custom
metriconly when success is easy to score from the prediction and task record. - Add
judgeAIplusjudgeOptionswhen the judge should run on a stronger or separate model than the agent runtime model. - Only reach for a plain typed
AxGenevaluator when the user needs LLM-as-judge behavior outside the built-inagent.optimize(...)flow. - Default optimize target is the actor path; do not surface
targetunless the user clearly wants responder-only tuning or explicit program IDs. - Use eval-safe tools or in-memory mocks because optimization replays tasks many times.
- Prefer precise tool return schemas such as
f.object(...)over vaguef.json(...)whenever the agent must reason about returned fields. - Prefer task wording with canonical entity names like "the Atlas project" instead of ambiguous labels like "Atlas" when ambiguity could trigger pointless clarification.
- Save artifacts with
axSerializeOptimizedProgram(result.optimizedProgram!), then restore withaxDeserializeOptimizedProgram(saved)andagent.applyOptimization(...). - For browser-safe persistence, let the caller store the serialized JSON anywhere they want such as localStorage, IndexedDB, or a backend.
- If
bootstrapis enabled, bootstrapped demos are persisted insideresult.optimizedProgram.demos; raw failed traces are not saved in v1. - Auto-promoted context fields (large undeclared inputs kept runtime-only by
autoUpgrade) appear in captured traces/demos as their truncated preview string, not the full value — same as declared truncate-stylecontextFields. This is expected; do not treat the shortened value as a bug in the saved demos. - For first examples, pass a plain task array instead of splitting into
trainandvalidationunless the user already has a holdout set. - GEPA-backed
agent.optimize(...)now optimizes generic components exposed by the selected target programs;target: 'actor'only tunes actor components,target: 'responder'only tunes responder components, andtarget: 'all'broadens the component set. result.optimizedProgram.componentMapis the canonical saved artifact for agent GEPA runs. It may include actor instructions, descriptions, tool descriptions/names, templates, or runtime primitives depending on what the selected target exposes.- When child-agent delegation matters, expose the child agents as named functions and tune against realistic call/no-call tasks.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- today Changed c881ad54cb6e
- 4d ago First seen · 369 lines · 57 tokens per session scan A 2cee84aa66ee
ax-agent-optimize is a skill published in the GitHub repository ax-llm/ax (2,893 stars, last pushed today), licensed Apache-2.0. It adds 57 tokens to every session and 4,156 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
output-dev-eval-testing
Create offline evaluation tests for Output SDK workflows using @outputai/evals. Use when implementing test evaluators with verify(), creating dataset YAML files, building eval workflows, or running workflow tests via CLI.
develop-ai-functions-example
Develop examples for AI SDK functions. Use when creating, running, or modifying examples under examples/ai-functions/src to validate provider support, demonstrate features, or create test fixtures.
output-dev-scenario-file
Create test scenario JSON files for Output SDK workflows. Use when creating test inputs, documenting expected behaviors, or setting up workflow testing.
output-eval-validate-judge
Validate LLM judges against human labels using TPR/TNR metrics and train/dev/test splits. Use after writing a judge prompt to verify it agrees with human judgment.
capture-api-response-test-fixture
For provider response parsing tests, we aim at storing test fixtures with the true responses from the providers (unless they are too large in which case some cutting that does not change semantics is advised).
add-function-examples
Guide for adding new AI function examples, for testing specific features against the actual provider APIs.