Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

dx(backend/copilot): clarify ambiguous agent goals using find_block before generation (#12601)

An Vy Le725da7e887d8
diff --git a/autogpt_platform/backend/backend/copilot/prompting_test.py b/autogpt_platform/backend/backend/copilot/prompting_test.py
new file mode 100644
index 0000000000..6a1e62456f
--- /dev/null
+++ b/autogpt_platform/backend/backend/copilot/prompting_test.py
@@ -0,0 +1,21 @@
+"""Tests for agent generation guide — verifies clarification section."""
+
+from pathlib import Path
+
+
+class TestAgentGenerationGuideContainsClarifySection:
+ """The agent generation guide must include the clarification section."""
+
+ def test_guide_includes_clarify_before_building(self):
+ guide_path = Path(__file__).parent / "sdk" / "agent_generation_guide.md"
+ content = guide_path.read_text(encoding="utf-8")
+ assert "Clarifying Before Building" in content
+
+ def test_guide_mentions_find_block_for_clarification(self):
+ guide_path = Path(__file__).parent / "sdk" / "agent_generation_guide.md"
+ content = guide_path.read_text(encoding="utf-8")
+ # find_block must appear in the clarification section (before the workflow)
+ clarify_section = content.split("Clarifying Before Building")[1].split(
+ "### Workflow"
+ )[0]
+ assert "find_block" in clarify_section
diff --git a/autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md b/autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
index 5014cc06c2..3c319b6742 100644
--- a/autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
+++ b/autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
@@ -3,6 +3,21 @@
You can create, edit, and customize agents directly. You ARE the brain —
generate the agent JSON yourself using block schemas, then validate and save.
+### Clarifying Before Building
+
+Before starting the workflow below, check whether the user's goal is
+**ambiguous** — missing the output format, delivery channel, data source,
+or trigger. If so:
+1. Call `find_block` with a query targeting the ambiguous dimension to
+ discover what the platform actually supports.
+2. Ask the user **one concrete question** grounded in the discovered
+ options (e.g. "The platform supports Gmail, Slack, and Google Docs —
+ which should the agent use for delivery?").
+3. **Wait for the user's answer** before proceeding.
+
+**Skip this** when the goal already specifies all dimensions (e.g.
+"scrape prices from Amazon and email me daily").
+
### Workflow for Creating/Editing Agents
1. **Discover blocks**: Call `find_block(query, include_schemas=true)` to