How to ask another agent from a skill or a script
This guide shows how to make a skill — or any shell script — put a question to another mm agent and use its answer. It assumes the agents are already declared under mmConfigs (see how to ask another agent). For your model to hand work to another agent on its own, the ask_agent tool is the simpler way: no command to copy, and the window shows which agent is working. A skill is for a fixed procedure, a script, or several agents in one command.
Steps
-
In the skill, call the same mm back through the variables mm exports to the commands its
bashtool runs.MM_BINis the runningmm, andMM_CONFIGits configuration, so--askfinds the agent names without a path:"$MM_BIN" --ask jan -p "What is the capital of Peru?"stdout carries the answer and nothing else; the label and the agent's tool calls go to stderr.
-
To send the conversation along, write it on stdin, then a
---line, then the question:"$MM_BIN" --ask-with-context reviewer <<'CONTEXT' User: I think Go's goroutines are OS threads. Assistant: They are not: the Go runtime schedules them onto a few OS threads. --- Is the assistant right? CONTEXTThe model writes this summary itself: a command cannot read the conversation.
-
Tell the model, in the skill, to run the command once and to report the answer as the other agent's. A complete skill (
skills/second-opinion/SKILL.md):--- name: second-opinion description: Get a second opinion from the reviewer agent on a claim or an answer from this conversation. keywords: second opinion, review, check, deuxième avis, vérifie, relis --- # Second opinion Call your `bash` tool ONCE with this command, the conversation summarised in English above the `---` line, the question below it: "$MM_BIN" --ask-with-context reviewer <<'CONTEXT' User: <the claim> Assistant: <your answer, if any> --- Is this right? Correct it if not. CONTEXT What it prints is the reviewer's answer. Report it, starting with "The reviewer says:"; never answer in its place. If it prints `[ask: …]`, tell the user that line.Keep such a command short: a small model copies a long one inexactly (quotes, prefixes).
-
Raise the time limits in the asking agent's configuration. A local model can take a minute to answer, and both limits default to well under that:
bashTimeout: 3m # one bash command (default 30s) watchdogTimeout: 3m # keeps counting while a command runs (ticket 57) -
Run the asking agent from the directory the skills expect and ask in plain words:
> I think Go's goroutines are OS threads. Get a second opinion from Lucy on that claim. 📖 read_skill: second-opinion 🛠️ bash: "$MM_BIN" --ask-with-context reviewer <<'CONTEXT' … │ 🗣 asking reviewer (llmman/hf.co/Menlo/Lucy-gguf:Q4_K_M), with the conversation… │ The assistant's answer is correct. Go goroutines are not OS threads; …
Variants
- From a terminal or a script, outside mm. Name the configuration:
mm -config demos/llmman/agent.llmman.yaml --ask lucy -p "…", or put the question on stdin. Check the exit code: 0 answered, 1 failed (the reason is on stderr), 130 interrupted. - An agent that should only answer. Give it a configuration with
bashTool: false,editTools: false,planTool: falseand no skills —demos/llmman/agent.lucy-reviewer.yamlis one. A small model with every tool tends to wander (read files, load skills) when it is only asked for an opinion. - Capture the answer in a variable.
answer=$("$MM_BIN" --ask jan -p "…")— stdout holds the answer alone.
See also
- Every flag, stream and exit code: command-line reference
bashTimeoutandmmConfigs: configuration reference- Why the agent is a child process, and what
--askadds for scripts: asking another agent — explanation preAskandpostAskhooks run formm --asktoo; with apostAskhook, stdout carries the answer once the hooks have run: control the hand-offs to other agents with hooks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|