Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
2619591
fix(backend/copilot): skip AI blocks without model property in fix_ai…
goodluck1103 Apr 6, 2026
5bb919e
feat(copilot): add task decomposition for agent building
goodluck1103 Apr 8, 2026
f330699
fix(copilot): improve decompose_goal UX β€” pin box post-stream, suppre…
goodluck1103 Apr 8, 2026
703d343
chore(frontend): update openapi.json snapshot
goodluck1103 Apr 8, 2026
629fb4d
fix(copilot): allow sub-instructions companion text and restore strea…
goodluck1103 Apr 9, 2026
aca81f3
Merge branch 'dev' of https://github.com/Significant-Gravitas/AutoGPT…
goodluck1103 Apr 9, 2026
5fa3311
feat(copilot): add auto-approve timer with editable steps to decompos…
goodluck1103 Apr 9, 2026
b9d47a8
fix(copilot): auto-size editable step textareas on initial render and…
goodluck1103 Apr 9, 2026
5e9cee5
fix(copilot): address PR review comments on decompose_goal tool
goodluck1103 Apr 9, 2026
9004a3a
fix(copilot): guard auto-approve against race condition when isLastMe…
goodluck1103 Apr 9, 2026
70689ce
fix(frontend/copilot): guard isPending flag on error and filter empty…
goodluck1103 Apr 9, 2026
31ce418
fix(backend/copilot): resolve merge conflict with dev branch in model…
goodluck1103 Apr 9, 2026
02b972c
fix(backend/copilot): regenerate openapi.json with TaskDecompositionR…
goodluck1103 Apr 9, 2026
8d5e8a9
fix(backend/copilot): add decompose_goal to ToolName Literal in permi…
goodluck1103 Apr 9, 2026
94f065a
fix(frontend/copilot): remove setInitialPrompt conflict and reset edi…
goodluck1103 Apr 9, 2026
fb86fcb
feat(copilot): add server-side auto-approve fallback for decompose_goal
goodluck1103 Apr 10, 2026
f7601d0
fix(copilot): resume decompose_goal countdown from server timestamp
goodluck1103 Apr 10, 2026
f467ead
fix(copilot): disable decompose_goal Approve/Modify while message is …
goodluck1103 Apr 10, 2026
ed98980
fix(copilot): index-based predicate so manual approve cancels server …
goodluck1103 Apr 10, 2026
fdfd53b
fix(copilot): don't auto-approve decomposition on mount when deadline…
goodluck1103 Apr 10, 2026
2760cb0
Merge remote-tracking branch 'origin/dev' into feat/task-decompositio…
goodluck1103 Apr 10, 2026
98470c2
chore(backend): black-format platform_cost_test.py
goodluck1103 Apr 10, 2026
ca7dc22
chore(frontend): regenerate openapi.json with TaskDecompositionRespon…
goodluck1103 Apr 10, 2026
8f5b9fa
fix(copilot): align server auto-approve timer with client at 60s
goodluck1103 Apr 13, 2026
7b60e45
feat(copilot): cancel server auto-approve when user clicks Modify + u…
goodluck1103 Apr 14, 2026
b2dab8a
fix(copilot): use Redis flag for cross-process auto-approve cancellation
goodluck1103 Apr 14, 2026
5f19f6c
fix(copilot): remove client-side auto-approve to prevent duplicate me…
goodluck1103 Apr 14, 2026
0840b56
fix(copilot): clear stale Redis cancel flag when scheduling new auto-…
goodluck1103 Apr 14, 2026
d892b66
fix(copilot): fall back to default approval when all step description…
goodluck1103 Apr 14, 2026
6d1cd41
fix(copilot): restore client auto-approve with 5s server grace to fix…
goodluck1103 Apr 14, 2026
aa5b84e
style(copilot): reformat auto-approve constants
goodluck1103 Apr 14, 2026
020d094
fix(copilot): prevent duplicate auto-approve via DB-backed predicate …
goodluck1103 Apr 15, 2026
8d102d6
refactor(copilot): remove max 8 steps limit from decompose_goal
goodluck1103 Apr 15, 2026
b0c46ff
Merge remote-tracking branch 'origin/dev' into feat/task-decompositio…
goodluck1103 Apr 15, 2026
bee1c9a
fix(copilot): resolve merge conflict with dev + improve frontend test…
goodluck1103 Apr 15, 2026
ffdafcc
fix(frontend): remove unused DecomposeGoalOutput type import
goodluck1103 Apr 15, 2026
35bca7c
fix(copilot): fix task callback race + skip redundant DB existence check
goodluck1103 Apr 15, 2026
225bdfb
test(frontend): add integration tests for DecomposeGoal, StepItem, an…
Copilot Apr 15, 2026
62d4748
Merge branch 'dev' into feat/task-decomposition-copilot
goodluck1103 Apr 15, 2026
420251c
fix(copilot): clean up stream registry on enqueue failure in auto-app…
goodluck1103 Apr 15, 2026
19cd77f
Merge branch 'feat/task-decomposition-copilot' of https://github.com/…
goodluck1103 Apr 15, 2026
c01c47d
Merge branch 'dev' into feat/task-decomposition-copilot
ntindle Apr 15, 2026
559438f
fix(frontend): run pnpm format on DecomposeGoal test files
Copilot Apr 15, 2026
e4a3c4f
style(copilot): reformat test files
goodluck1103 Apr 15, 2026
e376db6
Merge branch 'feat/task-decomposition-copilot' of https://github.com/…
goodluck1103 Apr 15, 2026
480ec70
fix(frontend): remove unused RenderSegment type import
goodluck1103 Apr 15, 2026
88b39e4
Merge branch 'dev' into feat/task-decomposition-copilot
goodluck1103 Apr 16, 2026
dece04e
Merge remote-tracking branch 'origin/dev' into feat/task-decompositio…
goodluck1103 Apr 16, 2026
db36a76
Merge branch 'feat/task-decomposition-copilot' of https://github.com/…
goodluck1103 Apr 16, 2026
8299948
Merge branch 'dev' into feat/task-decomposition-copilot
goodluck1103 Apr 17, 2026
5542f78
Merge branch 'dev' into feat/task-decomposition-copilot
goodluck1103 Apr 17, 2026
4d5969d
refactor(copilot): simplify cancel-auto-approve route, derive countdo…
majdyz Apr 17, 2026
a31297c
fix(frontend): avoid eager decrement on legacy decompose_goal sessions
majdyz Apr 17, 2026
5b29ff5
fix(backend): invalidate cache on failed write in append_message_if
majdyz Apr 17, 2026
982808c
fix(backend): skip append_message_if when session lock not acquired
majdyz Apr 17, 2026
162c3f0
fix(copilot): enforce decompose_goal approval gate at code level
majdyz Apr 17, 2026
d0cb1e9
fix(copilot): require fresh decompose_goal+approval per build request
majdyz Apr 17, 2026
792c788
Merge branch 'dev' into feat/task-decomposition-copilot
majdyz Apr 17, 2026
731748d
Merge remote-tracking branch 'origin/dev' into feat/task-decompositio…
goodluck1103 Apr 20, 2026
2b24ef5
fix(copilot): resolve merge conflict with dev + fix test failures
goodluck1103 Apr 20, 2026
3523170
Merge remote-tracking branch 'origin/dev' into feat/task-decompositio…
goodluck1103 Apr 21, 2026
1ec30ab
refactor(copilot): use run_copilot_turn_via_queue for auto-approve
goodluck1103 Apr 21, 2026
40d56ed
fix(copilot): skip server auto-approve when turn is already in flight
goodluck1103 Apr 21, 2026
51c16c6
fix(copilot): any user response after decompose_goal unblocks build gate
goodluck1103 Apr 21, 2026
00c992a
Merge branch 'dev' into feat/task-decomposition-copilot
goodluck1103 Apr 21, 2026
089fc06
Merge remote-tracking branch 'origin/dev' into feat/task-decompositio…
goodluck1103 Apr 22, 2026
16a51e5
Merge branch 'feat/task-decomposition-copilot' of https://github.com/…
goodluck1103 Apr 22, 2026
f8df0fa
Merge remote-tracking branch 'origin/dev' into feat/task-decompositio…
goodluck1103 Apr 22, 2026
4fff564
Merge branch 'dev' into feat/task-decomposition-copilot
goodluck1103 Apr 22, 2026
95362f7
fix(copilot): timer only ticks after turn fully finishes
goodluck1103 Apr 22, 2026
26caa86
Merge branch 'feat/task-decomposition-copilot' of https://github.com/…
goodluck1103 Apr 22, 2026
263a414
Merge remote-tracking branch 'origin/dev' into feat/task-decompositio…
goodluck1103 Apr 23, 2026
b9849ce
Merge branch 'dev' into feat/task-decomposition-copilot
goodluck1103 Apr 24, 2026
1549972
fix(copilot): stronger prompt to end turn after decompose_goal
goodluck1103 Apr 24, 2026
eedb64a
Merge branch 'feat/task-decomposition-copilot' of https://github.com/…
goodluck1103 Apr 24, 2026
b1eee6e
fix(copilot): suppress duplicate text when calling decompose_goal
goodluck1103 Apr 24, 2026
8023b66
Merge branch 'dev' into feat/task-decomposition-copilot
goodluck1103 Apr 24, 2026
dbab590
refactor(copilot): make decompose_goal a visibility-only tool
goodluck1103 Apr 29, 2026
b373e37
test(copilot): use complete fixtures for splitReasoningAndResponse tests
goodluck1103 Apr 29, 2026
3b7cbe7
test(copilot): add diagnostic logging to helpers.test.ts
goodluck1103 Apr 29, 2026
234f05f
test(copilot): deeper diagnostic β€” compare findLastIndex vs manual loop
goodluck1103 Apr 29, 2026
6221761
debug(copilot): instrument splitReasoningAndResponse internals
goodluck1103 Apr 29, 2026
59d74fb
fix(copilot): make splitReasoningAndResponse robust to bundler optimi…
goodluck1103 Apr 29, 2026
db20387
Merge branch 'dev' of https://github.com/Significant-Gravitas/AutoGPT…
goodluck1103 Apr 29, 2026
b42d087
Merge branch 'dev' into feat/task-decomposition-copilot
goodluck1103 Apr 30, 2026
24d20a1
Merge branch 'dev' into feat/task-decomposition-copilot
goodluck1103 Apr 30, 2026
b48030d
Merge branch 'dev' of https://github.com/Significant-Gravitas/AutoGPT…
goodluck1103 Apr 30, 2026
40f1bfc
Merge branch 'dev' of https://github.com/Significant-Gravitas/AutoGPT…
goodluck1103 May 1, 2026
3b0f62d
Merge remote-tracking branch 'origin/feat/task-decomposition-copilot'…
goodluck1103 May 1, 2026
3d3c891
Resolve merge conflicts with dev
goodluck1103 May 25, 2026
af04b1d
Merge branch 'dev' into feat/task-decomposition-copilot
goodluck1103 May 25, 2026
1c75319
Resolve merge conflicts with dev
goodluck1103 May 25, 2026
b69530d
fix(frontend/copilot): align isErrorOutput with parseOutput for messa…
goodluck1103 May 25, 2026
1a9bbcf
feat(copilot): make decompose_goal step descriptions plain-English
goodluck1103 May 26, 2026
7d31292
fix(copilot): tighten decompose_goal descriptions to fit schema char …
goodluck1103 May 26, 2026
2d567b2
Resolve merge conflicts with dev
goodluck1103 May 27, 2026
8bae482
refactor(frontend/copilot): restore findLastIndex in splitReasoningAn…
majdyz May 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
NoResultsResponse,
SetupRequirementsResponse,
SuggestedGoalResponse,
TaskDecompositionResponse,
UnderstandingUpdatedResponse,
)
from backend.copilot.tracking import track_user_message
Expand Down Expand Up @@ -1264,6 +1265,7 @@ async def health_check() -> dict:
| DocPageResponse
| MCPToolsDiscoveredResponse
| MCPToolOutputResponse
| TaskDecompositionResponse
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ Steps:
**Skip this** when the goal already specifies all dimensions (e.g.
"scrape prices from Amazon and email me daily").

### Before Building: Goal Decomposition (REQUIRED)

Before running the workflow below, ALWAYS decompose the goal first:
Comment thread
goodluck1103 marked this conversation as resolved.
Outdated

1. Analyze the user's request and break it into logical build steps (e.g.
"add input block", "add AI summarizer", "wire blocks together").
2. Call `decompose_goal` with those steps.
3. **STOP β€” do not proceed until the user approves the plan.**
Comment thread
goodluck1103 marked this conversation as resolved.
Outdated
4. Only after approval, continue with "Workflow for Creating/Editing Agents".

For simple goals (1-2 blocks), keep steps brief (2-3 steps).
For complex goals, decompose into 4-8 steps max.

### Workflow for Creating/Editing Agents

1. **If editing**: First narrow to the specific agent by UUID, then fetch its
Expand Down
2 changes: 2 additions & 0 deletions autogpt_platform/backend/backend/copilot/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .continue_run_block import ContinueRunBlockTool
from .create_agent import CreateAgentTool
from .customize_agent import CustomizeAgentTool
from .decompose_goal import DecomposeGoalTool
from .edit_agent import EditAgentTool
from .feature_requests import CreateFeatureRequestTool, SearchFeatureRequestsTool
from .find_agent import FindAgentTool
Expand Down Expand Up @@ -59,6 +60,7 @@
"ask_question": AskQuestionTool(),
"create_agent": CreateAgentTool(),
"customize_agent": CustomizeAgentTool(),
"decompose_goal": DecomposeGoalTool(),
"edit_agent": EditAgentTool(),
"find_agent": FindAgentTool(),
"find_block": FindBlockTool(),
Expand Down
145 changes: 145 additions & 0 deletions autogpt_platform/backend/backend/copilot/tools/decompose_goal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
"""DecomposeGoalTool - Breaks agent-building goals into sub-instructions."""
Comment thread
goodluck1103 marked this conversation as resolved.

import logging
from typing import Any

from backend.copilot.model import ChatSession

from .base import BaseTool
from .models import (
DecompositionStepModel,
ErrorResponse,
TaskDecompositionResponse,
ToolResponseBase,
)

logger = logging.getLogger(__name__)

# Matches the guide's "4-8 steps max" constraint.
MAX_STEPS = 8
DEFAULT_ACTION = "add_block"
VALID_ACTIONS = {"add_block", "connect_blocks", "configure", "add_input", "add_output"}


class DecomposeGoalTool(BaseTool):
"""Tool for decomposing an agent goal into sub-instructions."""

@property
def name(self) -> str:
return "decompose_goal"

@property
def description(self) -> str:
return (
"Break down an agent-building goal into logical sub-instructions. "
"Each step maps to one task (e.g. add a block, wire connections, "
"configure settings). ALWAYS call this before create_agent to show "
"the user your plan and get approval."
)

@property
def parameters(self) -> dict[str, Any]:
return {
"type": "object",
"properties": {
"goal": {
"type": "string",
"description": "The user's agent-building goal.",
},
"steps": {
"type": "array",
"items": {
"type": "object",
"properties": {
"description": {
"type": "string",
"description": "Human-readable step description.",
},
"action": {
"type": "string",
"description": (
"Action type: 'add_block', 'connect_blocks', "
Comment thread
goodluck1103 marked this conversation as resolved.
"'configure', 'add_input', 'add_output'."
),
"enum": list(VALID_ACTIONS),
},
"block_name": {
"type": "string",
"description": "Block name if adding a block.",
},
},
"required": ["description", "action"],
},
"description": "List of sub-instructions for the plan.",
},
},
"required": ["goal", "steps"],
}

async def _execute(
self,
user_id: str | None,
Comment thread
goodluck1103 marked this conversation as resolved.
session: ChatSession,
goal: str | None = None,
steps: list[Any] | None = None,
**kwargs,
) -> ToolResponseBase:
session_id = session.session_id if session else None

if not goal:
return ErrorResponse(
message="Please provide a goal to decompose.",
error="missing_goal",
session_id=session_id,
)

if not steps:
return ErrorResponse(
message="Please provide at least one step in the plan.",
Comment thread
goodluck1103 marked this conversation as resolved.
error="missing_steps",
Comment thread
goodluck1103 marked this conversation as resolved.
session_id=session_id,
)
Comment thread
goodluck1103 marked this conversation as resolved.

if len(steps) > MAX_STEPS:
return ErrorResponse(
message=f"Too many steps ({len(steps)}). Keep the plan to {MAX_STEPS} steps max.",
Comment thread
goodluck1103 marked this conversation as resolved.
Outdated
error="too_many_steps",
session_id=session_id,
)

decomposition_steps: list[DecompositionStepModel] = []
for i, step in enumerate(steps):
if not isinstance(step, dict):
return ErrorResponse(
message=f"Step {i + 1} is malformed β€” expected an object.",
error="invalid_step",
session_id=session_id,
)
description = step.get("description", "")
if not description or not description.strip():
return ErrorResponse(
Comment thread
goodluck1103 marked this conversation as resolved.
message=f"Step {i + 1} is missing a description.",
error="empty_description",
session_id=session_id,
)
action = step.get("action", DEFAULT_ACTION)
if action not in VALID_ACTIONS:
action = DEFAULT_ACTION
decomposition_steps.append(
DecompositionStepModel(
step_id=f"step_{i + 1}",
description=description,
action=action,
block_name=step.get("block_name"),
status="pending",
)
)

return TaskDecompositionResponse(
message=f"Here's the plan to build your agent ({len(decomposition_steps)} steps):",
goal=goal,
steps=decomposition_steps,
step_count=len(decomposition_steps),
requires_approval=True,
session_id=session_id,
)
Loading
Loading