Text Generation
Transformers
Safetensors
English
qwen3
agent
agentic
tool-use
function-calling
orchestration
magentic
conversational
text-generation-inference
Instructions to use microsoft/MagenticBrain with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/MagenticBrain with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="microsoft/MagenticBrain") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("microsoft/MagenticBrain") model = AutoModelForCausalLM.from_pretrained("microsoft/MagenticBrain", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use microsoft/MagenticBrain with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "microsoft/MagenticBrain" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/MagenticBrain", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/microsoft/MagenticBrain
- SGLang
How to use microsoft/MagenticBrain with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "microsoft/MagenticBrain" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/MagenticBrain", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "microsoft/MagenticBrain" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/MagenticBrain", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use microsoft/MagenticBrain with Docker Model Runner:
docker model run hf.co/microsoft/MagenticBrain
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,216 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
base_model:
|
| 8 |
+
- Qwen/Qwen3-14B
|
| 9 |
+
tags:
|
| 10 |
+
- agent
|
| 11 |
+
- agentic
|
| 12 |
+
- tool-use
|
| 13 |
+
- function-calling
|
| 14 |
+
- orchestration
|
| 15 |
+
- magentic
|
| 16 |
---
|
| 17 |
+
|
| 18 |
+
# MagenticBrain
|
| 19 |
+
|
| 20 |
+
MagenticBrain is a 14B-parameter orchestration model from **Microsoft Research AI Frontiers**. It plans multi-step tasks, calls declared tools, and coordinates sub-agents. It does not execute actions itself — every real-world side effect happens inside a host harness.
|
| 21 |
+
|
| 22 |
+
The model is supervised fine-tuned from [Qwen/Qwen3-14B](https://huggingface.co/Qwen/Qwen3-14B) on agentic data: function-calling corpora, file-system trajectories, terminal tasks, sub-agent delegation traces, and reasoning data. It's co-designed with **MagenticLite**, our agentic application and harness, and that's the configuration it has been most thoroughly evaluated in.
|
| 23 |
+
|
| 24 |
+
We're releasing weights only. Inference code, training recipes, and the execution harness are part of MagenticLite.
|
| 25 |
+
|
| 26 |
+
## Highlights
|
| 27 |
+
|
| 28 |
+
- **Orchestration-first post-training.** Specialized for planning, tool selection, multi-turn tool chaining, and sub-agent delegation. Not a general-purpose chat model.
|
| 29 |
+
- **Structured tool calls in JSON.** Tool schemas are passed in at inference time. The model selects only from declared tools and never invents new ones.
|
| 30 |
+
- **Sub-agent delegation built in.** Trained with explicit handoff traces to **Fara1.5-9B**, our computer-use sub-agent (browser and desktop control).
|
| 31 |
+
- **Submit-to-terminate protocol.** Every task ends with a dedicated `submit` signal, which is a protocol token, not an action. The harness uses it as the end-of-task indicator.
|
| 32 |
+
- **32K context.** Enough headroom for system prompt + tool schemas + multi-turn trajectory state.
|
| 33 |
+
- **Built on Qwen3-14B.** Inherits the base model's reasoning and instruction-following.
|
| 34 |
+
|
| 35 |
+
## Model Details
|
| 36 |
+
|
| 37 |
+
| | |
|
| 38 |
+
|---|---|
|
| 39 |
+
| **Developer** | Microsoft Research AI Frontiers |
|
| 40 |
+
| **Architecture** | Decoder-only transformer (Qwen3 architecture) |
|
| 41 |
+
| **Parameters** | ~14B |
|
| 42 |
+
| **Context length** | 32,768 tokens |
|
| 43 |
+
| **Inputs** | Text (system prompt, tool schema, user goal, trajectory state) |
|
| 44 |
+
| **Outputs** | Text and structured JSON tool calls |
|
| 45 |
+
| **Training period** | January 2026 – April 2026 |
|
| 46 |
+
| **Release date** | 14 May 2026 |
|
| 47 |
+
| **License** | MIT |
|
| 48 |
+
| **Base model** | [Qwen/Qwen3-14B](https://huggingface.co/Qwen/Qwen3-14B) |
|
| 49 |
+
|
| 50 |
+
## Recommended Deployment: MagenticLite
|
| 51 |
+
|
| 52 |
+
MagenticBrain is the orchestration model inside **MagenticLite**. The training mix, tool-call format, and submit/terminate protocol are calibrated against MagenticLite's execution loop. If you want the behavior MagenticBrain was trained for, run it inside MagenticLite.
|
| 53 |
+
|
| 54 |
+
The weights load in any compatible runtime (Transformers, vLLM, SGLang, TensorRT-LLM). If you integrate the model directly, you're responsible for the execution boundary: declaring the tool schema, parsing the model's JSON tool calls, executing tools under your own permissions, and handling the `submit` terminator.
|
| 55 |
+
|
| 56 |
+
## Quickstart
|
| 57 |
+
|
| 58 |
+
### Transformers
|
| 59 |
+
|
| 60 |
+
Requires `transformers >= 4.51.0`.
|
| 61 |
+
|
| 62 |
+
```python
|
| 63 |
+
import json
|
| 64 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 65 |
+
|
| 66 |
+
model_name = "microsoft/MagenticBrain"
|
| 67 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 68 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 69 |
+
model_name,
|
| 70 |
+
torch_dtype="auto",
|
| 71 |
+
device_map="auto",
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
tools = [
|
| 75 |
+
{
|
| 76 |
+
"type": "function",
|
| 77 |
+
"function": {
|
| 78 |
+
"name": "read_file",
|
| 79 |
+
"description": "Read the contents of a file at the given path.",
|
| 80 |
+
"parameters": {
|
| 81 |
+
"type": "object",
|
| 82 |
+
"properties": {"path": {"type": "string"}},
|
| 83 |
+
"required": ["path"],
|
| 84 |
+
},
|
| 85 |
+
},
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
"type": "function",
|
| 89 |
+
"function": {
|
| 90 |
+
"name": "submit",
|
| 91 |
+
"description": "Signal that the task is complete.",
|
| 92 |
+
"parameters": {"type": "object", "properties": {}},
|
| 93 |
+
},
|
| 94 |
+
},
|
| 95 |
+
]
|
| 96 |
+
|
| 97 |
+
messages = [
|
| 98 |
+
{"role": "system", "content": "You are an orchestration agent. Plan steps and call only the tools declared below."},
|
| 99 |
+
{"role": "user", "content": "Summarize the contents of /tmp/report.md."},
|
| 100 |
+
]
|
| 101 |
+
|
| 102 |
+
text = tokenizer.apply_chat_template(
|
| 103 |
+
messages,
|
| 104 |
+
tools=tools,
|
| 105 |
+
tokenize=False,
|
| 106 |
+
add_generation_prompt=True,
|
| 107 |
+
enable_thinking=False, # thinking is disabled by default for MagenticBrain
|
| 108 |
+
)
|
| 109 |
+
|
| 110 |
+
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 111 |
+
output_ids = model.generate(**inputs, max_new_tokens=1024)[0][inputs.input_ids.shape[1]:]
|
| 112 |
+
print(tokenizer.decode(output_ids, skip_special_tokens=True))
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
The model emits tool calls as JSON objects. Parse them, execute the tool in your host, feed the result back as a `tool` role message, and call `generate` again. Loop until the model emits `submit`.
|
| 116 |
+
|
| 117 |
+
### vLLM
|
| 118 |
+
|
| 119 |
+
Serve with an OpenAI-compatible endpoint that exposes tool-calling:
|
| 120 |
+
|
| 121 |
+
```bash
|
| 122 |
+
vllm serve microsoft/MagenticBrain \
|
| 123 |
+
--enable-auto-tool-choice \
|
| 124 |
+
--tool-call-parser hermes \
|
| 125 |
+
--max-model-len 32768
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
Then call `/v1/chat/completions` with `tools=[...]` as you would with any OpenAI-compatible tool-use model. Pass `chat_template_kwargs={"enable_thinking": false}` to match training-time defaults.
|
| 129 |
+
|
| 130 |
+
### Recommended sampling
|
| 131 |
+
|
| 132 |
+
```
|
| 133 |
+
temperature = 0.6
|
| 134 |
+
top_p = 0.8
|
| 135 |
+
top_k = 20
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
These match the Qwen3-14B base recommendations and work well for orchestration. Lower the temperature for stricter tool selection.
|
| 139 |
+
|
| 140 |
+
## Training
|
| 141 |
+
|
| 142 |
+
### Approach
|
| 143 |
+
|
| 144 |
+
Post-training is Supervised Fine-Tuning on a heterogeneous agentic data mix. Reinforcement learning is in active exploration but not part of this release. Thinking tokens are disabled by default (`enable_thinking=False`) to control verbosity and reduce looping on long trajectories.
|
| 145 |
+
|
| 146 |
+
### Data sources
|
| 147 |
+
|
| 148 |
+
- **Function-calling and orchestration:** APIGen-MT, ToolACE, xLAM
|
| 149 |
+
- **MCP environments:** 250+ synthetic Model Context Protocol environments with single- and multi-turn trajectories, generated for tool-orchestration training
|
| 150 |
+
- **File-system / Cowork:** file rename, organize, delete, and categorize trajectories
|
| 151 |
+
- **Terminal / CLI:** containerized tasks paired with executable tests
|
| 152 |
+
- **Sub-agent delegation:** explicit handoff traces (MagenticBrain → Fara1.5-9B for computer use)
|
| 153 |
+
- **Reasoning and planning:** Kimi-2.5-generated traces (preferred for lower verbosity), with filtered subsets of Dolci, Hermes, and Nemotron data
|
| 154 |
+
|
| 155 |
+
Total post-training corpus is under 1B tokens. Base-model pretraining is documented in the [Qwen3 technical report](https://arxiv.org/abs/2505.09388).
|
| 156 |
+
|
| 157 |
+
### Data processing
|
| 158 |
+
|
| 159 |
+
The corpus was filtered and normalized before training. Samples ending on non-`submit` tool calls were removed to prevent infinite-loop trajectories. Samples exceeding the 32K context were dropped. JSON tool-call formats were normalized through shared filters. Thinking blocks were stripped or regenerated to control output length.
|
| 160 |
+
|
| 161 |
+
### Latest data date
|
| 162 |
+
|
| 163 |
+
April 30, 2026. The corpus is not collected on an ongoing basis. Future updates will ship as separately versioned models with their own model cards.
|
| 164 |
+
|
| 165 |
+
## Intended Use and Limitations
|
| 166 |
+
|
| 167 |
+
### Primary use cases
|
| 168 |
+
|
| 169 |
+
- **Tool orchestration and workflow planning.** Decompose goals into steps, select tools from an explicit schema, populate structured arguments, chain outputs across multiple turns.
|
| 170 |
+
- **Agentic task coordination inside a host.** File operations, terminal and code execution, and system actions through host-owned tools, plus delegation to sub-agents.
|
| 171 |
+
- **Research and product experimentation with agentic systems.** Benchmarking agentic reasoning, studying delegation patterns, serving as the orchestrator in multi-agent stacks.
|
| 172 |
+
|
| 173 |
+
### Out of scope
|
| 174 |
+
|
| 175 |
+
- Fully autonomous agents that take unbounded actions or set their own goals
|
| 176 |
+
- Open-ended consumer chat with broad, unsandboxed tool permissions
|
| 177 |
+
- Systems that depend on emergent tool invention or self-modification
|
| 178 |
+
- Authoritative decisions on business outcomes, product logic, or user-facing policies — these remain the responsibility of host systems and humans
|
| 179 |
+
|
| 180 |
+
Use outside the declared tool schema, without a host-controlled execution boundary, or in deployments that bypass human-in-the-loop confirmation for sensitive actions is unsupported and outside the conditions the model was evaluated under.
|
| 181 |
+
|
| 182 |
+
## Responsible AI Considerations
|
| 183 |
+
|
| 184 |
+
MagenticBrain is a constrained orchestration model with delegated execution. Known risk areas include:
|
| 185 |
+
|
| 186 |
+
- **Unauthorized or harmful tool actions** if executed without checks
|
| 187 |
+
- **Over-autonomy and loss of human oversight** if agentic behavior is misinterpreted as self-directed decision-making
|
| 188 |
+
- **Hallucinated plans or policy-violating suggestions**
|
| 189 |
+
- **Data provenance, privacy, and IP risk** carried over from base-model pretraining
|
| 190 |
+
|
| 191 |
+
### Mitigations
|
| 192 |
+
|
| 193 |
+
The model has no execution authority on its own. All actions go through host-owned tools, and the tool surface is explicitly scoped — the model cannot call undeclared tools. Inside MagenticLite, additional safety layers apply: tool-output verification, scoped permissions for state-changing actions, and human-in-the-loop confirmation on sensitive operations.
|
| 194 |
+
|
| 195 |
+
If you're integrating MagenticBrain outside MagenticLite, we recommend:
|
| 196 |
+
|
| 197 |
+
- Declare the minimum tool surface required (least privilege)
|
| 198 |
+
- Surface the model's plan and tool calls in your UI for transparency
|
| 199 |
+
- Gate critical or irreversible tool calls behind explicit human confirmation
|
| 200 |
+
- Treat the model's plan as a recommendation, not an authoritative decision
|
| 201 |
+
|
| 202 |
+
MagenticBrain does not claim full autonomy, self-learning, independent policy-setting, or direct execution of real-world actions. Deployments that rely on any of these properties are unsupported.
|
| 203 |
+
|
| 204 |
+
### Safety evaluation
|
| 205 |
+
|
| 206 |
+
Safety evaluation covered harmful content (sexual, violent, hateful, self-harm), copyright and IP content, jailbreaks and UPIA-style prompt injection, ungrounded content, and task adherence. MagenticBrain's safety behavior is comparable to or better than the Qwen3-14B base model on these categories.
|
| 207 |
+
|
| 208 |
+
## License
|
| 209 |
+
|
| 210 |
+
Released under the **MIT License**. Model weights only — inference code, execution harness, training recipes, and hyperparameters are not part of this release.
|
| 211 |
+
|
| 212 |
+
## Contact
|
| 213 |
+
|
| 214 |
+
For information requests under the EU AI Act and related inquiries: **MSFTAIActRequest@microsoft.com**
|
| 215 |
+
|
| 216 |
+
Authorized representative: Microsoft Ireland Operations Limited, 70 Sir John Rogerson's Quay, Dublin 2, D02 R296, Ireland.
|