microsoft / microsoft/amplifier

Bug: Agent instructions from .md files are never loaded in spawn pipeline

Open
#174 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.1k
Forks
261
Avg merge
3h 28m
Merged PRs (30d)
13

Description

Summary

Agent definitions in .md files within the agents/ directory are never loaded when spawning sub-sessions via the task tool. The resolve_agent_path() method exists but is never called in the spawn pipeline.

Affected component: amplifier-foundation

Root Cause Analysis

1. Agent Parsing Only Stores Names

In amplifier_foundation/bundle.py, the _parse_agents() function only stores agent names, not their content:

def _parse_agents(agents_config, base_path):
    if "include" in agents_config:
        for name in agents_config["include"]:
            result[name] = {"name": name}  # ← Just the name, NO instruction!
    return result
2. resolve_agent_path() Exists But Is Never Called

The method Bundle.resolve_agent_path() correctly handles both:

  • source_base_paths[namespace] for included bundles
  • Fallback to self.base_path when namespace == self.name

But this method is never called in the spawn pipeline.

3. Spawn Expects Pre-populated Instruction

In the CLI's session_spawner.py, the code expects agent_config to already contain {"system": {"instruction": "..."}}:

system_instruction = agent_config.get("system", {}).get("instruction")
if system_instruction:
    await context.add_message({"role": "system", "content": system_instruction})

But it only has {"name": "bundle:agent-name"}.

Impact

  • Agents spawn without their specialized system prompts
  • Custom agents defined by bundle authors are effectively ignored
  • The agents/ directory structure provides no value beyond documentation

Proposed Fix

In the spawn pipeline, before using agent_config, load agent content from the .md file using the existing resolve_agent_path() method.

Steps to Reproduce

  1. Create a bundle with an agent in agents/my-agent.md
  2. Register the bundle with amplifier bundle register
  3. Try to spawn the agent: Use bundle:my-agent to do X
  4. Observe that the agent's instructions are not loaded

Expected Behavior

Agent instructions from .md files should be loaded and injected as system prompts when spawning.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in amplifier_foundation/bundle.py with _parse_agents() and Bundle.resolve_agent_path(), then trace the spawn path in session_spawner.py where agent_config supplies the system instruction. Reproduce the issue with an agents/my-agent.md file and the task tool. Done means the markdown instructions are loaded and injected as the spawned agent's system prompt.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.