How Do You Use Carbon-X as a DNA Tool for AI Agents?
Wrap a vLLM-served Carbon-X as an agent tool: ask_carbon, tool calling, Claude Code and Codex skills, Inspect, and tips for passing DNA by reference.

How do you use Carbon-X as a tool for an agent?
You serve Carbon-X with vLLM, then wrap it in a small function, ask_carbon(question, sequences, context), that takes a question plus a dictionary of named DNA sequences and returns Carbon-X's text answer. A general-purpose agent, such as Claude Code or a Codex-style CLI agent, calls that function through tool calling whenever a task involves DNA. The agent does the orchestration. Carbon-X answers the DNA questions.
TL;DR
- Carbon-X is an open model that reads raw DNA in a chat message, so it fits naturally behind a single question-answering tool.
- The model card's pattern is a vLLM server plus an
ask_carbonfunction that accepts a question, named sequences and optional context. - Carbon-X is a specialist, not the orchestrator. Pair it with a separate general-purpose agent model that plans, writes code and decides when to call it.
- Keep thinking disabled and the default sampling settings, since that is how the model was post-trained and evaluated.
- Have the agent pass sequences by name or file reference rather than retyping them, because long strings copied through a model's output are easy to corrupt.
- Include gene, strand, coordinates and annotations in
context, because without them the model may guess at a sequence's identity or function.
Why give an agent a DNA specialist at all?
General-purpose agents are good at planning, file handling and code. They are weaker at reading raw sequence. Carbon-X was trained jointly on DNA and text, with DNA and text sharing one token stream in one decoder and no separate DNA encoder. It averages 66.7% across five DNA benchmarks with thinking disabled, 27 points above Qwen3-14B, the model it started from.
The model card also puts cost in the picture. It reports Carbon-X close to GPT-6.1 Sol (67.5% average) at about 1/1,800 of the inference cost per problem. That makes it cheap to call repeatedly from an agent loop. Because the weights fit on one 80 GB GPU in bfloat16, sensitive or unpublished sequences can stay on your own infrastructure. The agent never has to send them to a third-party API for the DNA step.
How do you serve Carbon-X for tool use?
Serve it with vLLM. The tokenizer is custom code, so --trust-remote-code is required.
pip install -U vllm
vllm serve HuggingFaceBio/Carbon-X --trust-remote-code
vLLM exposes an OpenAI-compatible endpoint at http://localhost:8000/v1. Any OpenAI client can talk to it. Disable thinking per request:
from openai import OpenAI
carbon = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
response = carbon.chat.completions.create(
model="HuggingFaceBio/Carbon-X",
messages=[{"role": "user", "content": "What does this sequence encode?\n\nATGGTGCATCTGACTCCTGAGGAGAAGTCTGCCGTT"}],
extra_body={"chat_template_kwargs": {"enable_thinking": False}},
)
vLLM applies the sampling defaults from generation_config.json (temperature 0.6, top-p 0.95, top-k 20) unless you override them. Those are the settings behind every reported result, so leave them alone unless you have a reason.
What does the ask_carbon function look like?
The model card's wrapper has this signature:
def ask_carbon(question: str, sequences: dict[str, str], context: str = "") -> str:
"""Ask Carbon-X a question about one or more named DNA sequences."""
It builds one user message from the optional context, the question and each named sequence, sends it to the vLLM endpoint, and returns the reply text. The model card's snippet is cut off in the material I worked from, so the body below is my own sketch of that idea, not the official code:
def ask_carbon(question, sequences, context=""):
parts = [context, question] if context else [question]
for name, seq in sequences.items():
parts.append(f"{name}: {seq}")
resp = carbon.chat.completions.create(
model="HuggingFaceBio/Carbon-X",
messages=[{"role": "user", "content": "\n\n".join(parts)}],
extra_body={"chat_template_kwargs": {"enable_thinking": False}},
)
return resp.choices[0].message.content
Two design points matter. Everything goes into one user message, which matches the model card's advice to put the sequence and the question together. And sequences are named, so a variant question can carry labeled Reference and Variant entries.
How do you expose it through tool calling?
If your agent framework uses OpenAI-style function calling, describe the function as a tool schema and route the call to ask_carbon:
tools = [{
"type": "function",
"function": {
"name": "ask_carbon",
"description": "Ask a DNA language model a question about named DNA sequences.",
"parameters": {
"type": "object",
"properties": {
"question": {"type": "string"},
"sequences": {"type": "object", "additionalProperties": {"type": "string"}},
"context": {"type": "string"},
},
"required": ["question", "sequences"],
},
},
}]
The orchestrating model must itself support tool calling. Carbon-X is the callee, not the planner. Write a clear description so the agent knows to use it for variant effects, regulatory regions, organism classification and next-base prediction, which are the tasks the model card lists.
How do Claude Code and Codex skills fit in?
Coding agents like Claude Code and Codex CLI can load "skills," which are packaged instructions plus helper scripts the agent reads when a task matches. The Carbon-X release includes a skill for both, so the agent learns when to reach for Carbon-X and how to call it. I am not reproducing the skill files here, since they are not in the material I have. Check the Carbon repository for the current versions.
The practical effect is that you don't hand-write a tool schema. The agent reads the skill, runs the helper against your vLLM endpoint, and gets the answer back in its shell session. This suits tasks like "here is a FASTA file, check this variant," where the agent is already working in a project directory.
What about Inspect?
The release also includes an Inspect example. Inspect is an evaluation framework for LLMs, and the use case is running an agent with Carbon-X as one of its tools inside a repeatable eval. That lets you measure whether the agent calls the tool at the right moments and uses the answer well, instead of judging by a few manual chats. The exact setup lives in the repository.
How do you make the tool reliable?
Most failures come from how sequences travel, not from the model.
- Pass DNA by reference. An orchestrating LLM that retypes a 2,000-base sequence in a tool call can drop or alter characters. Let the tool read the sequence from a file or a named variable, and have the agent supply only the name. The dictionary of named sequences in
ask_carbonmakes this natural. - Add context. Give gene, strand, coordinates and annotations when you know them. The model card says that without context the model may guess at identity or function.
- Give variant questions the right shape. Supply reference and alternate sequences, or a reference with the position and base change.
- Clean the bases. Only A, C, G and T form 6-mers. A 6-mer containing
Nor another character becomes a single<oov>token, so filter to canonical bases to keep full resolution. - Mind the window. One DNA token covers 6 base pairs and the context is 40,960 tokens. FrontierVEP, one of the benchmarks, uses references up to 8,192 bases, so long inputs are workable but not unlimited.
- Leave auto-tagging on. The tokenizer wraps runs of six or more A/C/G/T bases in
<dna>tags automatically. You can passauto_dna_tags=Falseif you need to turn that off.
Where does the tool fall short?
Know the per-task numbers before trusting an answer. Carbon-X scores 29.8% on splice sites and 34.6% on histone marks in GenomeQA, but 93.2% on organism group and 90.0% on motifs. On non-SNV variants it scores 85.1, behind Opus 5.5 (94.8) and GPT-6.1 Sol (91.7). Treat the output as one input to the agent's reasoning, not as a verdict, and have the agent report which tool produced which claim.
Frequently Asked Questions
Does the agent model need to be Carbon-X too?
No. Carbon-X is a DNA specialist served on its own endpoint. The planning model can be any agent that supports tool calling or skills. It decides when to call ask_carbon and what to do with the reply.
Should I turn thinking on for harder questions?
The model card recommends keeping thinking disabled. Carbon-X was post-trained and evaluated that way, and it answers directly. Pass enable_thinking: False through chat_template_kwargs on every request.
What hardware do I need?
The weights fit on a single 80 GB GPU in bfloat16, and the model card says it serves with vLLM on one GPU. Exact throughput will depend on your setup.
Why pass sequences by reference instead of in the prompt?
A planning model that has to reproduce a long sequence token by token can introduce errors. Reading it from a file or named variable inside the tool keeps the sequence byte-exact, and the agent only handles labels.
How we source, write, and correct our articles. Editorial standards



