bots-garden/mini-mepublic Fork
⑂ feature/unload-model
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/mini-me.git
git clone ssh://git@rickub.com/bots-garden/mini-me.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
🛟 Updated. 5b2f986 · on feature/unload-model · k33g · 7d ago
ask-another-agent-from-a-skill.md · 81 lines · 4.3 KBmarkdown
Blame HistoryOpen raw

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

  1. In the skill, call the same mm back through the variables mm exports to the commands its bash tool runs. MM_BIN is the running mm, and MM_CONFIG its configuration, so --ask finds 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.

  2. 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?
    CONTEXT
    

    The model writes this summary itself: a command cannot read the conversation.

  3. 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).

  4. 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)
    
  5. 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: false and no skills — demos/llmman/agent.lucy-reviewer.yaml is 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

 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
# 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](ask-another-agent.md)). For your model to hand work to another agent on its own, the [`ask_agent` tool](let-the-agent-call-other-agents.md) 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

1. In the skill, call the same mm back through the variables mm exports to the commands its `bash` tool runs. `MM_BIN` is the running `mm`, and `MM_CONFIG` its configuration, so `--ask` finds the agent names without a path:

   ```bash
   "$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.

2. To send the conversation along, write it on stdin, then a `---` line, then the question:

   ```bash
   "$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?
   CONTEXT
   ```

   The model writes this summary itself: a command cannot read the conversation.

3. 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`):

   ```markdown
   ---
   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).

4. 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:

   ```yaml
   bashTimeout: 3m       # one bash command (default 30s)
   watchdogTimeout: 3m   # keeps counting while a command runs (ticket 57)
   ```

5. Run the asking agent from the directory the skills expect and ask in plain words:

   ```text
   > 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: false` and no skills — `demos/llmman/agent.lucy-reviewer.yaml` is 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](../reference/cli.md#ask-mode-specifics)
- `bashTimeout` and `mmConfigs`: [configuration reference](../reference/configuration.md)
- Why the agent is a child process, and what `--ask` adds for scripts: [asking another agent — explanation](../explanation/asking-another-agent.md)
- `preAsk` and `postAsk` hooks run for `mm --ask` too; with a `postAsk` hook, stdout carries the answer once the hooks have run: [control the hand-offs to other agents with hooks](control-agent-calls-with-hooks.md)