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.

feat(platform): replace the expert kickoff auto-run with an onboarding card (#14497)

Ubbe4dd24edb3abe
diff --git a/autogpt_platform/backend/backend/api/features/chat/routes.py b/autogpt_platform/backend/backend/api/features/chat/routes.py
index 77f2f9c116..65554b0fb0 100644
--- a/autogpt_platform/backend/backend/api/features/chat/routes.py
+++ b/autogpt_platform/backend/backend/api/features/chat/routes.py
@@ -117,6 +117,7 @@ from backend.copilot.tools.models import (
DocSearchResultsResponse,
ErrorResponse,
ExecutionStartedResponse,
+ ExpertOnboardingResponse,
ExpertSoulUpdatedResponse,
InputValidationErrorResponse,
MCPToolOutputResponse,
@@ -2313,6 +2314,7 @@ ToolResponseUnion = (
| MemoryForgetConfirmResponse
| TodoWriteResponse
| ExpertSoulUpdatedResponse
+ | ExpertOnboardingResponse
)
diff --git a/autogpt_platform/backend/backend/copilot/baseline/service.py b/autogpt_platform/backend/backend/copilot/baseline/service.py
index 6f370f9e40..e53b3f02a8 100644
--- a/autogpt_platform/backend/backend/copilot/baseline/service.py
+++ b/autogpt_platform/backend/backend/copilot/baseline/service.py
@@ -46,6 +46,7 @@ from backend.copilot.builder_context import (
from backend.copilot.config import CopilotLlmAuthProvider, CopilotLLMModel
from backend.copilot.context import get_workspace_manager, set_execution_context
from backend.copilot.expert_context import build_expert_identity_suffix
+from backend.copilot.expert_kickoff import is_expert_kickoff_turn
from backend.copilot.graphiti.config import is_enabled_for_user
from backend.copilot.graphiti.context import fetch_warm_context
from backend.copilot.graphiti.ingest import enqueue_conversation_turn
@@ -125,6 +126,7 @@ from backend.copilot.tools import (
execute_tool,
expert_tool_disabled_groups,
get_available_tools,
+ kickoff_turn_disabled_tools,
)
from backend.copilot.tools.session_context import build_session_context
from backend.copilot.tools.skills import build_skills_context
@@ -1059,14 +1061,15 @@ async def _baseline_tool_executor(
user_id: str | None,
session: ChatSession,
disabled_groups: Sequence[ToolGroup],
+ disabled_tools: frozenset[str],
) -> ToolCallResult:
"""Execute a tool via the copilot tool registry.
Extracted from ``stream_chat_completion_baseline`` for readability.
- ``disabled_groups`` is the same list used to build the turn's schema
- list; passing it here makes the capability gate an enforcement boundary
- rather than a presentation filter.
+ ``disabled_groups`` and ``disabled_tools`` are the same values used to
+ build the turn's schema list; passing them here makes the capability and
+ kickoff gates an enforcement boundary rather than a presentation filter.
"""
tool_call_id = tool_call.id
tool_name = tool_call.name
@@ -1140,6 +1143,7 @@ async def _baseline_tool_executor(
session=session,
tool_call_id=tool_call_id,
disabled_groups=disabled_groups,
+ disabled_tools=disabled_tools,
)
_emit(state, result)
tool_output = (
@@ -2165,7 +2169,16 @@ async def stream_chat_completion_baseline(
experts_enabled=experts_enabled, expert_id=session.expert_id
)
)
- tools = get_available_tools(disabled_groups=disabled_tool_groups)
+ # A hire's kickoff turn is a server-sent control message, so nothing on
+ # it was asked for: narrow it to the onboarding card and nothing else.
+ disabled_tools = (
+ kickoff_turn_disabled_tools()
+ if is_expert_kickoff_turn(session)
+ else frozenset()
+ )
+ tools = get_available_tools(
+ disabled_groups=disabled_tool_groups, disabled_tools=disabled_tools
+ )
# --- Permission filtering ---
if permissions is not None:
@@ -2235,6 +2248,7 @@ async def stream_chat_completion_baseline(
user_id=user_id,
session=_session_holder[0],
disabled_groups=disabled_tool_groups,
+ disabled_tools=disabled_tools,
)
_bound_conversation_updater = partial(
diff --git a/autogpt_platform/backend/backend/copilot/baseline/service_unit_test.py b/autogpt_platform/backend/backend/copilot/baseline/service_unit_test.py
index f37779ab1c..eaac3e8348 100644
--- a/autogpt_platform/backend/backend/copilot/baseline/service_unit_test.py
+++ b/autogpt_platform/backend/backend/copilot/baseline/service_unit_test.py
@@ -3075,12 +3075,12 @@ class TestBaselineExpertsFlagGuard:
class TestBaselineToolExecutorForwardsDisabledGroups:
- """``_baseline_tool_executor`` must forward its ``disabled_groups`` to
+ """``_baseline_tool_executor`` must forward both of its gates to
``execute_tool`` — that's the only thing making the schema-hiding filter
an actual enforcement boundary for the baseline engine."""
- @pytest.mark.asyncio
- async def test_disabled_groups_reach_execute_tool(self) -> None:
+ @staticmethod
+ async def _forwarded_kwargs(**gates: object) -> dict:
session = ChatSession.new("user-1", dry_run=False)
state = _BaselineStreamState()
tool_call = LLMToolCall(id="call-1", name="hire_expert", arguments="{}")
@@ -3102,7 +3102,24 @@ class TestBaselineToolExecutorForwardsDisabledGroups:
state=state,
user_id="user-1",
session=session,
- disabled_groups=["expert_admin"],
+ **gates, # pyright: ignore[reportArgumentType]
)
- assert execute_mock.await_args.kwargs["disabled_groups"] == ["expert_admin"]
+ return execute_mock.await_args.kwargs
+
+ @pytest.mark.asyncio
+ async def test_disabled_groups_reach_execute_tool(self) -> None:
+ kwargs = await self._forwarded_kwargs(
+ disabled_groups=["expert_admin"], disabled_tools=frozenset()
+ )
+
+ assert kwargs["disabled_groups"] == ["expert_admin"]
+
+ @pytest.mark.asyncio
+ async def test_disabled_tools_reach_execute_tool(self) -> None:
+ """The kickoff gate travels the same path as the capability gate."""
+ kwargs = await self._forwarded_kwargs(
+ disabled_groups=[], disabled_tools=frozenset({"run_agent"})
+ )
+
+ assert kwargs["disabled_tools"] == frozenset({"run_agent"})
diff --git a/autogpt_platform/backend/backend/copilot/baseline/tool_display_test.py b/autogpt_platform/backend/backend/copilot/baseline/tool_display_test.py
index eb7fb5bb07..d5a64c4b4b 100644
--- a/autogpt_platform/backend/backend/copilot/baseline/tool_display_test.py
+++ b/autogpt_platform/backend/backend/copilot/baseline/tool_display_test.py
@@ -51,7 +51,13 @@ async def test_tool_display_streams_and_persists_before_tool_result(fails: bool)
new=AsyncMock(side_effect=execute),
):
result = await _baseline_tool_executor(
- call, [], state=state, user_id="user-1", session=session, disabled_groups=[]
+ call,
+ [],
+ state=state,
+ user_id="user-1",
+ session=session,
+ disabled_groups=[],
+ disabled_tools=frozenset(),
)
messages: list[dict] = []
_baseline_conversation_updater(
diff --git a/autogpt_platform/backend/backend/copilot/expert_context.py b/autogpt_platform/backend/backend/copilot/expert_context.py
index d4fde53e6e..6ee85f1201 100644
--- a/autogpt_platform/backend/backend/copilot/expert_context.py
+++ b/autogpt_platform/backend/backend/copilot/expert_context.py
@@ -112,6 +112,13 @@ def render_expert_identity_suffix(expert: Expert) -> str:
f"<voice_preferences>\n{voice}\n</voice_preferences>\n"
f"<boundaries>\n{boundaries}\n</boundaries>\n"
f"<protected_rules>\n{protected_rules}\n</protected_rules>\n"
+ f"<first_turn>\n"
+ f"Your first turn after being hired arrives as a hidden instruction "
+ f"that names `expert_onboarding`. On that turn call "
+ f"`expert_onboarding` exactly once and nothing else. Do not use "
+ f"`ask_question` for it; that tool is for later turns. Once the "
+ f"card's answers come back, continue as normal.\n"
+ f"</first_turn>\n"
f"The base instructions above describe Otto, the platform "
f"engine you run on. All platform capabilities and tools remain "
f"available to you, but you always speak and act as {name}: "
diff --git a/autogpt_platform/backend/backend/copilot/expert_context_test.py b/autogpt_platform/backend/backend/copilot/expert_context_test.py
index 6c067de773..980046cbb1 100644
--- a/autogpt_platform/backend/backend/copilot/expert_context_test.py
+++ b/autogpt_platform/backend/backend/copilot/expert_context_test.py
@@ -158,6 +158,8 @@ class TestBuildExpertIdentitySuffix:
assert "SEO Specialist" in result
assert "You are Maria, a meticulous SEO specialist." in result
assert "never present yourself as Otto" in result
+ assert "call `expert_onboarding` exactly once" in result
+ assert "Do not use `ask_question` for it" in result
@pytest.mark.asyncio
async def test_plain_session_returns_empty(self):
diff --git a/autogpt_platform/backend/backend/copilot/expert_kickoff.py b/autogpt_platform/backend/backend/copilot/expert_kickoff.py
index 31fe3c7333..5666f22f87 100644
--- a/autogpt_platform/backend/backend/copilot/expert_kickoff.py
+++ b/autogpt_platform/backend/backend/copilot/expert_kickoff.py
@@ -2,7 +2,10 @@
import uuid
from collections.abc import Mapping
-from typing import Any
+from typing import TYPE_CHECKING, Any
+
+if TYPE_CHECKING:
+ from backend.copilot.model import ChatSession
EXPERT_KICKOFF_KIND = "expert_kickoff"
@@ -54,3 +57,20 @@ def expert_kickoff_metadata(expert_id: str) -> dict[str, Any]:
def is_hidden_chat_message(metadata: Mapping[str, Any] | None) -> bool:
"""Whether message metadata marks a row as hidden from user surfaces."""
return metadata is not None and metadata.get("hidden") is True
+
+
+def is_expert_kickoff_turn(session: "ChatSession") -> bool:
+ """Whether the turn being served answers the hire's kickoff message.
+
+ ``expert_kickoff_metadata`` is the only writer of this ``kind`` and the
+ chat route never copies request fields into message metadata, so a true
+ here means the server wrote the last user message itself. Nobody has
+ asked for anything yet, which is what makes it safe for callers to
+ narrow the turn down to the onboarding card.
+ """
+ for message in reversed(session.messages):
+ if message.role != "user":
+ continue
+ metadata = message.metadata
+ return metadata is not None and metadata.get("kind") == EXPERT_KICKOFF_KIND
+ return False
diff --git a/autogpt_platform/backend/backend/copilot/expert_kickoff_test.py b/autogpt_platform/backend/backend/copilot/expert_kickoff_test.py
index 9aa1872ceb..ba9fb08814 100644
--- a/autogpt_platform/backend/backend/copilot/expert_kickoff_test.py
+++ b/autogpt_platform/backend/backend/copilot/expert_kickoff_test.py
@@ -1,9 +1,27 @@
from backend.copilot.expert_kickoff import (
expert_kickoff_message_id,
expert_kickoff_metadata,
+ is_expert_kickoff_turn,
is_hidden_chat_message,
scoped_client_message_id,
)
+from backend.copilot.model import ChatMessage, ChatSession
+
+EXPERT_ID = "1a5b1a10-6d10-4d7c-9d0d-2f6f1d9c0f11"
+
+
+def _expert_session(*messages: ChatMessage) -> ChatSession:
+ session = ChatSession.new(user_id="alice", dry_run=False, expert_id=EXPERT_ID)
+ session.messages.extend(messages)
+ return session
+
+
+def _kickoff_message() -> ChatMessage:
+ return ChatMessage(
+ role="user",
+ content="You were just hired.",
+ metadata=expert_kickoff_metadata(EXPERT_ID),
+ )
def test_message_id_is_stable_and_scoped_to_owner_and_expert() -> None:
@@ -47,3 +65,38 @@ def test_metadata_marks_kickoff_hidden_without_hiding_other_messages() -> None:
assert is_hidden_chat_message(metadata)
assert not is_hidden_chat_message(None)
assert not is_hidden_chat_message({"hidden": False})
+
+
+def test_kickoff_turn_is_the_one_answering_the_server_written_message() -> None:
+ assert is_expert_kickoff_turn(_expert_session(_kickoff_message()))
+
+
+def test_a_session_with_no_messages_is_not_a_kickoff_turn() -> None:
+ assert not is_expert_kickoff_turn(_expert_session())
+
+
+def test_a_user_typed_first_message_is_not_a_kickoff_turn() -> None:
+ session = _expert_session(ChatMessage(role="user", content="hi"))
+
+ assert not is_expert_kickoff_turn(session)
+
+
+def test_the_gate_lifts_once_the_user_answers_the_card() -> None:
+ session = _expert_session(
+ _kickoff_message(),
+ ChatMessage(role="assistant", content="Here are a few questions."),
+ ChatMessage(role="user", content="Weekly digest, connect Linear."),
+ )
+
+ assert not is_expert_kickoff_turn(session)
+
+
+def test_assistant_and_tool_rows_after_the_kickoff_do_not_lift_the_gate() -> None:
+ """The kickoff turn's own tool round must stay gated to the end."""
+ session = _expert_session(
+ _kickoff_message(),
+ ChatMessage(role="assistant", content="", tool_calls=[{"id": "call-1"}]),
+ ChatMessage(role="tool", content="{}", tool_call_id="call-1"),
+ )
+
+ assert is_expert_kickoff_turn(session)
diff --git a/autogpt_platform/backend/backend/copilot/permissions.py b/autogpt_platform/backend/backend/copilot/permissions.py
index 92fab31429..7c79ce3161 100644
--- a/autogpt_platform/backend/backend/copilot/permissions.py
+++ b/autogpt_platform/backend/backend/copilot/permissions.py
@@ -93,6 +93,7 @@ ToolName = Literal[
"delete_workspace_file",
"edit_agent",
"enter_agent_building_mode",
+ "expert_onboarding",
"find_agent",
"find_block",
"find_library_agent",
diff --git a/autogpt_platform/backend/backend/copilot/sdk/service.py b/autogpt_platform/backend/backend/copilot/sdk/service.py
index 5242d93733..c68480ddb5 100644
--- a/autogpt_platform/backend/backend/copilot/sdk/service.py
+++ b/autogpt_platform/backend/backend/copilot/sdk/service.py
@@ -155,6 +155,7 @@ from ..builder_context import (
build_builder_system_prompt_suffix,
)
from ..expert_context import build_expert_identity_suffix
+from ..expert_kickoff import is_expert_kickoff_turn
from ..service import (
_build_system_prompt,
_is_langfuse_configured,
@@ -164,7 +165,12 @@ from ..service import (
)
from ..thinking_stripper import ThinkingStripper
from ..token_tracking import persist_and_record_usage
-from ..tools import ToolGroup, expert_tool_disabled_groups, tool_names_in_groups
+from ..tools import (
+ ToolGroup,
+ expert_tool_disabled_groups,
+ kickoff_turn_disabled_tools,
+ tool_names_in_groups,
+)
from ..tools.e2b_sandbox import get_or_create_sandbox, pause_sandbox_direct
from ..tools.sandbox import WORKSPACE_PREFIX, make_session_path
from ..tools.session_context import build_session_context
@@ -4876,10 +4882,21 @@ async def stream_chat_completion_sdk( # pyright: ignore[reportGeneralTypeIssues
# into the system prompt. Hiding it removes the tempting-but-worse
# fallback; read_skill("agent_building_guide") remains as escape
# hatch. The baseline path (no prompt machinery) keeps the tool.
+
+ # A hire's kickoff turn is a server-sent control message, so nothing
+ # on it was asked for: narrow it to the onboarding card and nothing
+ # else. Hiding is the enforcement here — an unregistered MCP tool
+ # does not exist for the CLI, so there is no call left to deny.
+ kickoff_hidden = (
+ kickoff_turn_disabled_tools()
+ if is_expert_kickoff_turn(session)
+ else frozenset()
+ )
hidden_tools = (
_hidden_short_names_for_permissions(permissions)
| tool_names_in_groups(disabled_tool_groups)
| {"get_agent_building_guide"}
+ | kickoff_hidden
)
mcp_server = create_copilot_mcp_server(
use_e2b=use_e2b,
@@ -4952,6 +4969,10 @@ async def stream_chat_completion_sdk( # pyright: ignore[reportGeneralTypeIssues
)
disallowed = get_sdk_disallowed_tools(use_e2b=use_e2b)
+ if kickoff_hidden:
+ kickoff_hidden_mcp = {f"{MCP_TOOL_PREFIX}{n}" for n in kickoff_hidden}
+ allowed = [n for n in allowed if n not in kickoff_hidden_mcp]
+
def _on_stderr(line: str) -> None:
"""Log a stderr line emitted by the Claude CLI subprocess."""
nonlocal fallback_model_activated_per_attempt
diff --git a/autogpt_platform/backend/backend/copilot/tools/__init__.py b/autogpt_platform/backend/backend/copilot/tools/__init__.py
index 5bfd3eb13f..416619faa4 100644
--- a/autogpt_platform/backend/backend/copilot/tools/__init__.py
+++ b/autogpt_platform/backend/backend/copilot/tools/__init__.py
@@ -26,6 +26,7 @@ from .delegate_to_expert import DelegateToExpertTool
from .edit_agent import EditAgentTool
from .enter_building_mode import EnterAgentBuildingModeTool
from .expert_chats import ListExpertChatsTool, ReadExpertChatTool
+from .expert_onboarding import ExpertOnboardingTool
from .feature_requests import CreateFeatureRequestTool, SearchFeatureRequestsTool
from .find_agent import FindAgentTool
from .find_block import FindBlockTool
@@ -165,6 +166,8 @@ TOOL_REGISTRY: dict[str, BaseTool] = {
"read_workspace_file": ReadWorkspaceFileTool(),
"write_workspace_file": WriteWorkspaceFileTool(),
"delete_workspace_file": DeleteWorkspaceFileTool(),
+ # The hire's first turn (expert sessions only): greeting + intake card.
+ "expert_onboarding": ExpertOnboardingTool(),
# Expert Soul edits from chat (expert sessions only): preview + confirm
"update_expert_soul": UpdateExpertSoulTool(),
"confirm_expert_soul_update": ConfirmExpertSoulUpdateTool(),
@@ -202,6 +205,8 @@ TOOL_GROUPS: dict[str, ToolGroup] = {
# Soul edits only make sense in an expert-scoped session; the engines
# disable this group when the session has no expert_id.
"update_expert_soul": "experts",
+ # The intake card names the expert it belongs to, so it needs one.
+ "expert_onboarding": "experts",
"confirm_expert_soul_update": "experts",
# A handoff transfers a task between experts, so it needs a caller with
# an expert identity to hand it off from.
@@ -247,9 +252,32 @@ def tool_names_in_groups(groups: Iterable[ToolGroup]) -> frozenset[str]:
return frozenset(name for name, g in TOOL_GROUPS.items() if g in group_set)
+# The one tool a freshly hired expert may reach on its kickoff turn. That
+# turn is a control message the server sends on the user's behalf, so
+# nothing on it was asked for — one click on Hire once ran a Gmail send
+# (SECRT-2622). The kickoff prompt already says "call expert_onboarding
+# once, and nothing else"; ``kickoff_turn_disabled_tools`` is that sentence
+# as an enforcement boundary, for the replayed-transcript, prompt-injection
+# and plain-disobedience cases a prompt cannot cover.
+KICKOFF_TURN_TOOL = "expert_onboarding"
+
+
+def kickoff_turn_disabled_tools() -> frozenset[str]:
+ """Copilot tools to refuse on an expert's kickoff turn.
+
+ Scoped to this registry on purpose: the SDK built-ins it leaves alone
+ (file and shell tools) are confined to the session workspace by the
+ security hooks, so they reach nothing the user would have to undo.
+ Everything that can touch the world outside — ``run_agent``,
+ ``schedule_followup``, ``post_to_chat_platform`` — lives here.
+ """
+ return frozenset(TOOL_REGISTRY) - {KICKOFF_TURN_TOOL}
+
+
def get_available_tools(
*,
disabled_groups: Iterable[ToolGroup] = (),
+ disabled_tools: Iterable[str] = (),
) -> list[ChatCompletionToolParam]:
"""Return OpenAI tool schemas for tools available in the current environment.
@@ -258,8 +286,10 @@ def get_available_tools(
CLI is not installed). Tools belonging to any *disabled_groups* are
also filtered out — use this to hide capability-gated tools (e.g.
``graphiti`` when the memory backend is off for the current user).
+ *disabled_tools* hides individual tools for gates that don't follow the
+ group split, e.g. ``kickoff_turn_disabled_tools`` on a hire's first turn.
"""
- hidden = tool_names_in_groups(disabled_groups)
+ hidden = tool_names_in_groups(disabled_groups) | frozenset(disabled_tools)
return [
tool.as_openai_tool()
for name, tool in TOOL_REGISTRY.items()
@@ -280,8 +310,9 @@ async def execute_tool(
tool_call_id: str,
*,
disabled_groups: Iterable[ToolGroup],
+ disabled_tools: Iterable[str],
) -> StreamToolOutputAvailable:
- """Execute a tool by name, refusing anything in *disabled_groups*.
+ """Execute a tool by name, refusing anything the turn disabled.
``get_available_tools`` only hides disabled tools from the schema list it
hands the model, which is a presentation filter: a model that names a
@@ -290,16 +321,20 @@ async def execute_tool(
here makes the capability gate an enforcement boundary, matching the SDK
engine where hidden tools are never registered with the MCP server at all.
- ``disabled_groups`` is keyword-only and has no default on purpose: it is
- an enforcement boundary, so a new call site must state its gate rather
- than silently inherit "nothing is disabled" and drop back to the
- presentation-only behaviour this function exists to close.
+ ``disabled_groups`` and ``disabled_tools`` are keyword-only and have no
+ default on purpose: they are an enforcement boundary, so a new call site
+ must state its gate rather than silently inherit "nothing is disabled"
+ and drop back to the presentation-only behaviour this function exists to
+ close. Both must be the same values used to build the turn's schema
+ list.
"""
tool = get_tool(tool_name)
if not tool:
raise ValueError(f"Tool {tool_name} not found")
- if tool_name in tool_names_in_groups(disabled_groups):
+ if tool_name in tool_names_in_groups(disabled_groups) or tool_name in frozenset(
+ disabled_tools
+ ):
logger.warning(
"Refusing disabled tool: tool=%s user=%s session=%s",
tool_name,
diff --git a/autogpt_platform/backend/backend/copilot/tools/expert_chats_test.py b/autogpt_platform/backend/backend/copilot/tools/expert_chats_test.py
index 9f0ba4876b..69286f6bcd 100644
--- a/autogpt_platform/backend/backend/copilot/tools/expert_chats_test.py
+++ b/autogpt_platform/backend/backend/copilot/tools/expert_chats_test.py
@@ -199,6 +199,7 @@ class TestGating:
session=_caller(expert_id="expert-a"),
tool_call_id="call-1",
disabled_groups=["expert_admin"],
+ disabled_tools=(),
)
execute_mock.assert_not_awaited()
assert result.success is False
diff --git a/autogpt_platform/backend/backend/copilot/tools/expert_onboarding.py b/autogpt_platform/backend/backend/copilot/tools/expert_onboarding.py
new file mode 100644
index 0000000000..e43c2e58b3
--- /dev/null
+++ b/autogpt_platform/backend/backend/copilot/tools/expert_onboarding.py
@@ -0,0 +1,247 @@
+"""ExpertOnboardingTool - a freshly hired expert's first-turn intake card."""
+
+import json
+import logging
+from typing import Any
+
+from backend.copilot.model import ChatSession
+
+from .base import BaseTool
+from .models import (
+ ErrorResponse,
+ ExpertOnboardingResponse,
+ ExpertOnboardingStep,
+ ResponseType,
+)
+
+logger = logging.getLogger(__name__)
+
+TOOL_NAME = "expert_onboarding"
+
+# The card is a one-question-at-a-time pager, so its length is the user's
+# patience, not a context budget: five steps is already a long walk before
+# anyone has seen the expert do anything.
+MIN_STEPS = 3
+MAX_STEPS = 5
+MAX_OPTIONS = 6
+MAX_QUESTION_LENGTH = 200
+MAX_OPTION_LENGTH = 120
+MAX_GREETING_LENGTH = 600
+# Both arrays are model-authored and the model can be steered by an expert's
+# own user-supplied identity text, so every scan needs its own bound.
+MAX_SCAN = 200
+
+
+class ExpertOnboardingTool(BaseTool):
+ """Open the onboarding card a newly hired expert greets the user with.
+
+ Called once, on the expert's very first turn, instead of guessing what
+ the user wants or starting work unasked. The card asks a handful of
+ multiple-choice questions and returns the answers as a normal user
+ message, so everything after it is an ordinary conversation.
+ """
+
+ @property
+ def name(self) -> str:
+ return TOOL_NAME
+
+ @property
+ def description(self) -> str:
+ return (
+ "Open your onboarding card on your first turn after being hired: "
+ "a short greeting plus 3-5 multiple-choice questions that settle "
+ "what the user wants from you and which services you need. Ask "
+ "for nothing else on that turn, and do not start work until the "
+ "answers come back."
+ )
+
+ @property
+ def parameters(self) -> dict[str, Any]:
+ return {
+ "type": "object",
+ "properties": {
+ "greeting": {
+ "type": "string",
+ "description": (
+ "One or two sentences introducing yourself, in your "
+ "own voice. Shown above the questions."
+ ),
+ },
+ "steps": {
+ "type": "array",
+ "minItems": MIN_STEPS,
+ "maxItems": MAX_STEPS,
+ "items": {
+ "type": "object",
+ "properties": {
+ "question": {
+ "type": "string",
+ "description": "The question text.",
+ },
+ "options": {
+ "type": "array",
+ "items": {"type": "string"},
+ "description": (
+ "Up to 6 answers the user can tap. Make "
+ "them concrete and specific to your role "
+ "— the point is that answering costs no "
+ "typing. The user can always write their "
+ "own answer instead. Exactly one is "
+ "chosen, so split a question that needs "
+ "several answers into separate steps."
+ ),
+ },
+ "keyword": {
+ "type": "string",
+ "description": "Short label for this step.",
+ },
+ },
+ "required": ["question", "options"],
+ },
+ "description": (
+ "3-5 questions, shown one per step. Order them from "
+ "what you most need to know to what is merely nice "
+ "to know."
+ ),
+ },
+ },
+ "required": ["greeting", "steps"],
+ }
+
+ @property
+ def requires_auth(self) -> bool:
+ return True
+
+ async def _execute(
+ self,
+ user_id: str | None,
+ session: ChatSession,
+ **kwargs: Any,
+ ) -> ExpertOnboardingResponse | ErrorResponse:
+ del user_id
+ expert_id = session.expert_id if session else None
+ if not expert_id:
+ return ErrorResponse(
+ message=(
+ "expert_onboarding only works in an expert's own chat. "
+ "Use ask_question instead."
+ ),
+ session_id=session.session_id if session else None,
+ )
+
+ if _has_onboarded(session):
+ return ErrorResponse(
+ message=(
+ "This expert has already opened its onboarding card in "
+ "this chat. Use ask_question for anything further."
+ ),
+ session_id=session.session_id,
+ )
+
+ greeting = kwargs.get("greeting")
+ if not isinstance(greeting, str) or not greeting.strip():
+ raise ValueError("expert_onboarding requires a non-empty 'greeting'")
+
+ raw_steps = kwargs.get("steps", [])
+ if not isinstance(raw_steps, list) or not raw_steps:
+ raise ValueError("expert_onboarding requires a non-empty 'steps' array")
+
+ steps = _parse_steps(raw_steps)
+ if not steps:
+ raise ValueError(
+ "expert_onboarding requires at least one valid step in 'steps'"
+ )
+
+ return ExpertOnboardingResponse(
+ message="; ".join(step.question for step in steps),
+ session_id=session.session_id,
+ expert_id=expert_id,
+ greeting=greeting.strip()[:MAX_GREETING_LENGTH],
+ steps=steps,
+ )
+
+
+def _has_onboarded(session: ChatSession) -> bool:
+ """Whether this chat already opened an onboarding card successfully.
+
+ The card belongs to the hire, not to the conversation: without this a
+ model that re-read its kickoff instruction — or was talked into it — would
+ interrupt an ongoing chat with a fresh intake form.
+
+ Keyed off the persisted tool *result* rather than the assistant's tool
+ call. The call row is appended before the tool runs (see
+ ``BaselineToolPersistence.begin``), so matching on it would let one
+ malformed first attempt — bad arguments, a refusal — permanently convince
+ this guard the hire was already onboarded, with no way to recover.
+ """
+ for message in session.messages:
+ if message.role != "tool" or not message.content:
+ continue
+ try:
+ payload = json.loads(message.content)
+ except ValueError:
+ continue
+ if (
+ isinstance(payload, dict)
+ and payload.get("type") == ResponseType.EXPERT_ONBOARDING.value
+ ):
+ return True
+ return False
+
+
+def _parse_steps(raw: list[Any]) -> list[ExpertOnboardingStep]:
+ """Parse raw step dicts, dropping invalid entries and duplicate keywords."""
+ steps: list[ExpertOnboardingStep] = []
+ seen: set[str] = set()
+ for index, item in enumerate(raw[:MAX_SCAN]):
+ step = _parse_one(item, index)
+ if step is None:
+ continue
+ if step.keyword in seen:
+ continue
+ seen.add(step.keyword)
+ steps.append(step)
+ if len(steps) == MAX_STEPS:
+ break
+ return steps
+
+
+def _parse_one(item: Any, index: int) -> ExpertOnboardingStep | None:
+ if not isinstance(item, dict):
+ logger.warning("expert_onboarding: skipping non-dict step at index %d", index)
+ return None
+
+ question = item.get("question")
+ if not isinstance(question, str) or not question.strip():
+ logger.warning(
+ "expert_onboarding: skipping step at index %d with no question", index
+ )
+ return None
+
+ raw_keyword = item.get("keyword")
+ keyword = (
+ str(raw_keyword).strip()
+ if raw_keyword is not None and str(raw_keyword).strip()
+ else f"step-{index}"
+ )
+
+ return ExpertOnboardingStep(
+ question=question.strip()[:MAX_QUESTION_LENGTH],
+ keyword=keyword,
+ options=_parse_options(item.get("options")),
+ )
+
+
+def _parse_options(raw: Any) -> list[str]:
+ """Strip the option strings and drop repeats, keeping the model's order."""
+ if not isinstance(raw, list):
+ return []
+ unique: dict[str, None] = {}
+ for option in raw[:MAX_SCAN]:
+ if not isinstance(option, str):
+ continue
+ if trimmed := option.strip()[:MAX_OPTION_LENGTH]:
+ unique[trimmed] = None
+ if len(unique) == MAX_OPTIONS:
+ break
+ return list(unique)
diff --git a/autogpt_platform/backend/backend/copilot/tools/expert_onboarding_test.py b/autogpt_platform/backend/backend/copilot/tools/expert_onboarding_test.py
new file mode 100644
index 0000000000..e5fae97421
--- /dev/null
+++ b/autogpt_platform/backend/backend/copilot/tools/expert_onboarding_test.py
@@ -0,0 +1,415 @@
+"""Tests for ExpertOnboardingTool."""
+
+import json
+from unittest.mock import AsyncMock, patch
+
+import pytest
+
+from backend.copilot.expert_kickoff import (
+ expert_kickoff_metadata,
+ is_expert_kickoff_turn,
+)
+from backend.copilot.model import ChatMessage, ChatSession
+from backend.copilot.tools import (
+ execute_tool,
+ get_available_tools,
+ get_tool,
+ kickoff_turn_disabled_tools,
+)
+from backend.copilot.tools.expert_onboarding import (
+ MAX_OPTION_LENGTH,
+ MAX_OPTIONS,
+ MAX_STEPS,
+ MIN_STEPS,
+ ExpertOnboardingTool,
+)
+from backend.copilot.tools.models import (
+ ErrorResponse,
+ ExpertOnboardingResponse,
+ ResponseType,
+)
+
+EXPERT_ID = "1a5b1a10-6d10-4d7c-9d0d-2f6f1d9c0f11"
+
+
+def tool() -> ExpertOnboardingTool:
+ return ExpertOnboardingTool()
+
+
+def session() -> ChatSession:
+ return ChatSession.new(user_id="test-user", dry_run=False, expert_id=EXPERT_ID)
+
+
+def steps(count: int = 2) -> list[dict]:
+ return [
+ {
+ "question": f"Question {index}?",
+ "options": ["Yes", "No"],
+ "keyword": f"k{index}",
+ }
+ for index in range(count)
+ ]
+
+
+# ── Happy path ───────────────────────────────────────────────────────
+
+
+async def test_returns_greeting_and_steps(
+ tool: ExpertOnboardingTool, session: ChatSession
+):
+ result = await tool._execute(
+ user_id="test-user",
+ session=session,
+ greeting="Hi, I'm Ada.",
+ steps=[
+ {
+ "question": "Which services should I plug into?",
+ "options": ["Linear", "GitHub", "Figma"],
+ "keyword": "services",
+ }
+ ],
+ )
+
+ assert isinstance(result, ExpertOnboardingResponse)
+ assert result.expert_id == EXPERT_ID
+ assert result.session_id == session.session_id
+ assert result.greeting == "Hi, I'm Ada."
+ assert len(result.steps) == 1
+ assert result.steps[0].keyword == "services"
+ assert result.steps[0].options == ["Linear", "GitHub", "Figma"]
+ assert result.message == "Which services should I plug into?"
+
+
+async def test_step_without_options_is_open_ended(
+ tool: ExpertOnboardingTool, session: ChatSession
+):
+ result = await tool._execute(
+ user_id="test-user",
+ session=session,
+ greeting="Hi.",
+ steps=[{"question": "Anything else?", "keyword": "else"}],
+ )
+
+ assert isinstance(result, ExpertOnboardingResponse)
+ assert result.steps[0].options == []
+
+
+async def test_missing_keyword_falls_back_to_index(
+ tool: ExpertOnboardingTool, session: ChatSession
+):
+ result = await tool._execute(
+ user_id="test-user",
+ session=session,
+ greeting="Hi.",
+ steps=[{"question": "First?"}, {"question": "Second?"}],
+ )
+
+ assert isinstance(result, ExpertOnboardingResponse)
+ assert [step.keyword for step in result.steps] == ["step-0", "step-1"]
+
+
+# ── Caps and cleaning ────────────────────────────────────────────────
+
+
+async def test_steps_are_capped(tool: ExpertOnboardingTool, session: ChatSession):
+ result = await tool._execute(
+ user_id="test-user",
+ session=session,
+ greeting="Hi.",
+ steps=steps(MAX_STEPS + 4),
+ )
+
+ assert isinstance(result, ExpertOnboardingResponse)
+ assert len(result.steps) == MAX_STEPS
+
+
+async def test_options_are_capped_and_trimmed(
+ tool: ExpertOnboardingTool, session: ChatSession
+):
+ result = await tool._execute(
+ user_id="test-user",
+ session=session,
+ greeting="Hi.",
+ steps=[
+ {
+ "question": "Pick one",
+ "options": [" Linear "]
+ + ["x" * (MAX_OPTION_LENGTH + 50)]
+ + [f"opt{i}" for i in range(MAX_OPTIONS + 5)],
+ }
+ ],
+ )
+
+ assert isinstance(result, ExpertOnboardingResponse)
+ options = result.steps[0].options
+ assert len(options) == MAX_OPTIONS
+ assert options[0] == "Linear"
+ assert all(len(option) <= MAX_OPTION_LENGTH for option in options)
+
+
+async def test_repeated_options_and_keywords_collapse(
+ tool: ExpertOnboardingTool, session: ChatSession
+):
+ result = await tool._execute(
+ user_id="test-user",
+ session=session,
+ greeting="Hi.",
+ steps=[
+ {"question": "A?", "options": ["Yes", "Yes", "No"], "keyword": "dup"},
+ {"question": "B?", "options": ["Yes"], "keyword": "dup"},
+ ],
+ )
+
+ assert isinstance(result, ExpertOnboardingResponse)
+ assert len(result.steps) == 1
+ assert result.steps[0].options == ["Yes", "No"]
+
+
+async def test_non_string_options_are_dropped(
+ tool: ExpertOnboardingTool, session: ChatSession
+):
+ result = await tool._execute(
+ user_id="test-user",
+ session=session,
+ greeting="Hi.",
+ steps=[{"question": "A?", "options": ["Yes", 7, None, ["No"]]}],
+ )
+
+ assert isinstance(result, ExpertOnboardingResponse)
+ assert result.steps[0].options == ["Yes"]
+
+
+# ── Refusals ─────────────────────────────────────────────────────────
+
+
+async def test_refuses_outside_an_expert_session(tool: ExpertOnboardingTool):
+ plain = ChatSession.new(user_id="test-user", dry_run=False)
+
+ result = await tool._execute(
+ user_id="test-user", session=plain, greeting="Hi.", steps=steps()
+ )
+
+ assert isinstance(result, ErrorResponse)
+ assert "expert" in result.message.lower()
+
+
+def onboarding_call() -> ChatMessage:
+ """The assistant row the runtime appends BEFORE the tool executes."""
+ return ChatMessage(
+ role="assistant",
+ tool_calls=[
+ {
+ "id": "call-1",
+ "type": "function",
+ "function": {"name": "expert_onboarding", "arguments": "{}"},
+ }
+ ],
+ )
+
+
+def tool_result(payload: dict) -> ChatMessage:
+ return ChatMessage(role="tool", content=json.dumps(payload), tool_call_id="call-1")
+
+
+async def test_refuses_a_second_card_in_the_same_chat(
+ tool: ExpertOnboardingTool, session: ChatSession
+):
+ session.messages.append(onboarding_call())
+ session.messages.append(
+ tool_result({"type": ResponseType.EXPERT_ONBOARDING.value, "steps": []})
+ )
+
+ result = await tool._execute(
+ user_id="test-user", session=session, greeting="Hi.", steps=steps()
+ )
+
+ assert isinstance(result, ErrorResponse)
+ assert "already" in result.message.lower()
+
+
+async def test_a_failed_first_attempt_does_not_block_a_retry(
+ tool: ExpertOnboardingTool, session: ChatSession
+):
+ """The tool-call row lands before the tool runs, so a rejected first call
+ would otherwise convince the guard the hire was already onboarded."""
+ session.messages.append(onboarding_call())
+ session.messages.append(
+ tool_result({"type": ResponseType.ERROR.value, "message": "bad arguments"})
+ )
+
+ result = await tool._execute(
+ user_id="test-user", session=session, greeting="Hi.", steps=steps(3)
+ )
+
+ assert isinstance(result, ExpertOnboardingResponse)
+ assert len(result.steps) == 3
+
+
+async def test_an_unparsable_tool_row_does_not_block(
+ tool: ExpertOnboardingTool, session: ChatSession
+):
+ session.messages.append(ChatMessage(role="tool", content="not json"))
+
+ result = await tool._execute(
+ user_id="test-user", session=session, greeting="Hi.", steps=steps(3)
+ )
+
+ assert isinstance(result, ExpertOnboardingResponse)
+
+
+def test_schema_declares_the_step_range(tool: ExpertOnboardingTool):
+ steps_schema = tool.parameters["properties"]["steps"]
+
+ assert steps_schema["minItems"] == MIN_STEPS
+ assert steps_schema["maxItems"] == MAX_STEPS
+
+
+async def test_rejects_empty_greeting(tool: ExpertOnboardingTool, session: ChatSession):
+ with pytest.raises(ValueError):
+ await tool._execute(
+ user_id="test-user", session=session, greeting=" ", steps=steps()
+ )
+
+
+async def test_rejects_empty_steps(tool: ExpertOnboardingTool, session: ChatSession):
+ with pytest.raises(ValueError):
+ await tool._execute(
+ user_id="test-user", session=session, greeting="Hi.", steps=[]
+ )
+
+
+async def test_rejects_steps_with_no_valid_entry(
+ tool: ExpertOnboardingTool, session: ChatSession
+):
+ with pytest.raises(ValueError):
+ await tool._execute(
+ user_id="test-user",
+ session=session,
+ greeting="Hi.",
+ steps=["not a dict", {"question": " "}],
+ )
+
+
+# ── Kickoff-turn dispatch gate ───────────────────────────────────────
+#
+# The kickoff prompt tells the model to open the card and nothing else.
+# These cover that sentence as an enforcement boundary: what a model can
+# dispatch before the card exists, and after the user has answered it.
+
+
+def _kickoff_session() -> ChatSession:
+ session = ChatSession.new(user_id="alice", dry_run=False, expert_id=EXPERT_ID)
+ session.messages.append(
+ ChatMessage(
+ role="user",
+ content="You were just hired.",
+ metadata=expert_kickoff_metadata(EXPERT_ID),
+ )
+ )
+ return session
+
+
+def test_the_kickoff_turn_offers_the_card_and_nothing_else():
+ gated = kickoff_turn_disabled_tools()
+
+ names = {
+ schema["function"]["name"]
+ for schema in get_available_tools(disabled_tools=gated)
+ }
+
+ assert names == {"expert_onboarding"}
+ assert {"run_agent", "schedule_followup"} <= gated
+
+
+async def test_run_agent_is_refused_on_the_kickoff_turn():
+ run_agent = get_tool("run_agent")
+ assert run_agent is not None
+
+ with patch.object(
+ run_agent, "execute", new=AsyncMock(return_value="should never run")
+ ) as execute_mock:
+ result = await execute_tool(
+ tool_name="run_agent",
+ parameters={},
+ user_id="alice",
+ session=_kickoff_session(),
+ tool_call_id="call-1",
+ disabled_groups=(),
+ disabled_tools=kickoff_turn_disabled_tools(),
+ )
+
+ execute_mock.assert_not_awaited()
+ assert result.success is False
+ assert ErrorResponse.model_validate_json(result.output).error == "tool_disabled"
+
+
+async def test_the_onboarding_card_itself_still_dispatches_on_the_kickoff_turn():
+ onboarding = get_tool("expert_onboarding")
+ assert onboarding is not None
+
+ with patch.object(
+ onboarding, "execute", new=AsyncMock(return_value="the card")
+ ) as execute_mock:
+ result = await execute_tool(
+ tool_name="expert_onboarding",
+ parameters={},
+ user_id="alice",
+ session=_kickoff_session(),
+ tool_call_id="call-1",
+ disabled_groups=(),
+ disabled_tools=kickoff_turn_disabled_tools(),
+ )
+
+ execute_mock.assert_awaited_once()
+ assert result == "the card"
+
+
+async def test_run_agent_dispatches_once_the_user_has_answered_the_card():
+ """The gate is the kickoff turn, not onboarding state.
+
+ A user who skipped the card, or one whose expert never managed to open
+ it, still gets the work they ask for on their own turns.
+ """
+ session = _kickoff_session()
+ session.messages.append(ChatMessage(role="user", content="Run the digest now."))
+ run_agent = get_tool("run_agent")
+ assert run_agent is not None
+
+ with patch.object(
+ run_agent, "execute", new=AsyncMock(return_value="it ran")
+ ) as execute_mock:
+ result = await execute_tool(
+ tool_name="run_agent",
+ parameters={},
+ user_id="alice",
+ session=session,
+ tool_call_id="call-1",
+ disabled_groups=(),
+ disabled_tools=(
+ kickoff_turn_disabled_tools()
+ if is_expert_kickoff_turn(session)
+ else frozenset()
+ ),
+ )
+
+ execute_mock.assert_awaited_once()
+ assert result == "it ran"
diff --git a/autogpt_platform/backend/backend/copilot/tools/handoff_to_expert_test.py b/autogpt_platform/backend/backend/copilot/tools/handoff_to_expert_test.py
index d97a5ec8f7..8ec320e39b 100644
--- a/autogpt_platform/backend/backend/copilot/tools/handoff_to_expert_test.py
+++ b/autogpt_platform/backend/backend/copilot/tools/handoff_to_expert_test.py
@@ -721,6 +721,7 @@ class TestExecuteToolEnforcesDisabledGroups:
session=session,
tool_call_id="call-1",
disabled_groups=["expert_admin"],
+ disabled_tools=(),
)
execute_mock.assert_not_awaited()
@@ -744,6 +745,7 @@ class TestExecuteToolEnforcesDisabledGroups:
session=session,
tool_call_id="call-1",
disabled_groups=(),
+ disabled_tools=(),
)
execute_mock.assert_awaited_once()
diff --git a/autogpt_platform/backend/backend/copilot/tools/models.py b/autogpt_platform/backend/backend/copilot/tools/models.py
index f785a3cc78..ddb571a073 100644
--- a/autogpt_platform/backend/backend/copilot/tools/models.py
+++ b/autogpt_platform/backend/backend/copilot/tools/models.py
@@ -130,6 +130,7 @@ class ResponseType(str, Enum):
TEAM_ROSTER = "team_roster"
EXPERT_CHAT_LIST = "expert_chat_list"
EXPERT_CHAT_TRANSCRIPT = "expert_chat_transcript"
+ EXPERT_ONBOARDING = "expert_onboarding"
# Base response model
@@ -734,6 +735,25 @@ class ClarificationNeededResponse(ToolResponseBase):
questions: list[ClarifyingQuestion] = Field(default_factory=list)
+class ExpertOnboardingStep(BaseModel):
+ """One step of a freshly hired expert's intake card."""
+
+ question: str
+ keyword: str
+ # Tappable answers. The card always offers a free-text escape as well, so
+ # an empty list simply means "this one is open-ended".
+ options: list[str] = Field(default_factory=list)
+
+
+class ExpertOnboardingResponse(ToolResponseBase):
+ """The intake card a freshly hired expert opens its first turn with."""
+
+ type: ResponseType = ResponseType.EXPERT_ONBOARDING
+ expert_id: str
+ greeting: str
+ steps: list[ExpertOnboardingStep] = Field(default_factory=list)
+
+
class SuggestedGoalResponse(ToolResponseBase):
"""Response when the goal needs refinement with a suggested alternative."""
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expertKickoff.test.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expertKickoff.test.ts
index fb6411b154..080bf52617 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expertKickoff.test.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expertKickoff.test.ts
@@ -7,13 +7,13 @@ import {
getKickoffExpertId,
getKickoffExpertIdFromMetadata,
getKickoffStatus,
+ hideKickoffMessages,
isKickoffMessage,
isKickoffText,
kickoffStorageKey,
markKickoffDone,
markKickoffPending,
parseLegacyKickoffExpertId,
- revealKickoffMessages,
shouldClearKickoffParam,
stripLegacyKickoffMarker,
withKickoffLock,
@@ -35,11 +35,6 @@ function userMessage(
} as UIMessage;
}
-function firstText(message: UIMessage): string | undefined {
- const part = message.parts.find((candidate) => candidate.type === "text");
- return part && "text" in part ? part.text : undefined;
-}
-
function assistantMessage(
id: string,
text: string,
@@ -66,10 +61,10 @@ describe("buildKickoffMessage", () => {
"attempt-1",
);
expect(message.text).toContain("You were just hired.");
- expect(message.text).toContain("Introduce yourself in 2-3 sentences");
- expect(message.text).toContain("ask which one to start");
- expect(message.text).toContain("If no workflow is installed");
- expect(message.text).toContain("Never pretend a run succeeded.");
+ expect(message.text).toContain("expert_onboarding");
+ // The hire's first turn is an intake, not a first job.
+ expect(message.text).toContain("Do not run a workflow");
+ expect(message.text).not.toContain("run_agent");
expect(message.text).not.toContain("EXPERT_KICKOFF");
expect(message.text).not.toContain(EXPERT_ID);
});
@@ -98,7 +93,7 @@ describe("kickoff message identification", () => {
isKickoffMessage(
userMessage(
"m2",
- "You were just hired. Introduce yourself in 2-3 sentences in your voice",
+ "You were just hired. Call expert_onboarding once, and nothing else",
),
),
).toBe(false);
@@ -125,7 +120,7 @@ describe("kickoff message identification", () => {
).toBeNull();
});
- it("keeps every message in the transcript, kickoff included", () => {
+ it("drops the kickoff prompt from the transcript and keeps the rest", () => {
const kickoff = buildKickoffMessage(EXPERT_ID);
const messages = [
userMessage("m1", kickoff.text, kickoff.metadata),
@@ -133,40 +128,28 @@ describe("kickoff message identification", () => {
userMessage("m3", "Sounds good, go ahead."),
];
- const revealed = revealKickoffMessages(messages);
+ const visible = hideKickoffMessages(messages);
- expect(revealed.map((message) => message.id)).toEqual(["m1", "m2", "m3"]);
- expect(firstText(revealed[0])).toBe(kickoff.text);
+ expect(visible.map((message) => message.id)).toEqual(["m2", "m3"]);
});
- it("carries non-text parts of a kickoff message through the reveal", () => {
- const kickoff = buildKickoffMessage(EXPERT_ID);
- const filePart = {
- type: "file",
- mediaType: "application/json",
- filename: "workflow.json",
- url: "https://example.test/api/workspace/files/file-1",
- };
- const message = {
- id: "m1",
- role: "user",
- parts: [{ type: "text", text: kickoff.text }, filePart],
- metadata: kickoff.metadata,
- } as UIMessage;
-
- const [revealed] = revealKickoffMessages([message]);
-
- expect(revealed.parts).toHaveLength(2);
- expect(firstText(revealed)).toBe(kickoff.text);
- expect(revealed.parts[1]).toEqual(filePart);
+ it("drops a legacy-marker kickoff message from the transcript", () => {
+ const legacy = `[[EXPERT_KICKOFF:${EXPERT_ID}]]\n\nIntroduce yourself.`;
+
+ const visible = hideKickoffMessages([
+ userMessage("m1", legacy),
+ assistantMessage("m2", "Hi, I'm Maria."),
+ ]);
+
+ expect(visible.map((message) => message.id)).toEqual(["m2"]);
});
- it("hides the legacy marker from a revealed kickoff message", () => {
- const legacy = `[[EXPERT_KICKOFF:${EXPERT_ID}]]\n\nIntroduce yourself.`;
+ it("keeps a user message that merely repeats the kickoff wording", () => {
+ const kickoff = buildKickoffMessage(EXPERT_ID);
- const revealed = revealKickoffMessages([userMessage("m1", legacy)]);
+ const visible = hideKickoffMessages([userMessage("m1", kickoff.text)]);
- expect(firstText(revealed[0])).toBe("Introduce yourself.");
+ expect(visible.map((message) => message.id)).toEqual(["m1"]);
});
it("strictly recognizes legacy markers for backward compatibility", () => {
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChainActionCard/QuestionAnswerField.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChainActionCard/QuestionAnswerField.tsx
index ca61ca757d..7859f72bd6 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChainActionCard/QuestionAnswerField.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChainActionCard/QuestionAnswerField.tsx
@@ -43,7 +43,7 @@ export function QuestionAnswerField({
if (options.length === 0 || typing) {
return (
- <div className="flex flex-col gap-1.5">
+ <div className="flex flex-col gap-2">
<textarea
required
rows={3}
@@ -64,7 +64,7 @@ export function QuestionAnswerField({
? `e.g. ${question.example}`
: "Type your answer"
}
- className="resize-none rounded-2xl bg-zinc-50 px-3 py-2 text-sm leading-relaxed text-zinc-800 ring-1 ring-zinc-100 transition-shadow placeholder:text-zinc-400 focus:outline-none focus:ring-zinc-300"
+ className="resize-none rounded-2xl bg-zinc-50 px-4 py-3 text-base leading-relaxed text-zinc-800 ring-1 ring-zinc-100 transition-shadow placeholder:text-zinc-400 focus:outline-none focus:ring-zinc-300"
/>
{options.length > 0 && (
<button
@@ -76,7 +76,7 @@ export function QuestionAnswerField({
setToggled(true);
setTyping(false);
}}
- className="self-start rounded-full px-2 py-0.5 text-xs text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-700"
+ className="self-start rounded-full px-2.5 py-1 text-sm text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-700"
>
Choose from options instead
</button>
@@ -86,7 +86,7 @@ export function QuestionAnswerField({
}
return (
- <div className="flex flex-col gap-1.5">
+ <div className="flex flex-col gap-2">
<QuestionOptionList
options={options}
value={value}
@@ -103,9 +103,9 @@ export function QuestionAnswerField({
setToggled(true);
setTyping(true);
}}
- className="flex items-center gap-2 rounded-2xl border border-dashed border-zinc-200 px-3 py-2 text-left text-sm text-zinc-500 transition-colors hover:border-zinc-300 hover:text-zinc-700"
+ className="flex items-center gap-2.5 rounded-2xl border border-dashed border-zinc-200 px-4 py-3 text-left text-base text-zinc-500 transition-colors hover:border-zinc-300 hover:text-zinc-700"
>
- <Icon icon={PencilEdit02Icon} size={14} className="shrink-0" />
+ <Icon icon={PencilEdit02Icon} size={16} className="shrink-0" />
Type something…
</button>
</div>
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChainActionCard/QuestionOptionList.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChainActionCard/QuestionOptionList.tsx
index 18a93cc6c4..311669c9ce 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChainActionCard/QuestionOptionList.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChainActionCard/QuestionOptionList.tsx
@@ -77,7 +77,7 @@ export function QuestionOptionList({
role="radiogroup"
aria-labelledby={labelId}
aria-required="true"
- className="flex flex-col gap-1.5"
+ className="flex flex-col gap-2"
>
{options.map((option, index) => {
const isSelected = option === value.trim();
@@ -94,7 +94,7 @@ export function QuestionOptionList({
onClick={() => onPick(option)}
onKeyDown={(event) => handleKeyDown(event, index)}
className={
- "flex items-center justify-between gap-2 rounded-2xl px-3 py-2 text-left text-sm leading-relaxed transition-all " +
+ "flex items-center justify-between gap-3 rounded-2xl px-4 py-3 text-left text-base leading-snug transition-all " +
(isSelected
? "bg-white text-zinc-900 ring-2 ring-zinc-800"
: "bg-zinc-50 text-zinc-700 ring-1 ring-zinc-100 hover:bg-zinc-100")
@@ -102,7 +102,7 @@ export function QuestionOptionList({
>
<span>{option}</span>
{isSelected && (
- <Icon icon={Tick02Icon} size={14} className="shrink-0" />
+ <Icon icon={Tick02Icon} size={16} className="shrink-0" />
)}
</button>
);
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChainActionCard/QuestionsSection.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChainActionCard/QuestionsSection.tsx
index 6f5680bc91..735de9ab31 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChainActionCard/QuestionsSection.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChainActionCard/QuestionsSection.tsx
@@ -79,9 +79,12 @@ export function QuestionsSection({ requests, isReady, onProceed }: Props) {
initial={{ opacity: 0, y: 8 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.25, ease: [0.23, 1, 0.32, 1] }}
- className="flex flex-col gap-1.5 px-4 py-3"
+ className="flex flex-col gap-4 px-5 pb-4 pt-5"
>
- <span id={labelId} className="text-sm text-zinc-700">
+ <span
+ id={labelId}
+ className="text-lg font-medium leading-snug text-zinc-900"
+ >
{question.question}
</span>
<QuestionAnswerField
@@ -99,7 +102,7 @@ export function QuestionsSection({ requests, isReady, onProceed }: Props) {
/>
</m.div>
- <div className="flex items-center justify-between px-4 pb-3 pt-1">
+ <div className="flex items-center justify-between px-5 pb-4 pt-1">
<span className="flex items-center gap-2">
<button
type="button"
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx
index 5086ce5653..2a5b218f29 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx
@@ -15,8 +15,7 @@ import type { WorkspaceAttachment } from "../../helpers/workspaceAttachments";
import { ChatMessagesContainer } from "../ChatMessagesContainer/ChatMessagesContainer";
import { CopilotChatActionsProvider } from "../CopilotChatActionsProvider/CopilotChatActionsProvider";
import { EmptySession } from "../EmptySession/EmptySession";
-import { getPendingQuestions } from "../QuestionDock/helpers";
-import { PendingQuestionsContext } from "../QuestionDock/PendingQuestionsContext";
+import { PendingAnswerContexts } from "./components/PendingAnswerContexts";
import { UsageLimitReachedCard } from "../UsageLimits/UsageLimitReachedCard/UsageLimitReachedCard";
import { useIsUsageLimitReached } from "../UsageLimits/useIsUsageLimitReached";
import { TaskProgressBar } from "../TaskProgressBar/TaskProgressBar";
@@ -284,7 +283,7 @@ export const ChatContainer = ({
return (
<CopilotChatActionsProvider onSend={guardedOnSend}>
- <PendingQuestionsContext.Provider value={getPendingQuestions(messages)}>
+ <PendingAnswerContexts messages={messages}>
<LayoutGroup id="copilot-2-chat-layout">
<div className="flex h-full min-h-0 w-full flex-col px-2 lg:px-0">
{/* The chat column runs full width: the max-w-3xl cap lives on the
@@ -452,7 +451,7 @@ export const ChatContainer = ({
)}
</div>
</LayoutGroup>
- </PendingQuestionsContext.Provider>
+ </PendingAnswerContexts>
</CopilotChatActionsProvider>
);
};
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/components/PendingAnswerContexts.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/components/PendingAnswerContexts.tsx
new file mode 100644
index 0000000000..f686e8e316
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/components/PendingAnswerContexts.tsx
@@ -0,0 +1,28 @@
+"use client";
+
+import type { UIDataTypes, UIMessage, UITools } from "ai";
+import { getPendingOnboardingCallId } from "../../ExpertOnboardingCard/helpers";
+import { PendingOnboardingContext } from "../../ExpertOnboardingCard/PendingOnboardingContext";
+import { getPendingQuestions } from "../../QuestionDock/helpers";
+import { PendingQuestionsContext } from "../../QuestionDock/PendingQuestionsContext";
+
+interface Props {
+ messages: UIMessage<unknown, UIDataTypes, UITools>[];
+ children: React.ReactNode;
+}
+
+/** What the session is still waiting on the user for: the clarifying-question
+ * dock and the hire's onboarding card each decide from here whether their
+ * form is live or already history, rather than from local state a reload
+ * would lose. */
+export function PendingAnswerContexts({ messages, children }: Props) {
+ return (
+ <PendingQuestionsContext.Provider value={getPendingQuestions(messages)}>
+ <PendingOnboardingContext.Provider
+ value={getPendingOnboardingCallId(messages)}
+ >
+ {children}
+ </PendingOnboardingContext.Provider>
+ </PendingQuestionsContext.Provider>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx
index 6bd9101cd8..bd1df81259 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx
@@ -20,7 +20,7 @@ import { TurnStatsBar } from "../JobStatsBar/TurnStatsBar";
import { useElapsedTimer } from "../JobStatsBar/useElapsedTimer";
import { CopilotPendingReviews } from "../CopilotPendingReviews/CopilotPendingReviews";
import type { TurnStatsMap } from "../../helpers/convertChatSessionToUiMessages";
-import { revealKickoffMessages } from "../../expertKickoff";
+import { hideKickoffMessages } from "../../expertKickoff";
import {
getLastCompactionCallId,
getLatestCompactionPhase,
@@ -323,7 +323,7 @@ export function ChatMessagesContainer({
}: Props) {
const isCompact = variant === "compact";
const messages = useMemo(
- () => revealKickoffMessages(allMessages),
+ () => hideKickoffMessages(allMessages),
[allMessages],
);
// Hide the container for one frame when messages first load so
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/ChatMessagesContainer.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/ChatMessagesContainer.test.tsx
index 5a1732d509..6f0faa4340 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/ChatMessagesContainer.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/ChatMessagesContainer.test.tsx
@@ -818,7 +818,7 @@ describe("ChatMessagesContainer — readOnly mode", () => {
// ── expert kickoff ────────────────────────────────────────────────────────
describe("ChatMessagesContainer — expert kickoff", () => {
- it("shows the kickoff prompt as a user message above the reply", () => {
+ it("hides the kickoff prompt and shows only the reply", () => {
const kickoff = buildKickoffMessage("3f8b0f7e-9f30-4a3b-a6a1-000000000001");
render(
<ChatMessagesContainer
@@ -840,7 +840,8 @@ describe("ChatMessagesContainer — expert kickoff", () => {
/>,
);
- expect(screen.getAllByTestId("message-user")).toHaveLength(1);
+ expect(screen.queryByTestId("message-user")).toBeNull();
+ expect(screen.queryByText(kickoff.text)).toBeNull();
expect(screen.getAllByTestId("message-assistant").length).toBeGreaterThan(
0,
);
@@ -858,7 +859,7 @@ describe("ChatMessagesContainer — expert kickoff", () => {
parts: [
{
type: "text",
- text: "You were just hired. Introduce yourself in 2-3 sentences in your voice",
+ text: "You were just hired. Call expert_onboarding once, and nothing else",
},
],
},
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsx
index aaa24d4286..1257fc91ad 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsx
@@ -24,6 +24,7 @@ import { SearchDocsTool } from "../../../tools/SearchDocs/SearchDocs";
import { SetupTriggerTool } from "../../../tools/SetupTrigger/SetupTrigger";
import { ViewAgentOutputTool } from "../../../tools/ViewAgentOutput/ViewAgentOutput";
import { CompactionCard } from "../../CompactionCard/CompactionCard";
+import { ExpertOnboardingCard } from "../../ExpertOnboardingCard/ExpertOnboardingCard";
import {
parseCompactionOutput,
type CompactionPhase,
@@ -232,6 +233,8 @@ export function MessagePartRenderer({
}
case "tool-ask_question":
return <AskQuestionTool key={key} part={part as ToolUIPart} />;
+ case "tool-expert_onboarding":
+ return <ExpertOnboardingCard key={key} part={part as ToolUIPart} />;
case "tool-find_block":
return <FindBlocksTool key={key} part={part as ToolUIPart} />;
case "tool-find_agent":
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
index 8845fbb2c8..320b036274 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts
@@ -9,6 +9,7 @@ import {
type CompactionStats,
} from "../CompactionCard/helpers";
import { COMPACTION_PART_TYPE, isExpertChangePart } from "../ToolChain/helpers";
+import { EXPERT_ONBOARDING_PART_TYPE } from "../ExpertOnboardingCard/helpers";
export type MessagePart = UIMessage<
unknown,
@@ -19,10 +20,15 @@ export type MessagePart = UIMessage<
// Every assistant tool renders inside the ToolChain. ToolResult supplies a
// compact result view for known backend tools and a structured fallback for
// SDK or future tools, so no tool ever renders as a bare top-level part.
-// Compaction and expert changes are the exceptions: each owns a card that
-// must stay on screen, so they render as parts of their own.
+// Compaction, expert changes and the hire's onboarding card are the
+// exceptions: each owns a card that must stay on screen, so they render as
+// parts of their own.
export function isChainableToolPart(part: MessagePart): boolean {
- if (part.type === COMPACTION_PART_TYPE || isExpertChangePart(part)) {
+ if (
+ part.type === COMPACTION_PART_TYPE ||
+ part.type === EXPERT_ONBOARDING_PART_TYPE ||
+ isExpertChangePart(part)
+ ) {
return false;
}
return part.type === "reasoning" || part.type.startsWith("tool-");
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ExpertOnboardingCard/ExpertOnboardingCard.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ExpertOnboardingCard/ExpertOnboardingCard.tsx
new file mode 100644
index 0000000000..4b03073f32
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ExpertOnboardingCard/ExpertOnboardingCard.tsx
@@ -0,0 +1,222 @@
+"use client";
+
+import { Icon } from "@/components/atoms/Icon/Icon";
+import {
+ ArrowLeft01Icon,
+ ArrowRight01Icon,
+ CheckmarkCircle02Icon,
+ SentIcon,
+} from "@hugeicons/core-free-icons";
+import type { ToolUIPart } from "ai";
+import { domAnimation, LazyMotion, m } from "framer-motion";
+import { useContext, useId } from "react";
+import { useExpertMap } from "../../useExpertMap";
+import { ExpertAvatar } from "../ChatMessagesContainer/components/ExpertAvatar/ExpertAvatar";
+import { QuestionAnswerField } from "../ChainActionCard/QuestionAnswerField";
+import { MorphingTextAnimation } from "../MorphingTextAnimation/MorphingTextAnimation";
+import {
+ parseExpertOnboarding,
+ toClarifyingQuestion,
+ type ExpertOnboardingOutput,
+} from "./helpers";
+import { PendingOnboardingContext } from "./PendingOnboardingContext";
+import { useExpertOnboardingCard } from "./useExpertOnboardingCard";
+
+interface Props {
+ part: ToolUIPart;
+}
+
+/** The intake card a freshly hired expert opens with: a greeting in its own
+ * voice and a few tappable questions, one per step. It stands outside the
+ * tool chain because a chain collapses on top of its rows, and this one is
+ * the only thing on screen the user is meant to act on. */
+export function ExpertOnboardingCard({ part }: Props) {
+ const pendingCallId = useContext(PendingOnboardingContext);
+ const onboarding = parseExpertOnboarding(part);
+
+ if (!onboarding) {
+ // A settled call that parsed to nothing is as final as an errored one —
+ // no later output is coming, so the pending line would spin forever.
+ const isSettled =
+ part.state === "output-error" || part.state === "output-available";
+ if (isSettled) {
+ return (
+ <div className="py-2 text-sm text-zinc-500">
+ Couldn&apos;t open the setup questions.
+ </div>
+ );
+ }
+ return (
+ <div className="flex items-center gap-2 py-2 text-sm text-muted-foreground">
+ <MorphingTextAnimation text="Getting set up…" />
+ </div>
+ );
+ }
+
+ return (
+ <OnboardingForm
+ onboarding={onboarding}
+ isLive={pendingCallId === part.toolCallId}
+ />
+ );
+}
+
+interface FormProps {
+ onboarding: ExpertOnboardingOutput;
+ isLive: boolean;
+}
+
+function OnboardingForm({ onboarding, isLive }: FormProps) {
+ const { expertsById } = useExpertMap();
+ const sectionId = useId();
+ const {
+ current,
+ currentStep,
+ isAnswered,
+ isDone,
+ isLast,
+ isSending,
+ value,
+ advance,
+ goBack,
+ pickAnswer,
+ setAnswer,
+ skip,
+ } = useExpertOnboardingCard({ steps: onboarding.steps, isLive });
+
+ const expert = onboarding.expertId
+ ? expertsById.get(onboarding.expertId)
+ : undefined;
+ const name = expert?.name ?? "Your new hire";
+ const labelId = `${sectionId}-${currentStep.keyword}`;
+
+ if (isDone) {
+ return (
+ <div className="flex items-center gap-2 py-2 text-sm text-zinc-500">
+ <Icon
+ icon={CheckmarkCircle02Icon}
+ size={16}
+ className="shrink-0 text-zinc-400"
+ />
+ Setup questions from {name}
+ </div>
+ );
+ }
+
+ return (
+ <div className="w-full max-w-xl overflow-hidden rounded-3xl border border-zinc-100 bg-white shadow-[0_16px_40px_-24px_rgba(0,0,0,0.25)]">
+ <div className="flex items-start justify-between gap-3 border-b border-zinc-100 px-4 py-3">
+ <span className="flex min-w-0 items-center gap-3">
+ <ExpertAvatar name={name} avatarUrl={expert?.avatarUrl ?? null} />
+ <span className="flex min-w-0 flex-col">
+ <span className="truncate text-sm font-medium text-zinc-900">
+ {name}
+ </span>
+ {expert?.role && (
+ <span className="truncate text-xs text-zinc-500">
+ {expert.role}
+ </span>
+ )}
+ </span>
+ </span>
+ <button
+ type="button"
+ onClick={skip}
+ disabled={isSending}
+ className="shrink-0 rounded-full px-2 py-0.5 text-xs text-zinc-400 transition-colors enabled:hover:bg-zinc-100 enabled:hover:text-zinc-600 disabled:opacity-50"
+ >
+ Skip
+ </button>
+ </div>
+
+ {onboarding.greeting && (
+ <p className="border-b border-zinc-100 px-5 py-4 text-base leading-relaxed text-zinc-700">
+ {onboarding.greeting}
+ </p>
+ )}
+
+ {/* Wraps only the pager, not the whole card: ``strict`` rejects any
+ ``motion`` component below it, and the header's ExpertAvatar
+ animates its face with the full ``motion`` build. */}
+ <LazyMotion features={domAnimation} strict>
+ <m.div
+ key={currentStep.keyword}
+ initial={{ opacity: 0, y: 8 }}
+ animate={{ opacity: 1, y: 0 }}
+ transition={{ duration: 0.25, ease: [0.23, 1, 0.32, 1] }}
+ className="flex flex-col gap-4 px-5 pb-4 pt-5"
+ >
+ <span
+ id={labelId}
+ className="text-lg font-medium leading-snug text-zinc-900"
+ >
+ {currentStep.question}
+ </span>
+ <QuestionAnswerField
+ // The field owns a typing toggle that must not leak between
+ // questions; the key remounts it on every step.
+ key={currentStep.keyword}
+ question={toClarifyingQuestion(currentStep)}
+ value={value}
+ labelId={labelId}
+ autoFocus={current > 0}
+ onChange={setAnswer}
+ onPick={pickAnswer}
+ onSubmit={advance}
+ />
+ </m.div>
+ </LazyMotion>
+
+ <div className="flex items-center justify-between px-5 pb-4 pt-1">
+ <span className="flex items-center gap-2">
+ <button
+ type="button"
+ aria-label="Previous question"
+ disabled={current === 0}
+ onClick={goBack}
+ className="flex size-6 items-center justify-center rounded-lg text-zinc-400 transition-colors enabled:hover:bg-zinc-100 enabled:hover:text-zinc-600 disabled:opacity-35"
+ >
+ <Icon icon={ArrowLeft01Icon} size={14} />
+ </button>
+ <span
+ aria-hidden="true"
+ className="flex items-center gap-1.5"
+ data-testid="expert-onboarding-progress"
+ >
+ {onboarding.steps.map((step, index) => (
+ <span
+ key={step.keyword}
+ className={
+ "rounded-full transition-all duration-300 " +
+ (index === current
+ ? "size-2.5 border-2 border-zinc-800"
+ : index < current
+ ? "size-2 bg-zinc-400"
+ : "size-2 border border-zinc-300")
+ }
+ />
+ ))}
+ </span>
+ <span className="text-xs text-zinc-400">
+ {current + 1} of {onboarding.steps.length}
+ </span>
+ </span>
+
+ <button
+ type="button"
+ aria-label={isLast ? "Send answers" : "Next question"}
+ disabled={!isAnswered || isSending}
+ onClick={advance}
+ className={
+ "flex size-8 items-center justify-center rounded-full transition-all duration-200 enabled:active:scale-95 " +
+ (isAnswered && !isSending
+ ? "bg-zinc-800 text-white hover:bg-zinc-900"
+ : "bg-zinc-100 text-zinc-400")
+ }
+ >
+ <Icon icon={isLast ? SentIcon : ArrowRight01Icon} size={15} />
+ </button>
+ </div>
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ExpertOnboardingCard/PendingOnboardingContext.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ExpertOnboardingCard/PendingOnboardingContext.ts
new file mode 100644
index 0000000000..c56a0cdcaa
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ExpertOnboardingCard/PendingOnboardingContext.ts
@@ -0,0 +1,8 @@
+"use client";
+
+import { createContext } from "react";
+
+/** Tool-call id of the onboarding card the session is still waiting on,
+ * provided by ChatContainer. `null` — the default on surfaces that don't
+ * provide it, such as the share viewer — renders every card as history. */
+export const PendingOnboardingContext = createContext<string | null>(null);
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ExpertOnboardingCard/__tests__/ExpertOnboardingCard.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ExpertOnboardingCard/__tests__/ExpertOnboardingCard.test.tsx
new file mode 100644
index 0000000000..87164e4dd7
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ExpertOnboardingCard/__tests__/ExpertOnboardingCard.test.tsx
@@ -0,0 +1,246 @@
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from "@testing-library/react";
+import type { ToolUIPart } from "ai";
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { CopilotChatActionsProvider } from "../../CopilotChatActionsProvider/CopilotChatActionsProvider";
+import { ExpertOnboardingCard } from "../ExpertOnboardingCard";
+import { PendingOnboardingContext } from "../PendingOnboardingContext";
+
+const EXPERT_ID = "1a5b1a10-6d10-4d7c-9d0d-2f6f1d9c0f11";
+const CALL_ID = "call-onboarding-1";
+
+vi.mock("../../../useExpertMap", () => ({
+ useExpertMap: () => ({
+ expertsById: new Map([
+ [
+ EXPERT_ID,
+ {
+ id: EXPERT_ID,
+ name: "Ada",
+ avatarUrl: null,
+ role: "Head of Marketing",
+ isArchived: false,
+ readOnlyReason: null,
+ },
+ ],
+ ]),
+ }),
+}));
+
+afterEach(cleanup);
+
+function onboardingPart(overrides: Record<string, unknown> = {}): ToolUIPart {
+ return {
+ type: "tool-expert_onboarding",
+ toolCallId: CALL_ID,
+ state: "output-available",
+ input: {},
+ output: {
+ type: "expert_onboarding",
+ message: "Which outcome first?; Which services?",
+ session_id: "session-1",
+ expert_id: EXPERT_ID,
+ greeting: "Hi, I'm Ada — good to be working with you.",
+ steps: [
+ {
+ question: "Which outcome should I start with?",
+ keyword: "outcome",
+ options: ["Social listening", "Campaign briefs"],
+ },
+ {
+ question: "Which service should I be connected to?",
+ keyword: "service",
+ options: ["Linear", "GitHub"],
+ },
+ ],
+ ...overrides,
+ },
+ } as unknown as ToolUIPart;
+}
+
+function createSendMock() {
+ return vi.fn<(message: string) => Promise<void>>();
+}
+
+function renderCard(
+ part: ToolUIPart,
+ pendingCallId: string | null = CALL_ID,
+ onSend = createSendMock(),
+) {
+ render(
+ <CopilotChatActionsProvider onSend={onSend}>
+ <PendingOnboardingContext.Provider value={pendingCallId}>
+ <ExpertOnboardingCard part={part} />
+ </PendingOnboardingContext.Provider>
+ </CopilotChatActionsProvider>,
+ );
+ return { onSend };
+}
+
+function actionButton(label: string): HTMLButtonElement {
+ return screen.getByLabelText(label) as HTMLButtonElement;
+}
+
+describe("ExpertOnboardingCard", () => {
+ it("greets the user under the expert's own identity", () => {
+ renderCard(onboardingPart());
+
+ expect(screen.getByText("Ada")).toBeDefined();
+ expect(screen.getByText("Head of Marketing")).toBeDefined();
+ expect(
+ screen.getByText("Hi, I'm Ada — good to be working with you."),
+ ).toBeDefined();
+ });
+
+ it("shows one question at a time with tappable options", () => {
+ renderCard(onboardingPart());
+
+ expect(
+ screen.getByText("Which outcome should I start with?"),
+ ).toBeDefined();
+ expect(
+ screen.queryByText("Which service should I be connected to?"),
+ ).toBeNull();
+ expect(screen.getAllByRole("radio")).toHaveLength(2);
+ expect(screen.getByText("1 of 2")).toBeDefined();
+ });
+
+ it("moves on by itself when an option is tapped", () => {
+ renderCard(onboardingPart());
+
+ expect(actionButton("Next question").disabled).toBe(true);
+
+ fireEvent.click(screen.getByRole("radio", { name: /Social listening/ }));
+
+ // A tap is the whole answer, so the tap is also the page turn.
+ expect(screen.getByText("2 of 2")).toBeDefined();
+ expect(
+ screen.getByText("Which service should I be connected to?"),
+ ).toBeDefined();
+ });
+
+ it("will not send until the last step is answered", () => {
+ renderCard(onboardingPart());
+
+ fireEvent.click(screen.getByRole("radio", { name: /Social listening/ }));
+
+ expect(actionButton("Send answers").disabled).toBe(true);
+
+ fireEvent.click(screen.getByRole("radio", { name: /Linear/ }));
+
+ expect(actionButton("Send answers").disabled).toBe(false);
+ });
+
+ it("keeps the Next button for a typed answer, which cannot auto-advance", () => {
+ renderCard(onboardingPart());
+
+ fireEvent.click(screen.getByRole("button", { name: /Type something/ }));
+ const textarea = screen.getByRole("textbox");
+
+ expect(actionButton("Next question").disabled).toBe(true);
+
+ fireEvent.change(textarea, { target: { value: "Competitor tracking" } });
+
+ // Still on step one — there is no single moment a typed answer is done.
+ expect(screen.getByText("1 of 2")).toBeDefined();
+ fireEvent.click(actionButton("Next question"));
+ expect(screen.getByText("2 of 2")).toBeDefined();
+ });
+
+ it("sends every answer as one message on the last step", () => {
+ const { onSend } = renderCard(onboardingPart());
+
+ fireEvent.click(screen.getByRole("radio", { name: /Social listening/ }));
+
+ expect(screen.getByText("2 of 2")).toBeDefined();
+ fireEvent.click(screen.getByRole("radio", { name: /Linear/ }));
+ fireEvent.click(actionButton("Send answers"));
+
+ expect(onSend).toHaveBeenCalledTimes(1);
+ const message = onSend.mock.calls[0][0] as string;
+ expect(message).toContain("Which outcome should I start with?");
+ expect(message).toContain("Social listening");
+ expect(message).toContain("Which service should I be connected to?");
+ expect(message).toContain("Linear");
+ });
+
+ it("lets the user step back to change an answer", () => {
+ renderCard(onboardingPart());
+
+ fireEvent.click(screen.getByRole("radio", { name: /Social listening/ }));
+ fireEvent.click(actionButton("Previous question"));
+
+ expect(screen.getByText("1 of 2")).toBeDefined();
+ expect(
+ screen
+ .getByRole("radio", { name: /Social listening/ })
+ .getAttribute("aria-checked"),
+ ).toBe("true");
+ });
+
+ it("skips the whole card without answering", () => {
+ const { onSend } = renderCard(onboardingPart());
+
+ fireEvent.click(screen.getByRole("button", { name: "Skip" }));
+
+ expect(onSend).toHaveBeenCalledWith(
+ "Let's skip the setup questions for now.",
+ );
+ });
+
+ it("renders as history once the thread has moved past it", () => {
+ renderCard(onboardingPart(), null);
+
+ expect(screen.queryByRole("radio")).toBeNull();
+ expect(screen.queryByRole("button", { name: "Skip" })).toBeNull();
+ expect(screen.getByText(/Setup questions from/)).toBeDefined();
+ });
+
+ it("shows a pending line while the card is still streaming", () => {
+ const part = {
+ type: "tool-expert_onboarding",
+ toolCallId: CALL_ID,
+ state: "input-streaming",
+ input: {},
+ } as unknown as ToolUIPart;
+
+ renderCard(part);
+
+ expect(screen.queryByRole("radio")).toBeNull();
+ });
+
+ it("reports a settled call whose output carries no usable steps", () => {
+ renderCard(onboardingPart({ steps: [] }));
+
+ expect(screen.queryByRole("radio")).toBeNull();
+ expect(screen.queryByText("Ada")).toBeNull();
+ // The call is over, so this must not sit on the loading line forever.
+ expect(screen.getByText(/Couldn.t open the setup questions/)).toBeDefined();
+ });
+
+ it("keeps the answers on screen when the send fails", async () => {
+ const onSend = createSendMock();
+ onSend.mockRejectedValue(new Error("no session"));
+ renderCard(onboardingPart(), CALL_ID, onSend);
+
+ fireEvent.click(screen.getByRole("radio", { name: /Social listening/ }));
+ fireEvent.click(screen.getByRole("radio", { name: /Linear/ }));
+ fireEvent.click(actionButton("Send answers"));
+
+ await waitFor(() => expect(onSend).toHaveBeenCalledTimes(1));
+ // Still the live form, with the answer intact — not a settled history row.
+ await waitFor(() =>
+ expect(
+ screen
+ .getByRole("radio", { name: /Linear/ })
+ .getAttribute("aria-checked"),
+ ).toBe("true"),
+ );
+ expect(screen.queryByText(/Setup questions from/)).toBeNull();
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ExpertOnboardingCard/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ExpertOnboardingCard/helpers.ts
new file mode 100644
index 0000000000..9001086c09
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ExpertOnboardingCard/helpers.ts
@@ -0,0 +1,111 @@
+import type { ExpertOnboardingStep as ExpertOnboardingStepPayload } from "@/app/api/__generated__/models/expertOnboardingStep";
+import { ResponseType } from "@/app/api/__generated__/models/responseType";
+import type { ToolUIPart, UIDataTypes, UIMessage, UITools } from "ai";
+import type { ClarifyingQuestion } from "../../tools/clarifying-questions";
+
+export const EXPERT_ONBOARDING_PART_TYPE = "tool-expert_onboarding";
+
+/** A step once parsed: same contract the backend publishes, except `options`
+ * has been normalised to always be an array. Derived from the generated
+ * model so the two cannot drift. */
+export type ExpertOnboardingStep = Required<ExpertOnboardingStepPayload>;
+
+export interface ExpertOnboardingOutput {
+ expertId: string | null;
+ greeting: string;
+ steps: ExpertOnboardingStep[];
+}
+
+function toRecord(value: unknown): Record<string, unknown> | null {
+ if (typeof value === "string") {
+ try {
+ value = JSON.parse(value) as unknown;
+ } catch {
+ return null;
+ }
+ }
+ return value && typeof value === "object" && !Array.isArray(value)
+ ? (value as Record<string, unknown>)
+ : null;
+}
+
+function toStep(value: unknown, index: number): ExpertOnboardingStep | null {
+ const record = toRecord(value);
+ const question = record?.question;
+ if (typeof question !== "string" || !question.trim()) return null;
+ const keyword =
+ typeof record?.keyword === "string" && record.keyword.trim()
+ ? record.keyword.trim()
+ : `step-${index}`;
+ const options = Array.isArray(record?.options)
+ ? record.options.flatMap((option) =>
+ typeof option === "string" && option.trim() ? [option.trim()] : [],
+ )
+ : [];
+ return { question: question.trim(), keyword, options };
+}
+
+export function parseExpertOnboarding(
+ part: ToolUIPart,
+): ExpertOnboardingOutput | null {
+ const output = toRecord(part.output);
+ if (!output || output.type !== ResponseType.expert_onboarding) return null;
+ const steps = Array.isArray(output.steps)
+ ? output.steps.flatMap((step, index) => {
+ const parsed = toStep(step, index);
+ return parsed ? [parsed] : [];
+ })
+ : [];
+ if (steps.length === 0) return null;
+ return {
+ expertId: typeof output.expert_id === "string" ? output.expert_id : null,
+ greeting: typeof output.greeting === "string" ? output.greeting : "",
+ steps,
+ };
+}
+
+/** The card reuses the tool chain's answer field, which speaks
+ * `ClarifyingQuestion`. `example` stays empty: the field only shows it when
+ * a question has no options, and an onboarding step without options is an
+ * open "anything else?" that reads better with the plain placeholder. */
+export function toClarifyingQuestion(
+ step: ExpertOnboardingStep,
+): ClarifyingQuestion {
+ return step.options.length > 0
+ ? { question: step.question, keyword: step.keyword, options: step.options }
+ : { question: step.question, keyword: step.keyword };
+}
+
+export function buildOnboardingAnswersMessage(
+ steps: ExpertOnboardingStep[],
+ answers: Record<string, string>,
+): string {
+ const body = steps
+ .flatMap((step) => {
+ const answer = (answers[step.keyword] ?? "").trim();
+ return answer ? [`> ${step.question}\n\n${answer}`] : [];
+ })
+ .join("\n\n");
+ return `**Here are my answers:**\n\n${body}\n\nPlease proceed.`;
+}
+
+type Message = UIMessage<unknown, UIDataTypes, UITools>;
+
+/** Tool-call id of the onboarding card still waiting on the user.
+ *
+ * Same rule as the clarifying-question dock: a card is live only while the
+ * assistant message that opened it is the last one. Any user reply — the
+ * answers, a skip, or an unrelated request — settles it, so a reloaded
+ * thread renders history rather than a form that would send the answers
+ * twice. */
+export function getPendingOnboardingCallId(messages: Message[]): string | null {
+ const last = messages[messages.length - 1];
+ if (!last || last.role !== "assistant") return null;
+ for (const part of last.parts) {
+ if (part.type !== EXPERT_ONBOARDING_PART_TYPE) continue;
+ const tool = part as ToolUIPart;
+ if (tool.state !== "output-available") continue;
+ if (parseExpertOnboarding(tool)) return tool.toolCallId;
+ }
+ return null;
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ExpertOnboardingCard/useExpertOnboardingCard.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ExpertOnboardingCard/useExpertOnboardingCard.ts
new file mode 100644
index 0000000000..6b311f7829
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ExpertOnboardingCard/useExpertOnboardingCard.ts
@@ -0,0 +1,92 @@
+"use client";
+
+import { useState } from "react";
+import { useCopilotChatActions } from "../CopilotChatActionsProvider/useCopilotChatActions";
+import {
+ buildOnboardingAnswersMessage,
+ type ExpertOnboardingStep,
+} from "./helpers";
+
+const SKIP_MESSAGE = "Let's skip the setup questions for now.";
+
+interface Args {
+ steps: ExpertOnboardingStep[];
+ isLive: boolean;
+}
+
+export function useExpertOnboardingCard({ steps, isLive }: Args) {
+ const { onSend } = useCopilotChatActions();
+ const [step, setStep] = useState(0);
+ const [answers, setAnswers] = useState<Record<string, string>>({});
+ const [isSent, setIsSent] = useState(false);
+ const [isSending, setIsSending] = useState(false);
+
+ const current = Math.min(step, steps.length - 1);
+ const currentStep = steps[current];
+ const value = answers[currentStep.keyword] ?? "";
+ const isAnswered = value.trim().length > 0;
+ const isLast = current === steps.length - 1;
+ // A card the thread has moved past renders as history, whether the answers
+ // went out from this tab or from another one.
+ const isDone = isSent || !isLive;
+
+ function setAnswer(next: string) {
+ setAnswers((previous) => ({ ...previous, [currentStep.keyword]: next }));
+ }
+
+ // A tap on an option is the whole answer, so the pager moves on by itself;
+ // the last question keeps the send button as its explicit final step.
+ function pickAnswer(next: string) {
+ setAnswer(next);
+ if (!isLast) setStep(current + 1);
+ }
+
+ function goBack() {
+ setStep(Math.max(current - 1, 0));
+ }
+
+ // Settling the card is what removes the user's only copy of their answers,
+ // so it waits for the send to resolve. A rejected send (no session, dispatch
+ // failure) leaves the form exactly as it was, still submittable.
+ async function send(message: string) {
+ if (isSending) return;
+ setIsSending(true);
+ try {
+ await onSend(message);
+ setIsSent(true);
+ } catch {
+ setIsSent(false);
+ } finally {
+ setIsSending(false);
+ }
+ }
+
+ function advance() {
+ if (!isAnswered) return;
+ if (!isLast) {
+ setStep(current + 1);
+ return;
+ }
+ void send(buildOnboardingAnswersMessage(steps, answers));
+ }
+
+ function skip() {
+ void send(SKIP_MESSAGE);
+ }
+
+ return {
+ answers,
+ current,
+ currentStep,
+ isAnswered,
+ isDone,
+ isLast,
+ isSending,
+ value,
+ advance,
+ goBack,
+ pickAnswer,
+ setAnswer,
+ skip,
+ };
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolChain/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolChain/helpers.ts
index 060b580512..d07fbb2979 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolChain/helpers.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolChain/helpers.ts
@@ -1,6 +1,7 @@
import type { ToolUIPart } from "ai";
import { getBlockDisplayName } from "../../helpers/toolDisplay";
import type { MessagePart } from "../ChatMessagesContainer/helpers";
+import { EXPERT_ONBOARDING_PART_TYPE } from "../ExpertOnboardingCard/helpers";
import {
extractToolName,
getAnimationText,
@@ -165,7 +166,11 @@ export function isExpertChangePart(part: MessagePart): boolean {
}
export function isChainPart(part: MessagePart): boolean {
- if (part.type === COMPACTION_PART_TYPE || isExpertChangePart(part)) {
+ if (
+ part.type === COMPACTION_PART_TYPE ||
+ part.type === EXPERT_ONBOARDING_PART_TYPE ||
+ isExpertChangePart(part)
+ ) {
return false;
}
return part.type === "reasoning" || part.type.startsWith("tool-");
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/expertKickoff.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/expertKickoff.ts
index 8875ef1b40..50cd9100ee 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/expertKickoff.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/expertKickoff.ts
@@ -7,15 +7,19 @@ const LEGACY_MARKER_PATTERN =
/^\[\[EXPERT_KICKOFF:([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\]\](?:\n\n)?/i;
const PENDING_TTL_MS = 2 * 60 * 1000;
-// Never instruct the expert to start a workflow here: one click on Hire ran a
-// Gmail send (SECRT-2622). Any redesign of this message stays ask-first.
+// A hire's first turn is an intake, not a first job: the expert says hello and
+// asks what the user actually wants before touching anything. Never instruct it
+// to start a workflow here — one click on Hire ran a Gmail send (SECRT-2622) —
+// so any redesign of this message, including this one, stays ask-first.
const KICKOFF_PROMPT =
- "You were just hired. Introduce yourself in 2-3 sentences in your voice. " +
- "If you have installed workflows, state the day-one job they support and " +
- "ask which one to start. If no workflow is installed, explain the outcomes " +
- "you can help with and ask which one to start. If required access or " +
- "credentials are missing, ask for exactly the one connection the next job " +
- "needs and why. Never pretend a run succeeded.";
+ "You were just hired. Call expert_onboarding once, and nothing else, this " +
+ "turn: a greeting of 1-2 sentences introducing yourself in your voice, " +
+ "then 3-5 questions the user can answer by tapping. Draw the questions and " +
+ "their options from your own role and skills and from the workflows " +
+ "installed on you — ask which outcome to start with, and which of the " +
+ "services your work depends on you should be connected to, naming the real " +
+ "providers rather than asking in the abstract. Do not run a workflow, " +
+ "create a schedule, or start any other work before the answers come back.";
export interface ExpertKickoffMetadata {
kind: typeof EXPERT_KICKOFF_KIND;
@@ -119,21 +123,12 @@ export function shouldClearKickoffParam(
return !isExpertsEnabled || (hasExpertsSettled && expertId === null);
}
-// The kickoff prompt reads in the thread like any other opening message, so a
-// freshly raised expert answers something visible rather than thin air. Older
-// threads carry an inline marker that was never meant to be read.
-export function revealKickoffMessages<T extends UIMessage>(messages: T[]): T[] {
- return messages.map((message) => {
- if (!isKickoffMessage(message)) return message;
- return {
- ...message,
- parts: message.parts.map((part) =>
- part.type === "text"
- ? { ...part, text: stripLegacyKickoffMarker(part.text) }
- : part,
- ),
- };
- });
+// The kickoff prompt is a control turn the client sends on the user's behalf.
+// It reads as an instruction, not as something the user typed, so the thread
+// never shows it. The backend marks the persisted row hidden for the same
+// reason.
+export function hideKickoffMessages<T extends UIMessage>(messages: T[]): T[] {
+ return messages.filter((message) => !isKickoffMessage(message));
}
export function kickoffStorageKey(userId: string, expertId: string): string {
diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.json
index 4aa64ce467..d0cfdbca67 100644
--- a/autogpt_platform/frontend/src/app/api/openapi.json
+++ b/autogpt_platform/frontend/src/app/api/openapi.json
@@ -3914,7 +3914,10 @@
"$ref": "#/components/schemas/MemoryForgetConfirmResponse"
},
{ "$ref": "#/components/schemas/TodoWriteResponse" },
- { "$ref": "#/components/schemas/ExpertSoulUpdatedResponse" }
+ {
+ "$ref": "#/components/schemas/ExpertSoulUpdatedResponse"
+ },
+ { "$ref": "#/components/schemas/ExpertOnboardingResponse" }
],
"title": "Response Getv2[Dummy] Tool Response Type Export For Codegen"
}
@@ -20803,6 +20806,45 @@
"required": ["id", "name", "avatar_url", "role", "is_archived"],
"title": "ExpertIdentity"
},
+ "ExpertOnboardingResponse": {
+ "properties": {
+ "type": {
+ "$ref": "#/components/schemas/ResponseType",
+ "default": "expert_onboarding"
+ },
+ "message": { "type": "string", "title": "Message" },
+ "session_id": {
+ "anyOf": [{ "type": "string" }, { "type": "null" }],
+ "title": "Session Id"
+ },
+ "expert_id": { "type": "string", "title": "Expert Id" },
+ "greeting": { "type": "string", "title": "Greeting" },
+ "steps": {
+ "items": { "$ref": "#/components/schemas/ExpertOnboardingStep" },
+ "type": "array",
+ "title": "Steps"
+ }
+ },
+ "type": "object",
+ "required": ["message", "expert_id", "greeting"],
+ "title": "ExpertOnboardingResponse",
+ "description": "The intake card a freshly hired expert opens its first turn with."
+ },
+ "ExpertOnboardingStep": {
+ "properties": {
+ "question": { "type": "string", "title": "Question" },
+ "keyword": { "type": "string", "title": "Keyword" },
+ "options": {
+ "items": { "type": "string" },
+ "type": "array",
+ "title": "Options"
+ }
+ },
+ "type": "object",
+ "required": ["question", "keyword"],
+ "title": "ExpertOnboardingStep",
+ "description": "One step of a freshly hired expert's intake card."
+ },
"ExpertPod": {
"properties": {
"id": { "type": "string", "title": "Id" },
@@ -26772,7 +26814,8 @@
"expert_change_applied",
"team_roster",
"expert_chat_list",
- "expert_chat_transcript"
+ "expert_chat_transcript",
+ "expert_onboarding"
],
"title": "ResponseType",
"description": "Types of tool responses."
diff --git a/docs/integrations/block-integrations/misc.md b/docs/integrations/block-integrations/misc.md
index ce0bd5e9d4..c0e9900148 100644
--- a/docs/integrations/block-integrations/misc.md
+++ b/docs/integrations/block-integrations/misc.md
@@ -59,7 +59,7 @@ Tool and block identifiers provided in `tools` and `blocks` are validated at run
| transport | Run on platform credits, or on your connected ChatGPT subscription if supported by your plan. | "platform" \| "codex_app_server" | No |
| session_id | Session ID to continue an existing autopilot conversation. Leave empty to start a new session. Use the session_id output from a previous run to continue. | str | No |
| max_recursion_depth | Maximum nesting depth when the autopilot calls this block recursively (sub-agent pattern). Prevents infinite loops. | int | No |
-| tools | Tool names to filter. Works with tools_exclude to form an allow-list or deny-list. Leave empty to apply no tool filter. | List["add_understanding" \| "ask_question" \| "bash_exec" \| "browser_act" \| "browser_navigate" \| "browser_screenshot" \| "confirm_expert_change" \| "confirm_expert_soul_update" \| "connect_integration" \| "continue_run_block" \| "create_agent" \| "create_feature_request" \| "create_folder" \| "customize_agent" \| "decompose_goal" \| "delegate_to_expert" \| "delete_folder" \| "delete_preset" \| "delete_schedule" \| "delete_skill" \| "delete_workspace_file" \| "edit_agent" \| "enter_agent_building_mode" \| "find_agent" \| "find_block" \| "find_library_agent" \| "fix_agent_graph" \| "get_agent_building_guide" \| "get_doc_page" \| "get_mcp_guide" \| "get_platform_info" \| "get_sub_session_result" \| "handoff_to_expert" \| "hire_expert" \| "list_agent_triggers" \| "list_chat_platform_channels" \| "list_expert_chats" \| "list_folders" \| "list_presets" \| "list_schedules" \| "list_skills" \| "list_team" \| "list_workspace_files" \| "memory_forget_confirm" \| "memory_forget_search" \| "memory_search" \| "memory_store" \| "move_agents_to_folder" \| "move_folder" \| "post_to_chat_platform" \| "raise_expert" \| "read_expert_chat" \| "read_skill" \| "read_workspace_file" \| "run_agent" \| "run_block" \| "run_mcp_tool" \| "run_sub_session" \| "schedule_followup" \| "search_docs" \| "search_feature_requests" \| "setup_agent_webhook_trigger" \| "store_skill" \| "update_expert" \| "update_expert_soul" \| "update_folder" \| "update_preset" \| "validate_agent_graph" \| "view_agent_output" \| "web_fetch" \| "web_search" \| "write_workspace_file" \| "Agent" \| "Edit" \| "Glob" \| "Grep" \| "Read" \| "Task" \| "TodoWrite" \| "WebSearch" \| "Write"] | No |
+| tools | Tool names to filter. Works with tools_exclude to form an allow-list or deny-list. Leave empty to apply no tool filter. | List["add_understanding" \| "ask_question" \| "bash_exec" \| "browser_act" \| "browser_navigate" \| "browser_screenshot" \| "confirm_expert_change" \| "confirm_expert_soul_update" \| "connect_integration" \| "continue_run_block" \| "create_agent" \| "create_feature_request" \| "create_folder" \| "customize_agent" \| "decompose_goal" \| "delegate_to_expert" \| "delete_folder" \| "delete_preset" \| "delete_schedule" \| "delete_skill" \| "delete_workspace_file" \| "edit_agent" \| "enter_agent_building_mode" \| "expert_onboarding" \| "find_agent" \| "find_block" \| "find_library_agent" \| "fix_agent_graph" \| "get_agent_building_guide" \| "get_doc_page" \| "get_mcp_guide" \| "get_platform_info" \| "get_sub_session_result" \| "handoff_to_expert" \| "hire_expert" \| "list_agent_triggers" \| "list_chat_platform_channels" \| "list_expert_chats" \| "list_folders" \| "list_presets" \| "list_schedules" \| "list_skills" \| "list_team" \| "list_workspace_files" \| "memory_forget_confirm" \| "memory_forget_search" \| "memory_search" \| "memory_store" \| "move_agents_to_folder" \| "move_folder" \| "post_to_chat_platform" \| "raise_expert" \| "read_expert_chat" \| "read_skill" \| "read_workspace_file" \| "run_agent" \| "run_block" \| "run_mcp_tool" \| "run_sub_session" \| "schedule_followup" \| "search_docs" \| "search_feature_requests" \| "setup_agent_webhook_trigger" \| "store_skill" \| "update_expert" \| "update_expert_soul" \| "update_folder" \| "update_preset" \| "validate_agent_graph" \| "view_agent_output" \| "web_fetch" \| "web_search" \| "write_workspace_file" \| "Agent" \| "Edit" \| "Glob" \| "Grep" \| "Read" \| "Task" \| "TodoWrite" \| "WebSearch" \| "Write"] | No |
| tools_exclude | Controls how the 'tools' list is interpreted. True (default): 'tools' is a deny-list — listed tools are blocked, all others are allowed. An empty 'tools' list means allow everything. False: 'tools' is an allow-list — only listed tools are permitted. | bool | No |
| blocks | Block identifiers to filter when the copilot uses run_block. Each entry can be: a block name (e.g. 'HTTP Request'), a full block UUID, or the first 8 hex characters of the UUID (e.g. 'c069dc6b'). Works with blocks_exclude. Leave empty to apply no block filter. | List[str] | No |
| blocks_exclude | Controls how the 'blocks' list is interpreted. True (default): 'blocks' is a deny-list — listed blocks are blocked, all others are allowed. An empty 'blocks' list means allow everything. False: 'blocks' is an allow-list — only listed blocks are permitted. | bool | No |