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).
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.
demo-llmman/skills/has three complete examples:delegate-to-jan— a question delegated to Jan;second-opinion— the conversation sent to a reviewer;compare-agents— the same question to Jan and Lucy, in one command.
-
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 demo-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 —demo-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
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 |
|