# ALZ-F01 Discovery: sub-agent pattern The ALZ-F01 Discovery Feature (ADO 3214441) as **one orchestrator agent whose eight sub-agents are the Feature's stories**. It runs in four phases (plan, collect, analyse, critique). The orchestrator keeps a hash-chained run workspace, and the critic's verdict is enforced in code. **This is one of two patterns for CP1 Discovery, and which one is adopted hasn't been decided.** The other is [individual agents](../../individual-agents/ALZ-F01:%20Discovery%20Workflow%20Agent/): eight separate agents chained by the workflow. | Agent | What it does | |---|---| | [`cp1-alz-discovery-orchestrator-agent`](cp1-alz-discovery-orchestrator-agent/) | Every phase of discovery. It makes all the MCP calls itself and delegates to sub-agents `dsc_01_planner` … `dsc_08_critic`. | These agents carry `app/` for their sub-agents, functions and hooks, and the shared check allows it (ADR 0008). Each decision is an ADR in the agent's [`docs/adr/`](cp1-alz-discovery-orchestrator-agent/docs/adr/README.md). ## Layout | Path | What it is | |---|---| | `cp1-alz-discovery-orchestrator-agent/` | The agent. `README.md` and `docs/` are for people; `CLAUDE.md` and `.agents/` are for coding agents. | | `workflows/` | This Feature's KAB workflow export: four phase steps, plus an upload step at the front | | `scripts/` | `build_workflow.py` (writes `workflows/`) and `dry_run.py` (tests the agent's code with no model and no MCP server) | These are shared with the other pattern and live at the repository root: - the MCP server `alz-discovery-sample` ([`../../mcp-servers/`](../../mcp-servers/)); - the check, render and import scripts ([`../../scripts/`](../../scripts/)); - the deploy profile and the [deployment guide](../../docs/deployment.md). ## Files and artifacts in a run The workflow can start with two KAB activity steps (ADR 0012): - **Parse Assessment Files:** the run form's upload field. - **Artifacts:** project artifacts fixed by id. Only the plan step takes them. It imports them into the run workspace, and the sub-agents get records only. To build the workflow and apply it to KAB, run from the repository root: ```sh python3 scripts/kab_import_workflow.py "sub-agents/ALZ-F01: Discovery Workflow Agent" --project-id # validate only python3 scripts/kab_import_workflow.py "sub-agents/ALZ-F01: Discovery Workflow Agent" --project-id --apply # import as a draft ``` The script reads your KAB access token from `~/.kab_token`. Importing needs the Editor role. ## Check it From this folder: ```sh python3 ../../scripts/check_agents.py --runtime-image cruciblecoredevacr.azurecr.io/kab/agent-runtime-adk:0.35.7 cp1-alz-discovery-orchestrator-agent python3 scripts/dry_run.py cp1-alz-discovery-orchestrator-agent "$(mktemp -d)" ``` Running the agent locally is described in [its README](cp1-alz-discovery-orchestrator-agent/README.md#run-it-locally). Deploying it is in [docs/deployment.md](../../docs/deployment.md).