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): expert profiles show only the real Skills a hire comes with (#14511)

Reinier van der Leer9ca92f55b825
diff --git a/autogpt_platform/backend/backend/api/features/experts/experts_db.py b/autogpt_platform/backend/backend/api/features/experts/experts_db.py
index 2113756ae8..dcf5a2a449 100644
--- a/autogpt_platform/backend/backend/api/features/experts/experts_db.py
+++ b/autogpt_platform/backend/backend/api/features/experts/experts_db.py
@@ -37,6 +37,7 @@ from backend.api.features.experts.models import (
Expert,
ExpertActivity,
ExpertActivityDay,
+ ExpertBundledSkill,
ExpertIdentity,
ExpertPod,
ExpertRun,
@@ -44,6 +45,7 @@ from backend.api.features.experts.models import (
ExpertRunStatus,
ExpertSoulFieldsPatch,
ExpertSoulUpdate,
+ ExpertTemplate,
ExpertWorkflowRef,
HireResult,
RaiseAttachment,
@@ -58,6 +60,7 @@ from backend.api.features.experts.workflow_chain import (
from backend.api.features.library import db as library_db
from backend.api.features.library import model as library_model
from backend.api.features.orgs.db import get_user_default_team
+from backend.api.features.store import skill_db
from backend.api.features.store.categories import category_match_values
from backend.blocks import get_output_block_ids
from backend.copilot.briefing.outcome import DEFAULT_AGENT_NAME, run_link
@@ -91,6 +94,7 @@ from backend.util.exceptions import (
ExpertWriteNotReadableError,
NotFoundError,
)
+from backend.util.feature_flag import Flag, is_feature_enabled
from backend.util.timezone_utils import get_user_timezone_or_utc
logger = logging.getLogger(__name__)
@@ -297,6 +301,46 @@ def _template_where(
return where
+async def with_bundled_skills(
+ templates: list[Expert], user_id: str | None
+) -> list[ExpertTemplate]:
+ """Attach to each template the live Skills Hub listings it bundles —
+ exactly what ``hire_expert`` installs."""
+ bundled = await _live_bundled_skills(user_id, [t.id for t in templates])
+ return [
+ ExpertTemplate(
+ **template.model_dump(), bundled_skills=bundled.get(template.id, [])
+ )
+ for template in templates
+ ]
+
+
+async def _live_bundled_skills(
+ user_id: str | None, template_ids: list[str]
+) -> dict[str, list[ExpertBundledSkill]]:
+ """Per template id, the live Hub listings it bundles, in roster order."""
+ # The Hub routes' key, so nothing is linked or installed that would 404.
+ if not await is_feature_enabled(Flag.SKILLS_HUB, user_id or "anonymous"):
+ return {}
+ rows = await prisma.models.ExpertSkillListing.prisma().find_many(
+ where={"expertId": {"in": template_ids}}, order={"position": "asc"}
+ )
+ live = await skill_db.get_live_skills(sorted({r.skillListingId for r in rows}))
+ return {
+ template_id: [
+ ExpertBundledSkill(
+ id=row.skillListingId,
+ slug=skill.slug,
+ name=skill.name,
+ description=skill.description,
+ )
+ for row in rows
+ if row.expertId == template_id and (skill := live.get(row.skillListingId))
+ ]
+ for template_id in template_ids
+ }
+
+
# Ceiling on in-flight Redis reads inside ``_weekly_spends``. The roster is
# user-controlled and unbounded, so an uncapped ``gather`` would ask the shared
# Redis pool for one connection per hired expert on every team-page load.
@@ -814,7 +858,9 @@ async def hire_expert(user_id: str, template_id: str, name: str | None) -> HireR
"role": template.role,
"tagline": template.tagline,
"bio": template.bio,
- "skills": template.skills or [],
+ # The bundled installs below record each name, so the row lists only
+ # skills the hire actually owns.
+ "skills": [],
"categories": template.categories or [],
# No dayOne: it is the template's pre-hire promise, not the hire's.
"identity": template.identity,
@@ -841,6 +887,7 @@ async def hire_expert(user_id: str, template_id: str, name: str | None) -> HireR
return HireResult(expert=_to_model(expert), failed_preloads=[])
failed = await _install_preloads(expert.id, user_id, template.Workflows or [])
+ await _install_bundled_skills(user_id, expert.id, template.id)
hydrated = await prisma.models.Expert.prisma().find_unique(
where={"id": expert.id}, include=_WORKFLOW_INCLUDE
@@ -1598,6 +1645,26 @@ async def _install_preloads(
return failed
+async def _install_bundled_skills(
+ user_id: str, expert_id: str, template_id: str
+) -> None:
+ """Install the Hub skills the template bundles into the new expert's folder.
+
+ Each install records its name on the row; a failed one is logged and
+ leaves no name, so the hire never lists a skill it does not have.
+ """
+ bundled = await _live_bundled_skills(user_id, [template_id])
+ for skill in bundled.get(template_id, []):
+ try:
+ await skill_db.install_marketplace_skill(
+ user_id, skill.slug, expert_id=expert_id
+ )
+ except Exception:
+ logger.exception(
+ f"Failed to install bundled skill {skill.slug!r} on expert #{expert_id}"
+ )
+
+
async def install_workflow(
user_id: str,
expert_id: str,
diff --git a/autogpt_platform/backend/backend/api/features/experts/experts_db_test.py b/autogpt_platform/backend/backend/api/features/experts/experts_db_test.py
index 171a587f9f..5c642ee40b 100644
--- a/autogpt_platform/backend/backend/api/features/experts/experts_db_test.py
+++ b/autogpt_platform/backend/backend/api/features/experts/experts_db_test.py
@@ -18,6 +18,7 @@ import pytest
import backend.api.features.store.model as store_model
from backend.api.features.experts import experts_db, scheduling, seed
from backend.api.features.experts.models import (
+ ExpertBundledSkill,
ExpertDayOneItem,
ExpertSoulFieldsPatch,
ExpertSoulUpdate,
@@ -29,10 +30,12 @@ from backend.api.features.experts.models import (
from backend.api.features.library import db as library_db
from backend.api.features.library import model as library_model
from backend.api.features.store.categories import StoreCategory
+from backend.api.features.store.skill_db_test import _make_listing
from backend.api.model import CreateGraph
from backend.blocks.io import AgentInputBlock
from backend.copilot.model import create_chat_session
-from backend.copilot.tools.skills_test import _FakeWorkspaceManager
+from backend.copilot.tools.skills import _NAME_RE, read_user_skill_with_body
+from backend.copilot.tools.skills_test import _FakeWorkspaceManager, _patch_skills_path
from backend.data.db import prisma as db_client
from backend.data.graph import Graph, GraphSettings, Node
from backend.data.model import User
@@ -272,8 +275,9 @@ async def _seed_template(
name: str,
preload_listings: list[str],
preload_crons: dict[str, str] | None = None,
+ bundled: list[str] | None = None,
) -> prisma.models.Expert:
- """Create an Expert roster template plus ExpertWorkflow preload rows.
+ """Create an Expert roster template plus its preload and bundled-skill rows.
The stored name gets a unique suffix so ad-hoc test templates never
collide with seed.ROSTER's real roster names — seed._upsert_template
@@ -296,6 +300,14 @@ async def _seed_template(
"scheduleCron": (preload_crons or {}).get(slv_id),
}
)
+ for position, listing_id in enumerate(bundled or []):
+ await prisma.models.ExpertSkillListing.prisma().create(
+ data={
+ "expertId": template.id,
+ "skillListingId": listing_id,
+ "position": position,
+ }
+ )
return template
@@ -309,6 +321,111 @@ async def test_hire_expert_is_idempotent(server: SpinTestServer, test_user):
assert first.expert.source_template_id == template.id
+async def make_hub_listing(server: SpinTestServer):
+ made: list[prisma.models.SkillListing] = []
+
+ async def make() -> prisma.models.SkillListing:
+ made.append(await _make_listing(f"bundled-{uuid.uuid4().hex[:8]}"))
+ return made[-1]
+
+ yield make
+ for listing in made:
+ await prisma.models.SkillListingVersion.prisma().delete_many(
+ where={"skillListingId": listing.id}
+ )
+ await prisma.models.SkillListing.prisma().delete(where={"id": listing.id})
+
+
+async def hub_listing(make_hub_listing):
+ return await make_hub_listing()
+
+
+def skills_hub_on(monkeypatch):
+ monkeypatch.setattr(experts_db, "is_feature_enabled", AsyncMock(return_value=True))
+
+
[email protected](loop_scope="session")
+async def test_templates_resolve_bundled_skills_by_listing_id_in_roster_order(
+ server: SpinTestServer, hub_listing, make_hub_listing, skills_hub_on
+):
+ first = await make_hub_listing()
+ bundling = await _seed_template(
+ name="Maria", preload_listings=[], bundled=[first.id, hub_listing.id]
+ )
+ # A slug on the row is not a relation: only a listing id links a skill.
+ naming = await _seed_template(name="Max", preload_listings=[])
+ await prisma.models.Expert.prisma().update(
+ where={"id": naming.id}, data={"skills": [hub_listing.slug]}
+ )
+
+ linked, unlinked = await experts_db.with_bundled_skills(
+ [experts_db._to_model(bundling), experts_db._to_model(naming)], None
+ )
+
+ assert [skill.id for skill in linked.bundled_skills] == [first.id, hub_listing.id]
+ assert linked.bundled_skills[1] == ExpertBundledSkill(
+ id=hub_listing.id,
+ slug=hub_listing.slug,
+ name=hub_listing.slug.replace("-", " ").title(),
+ description=f"{hub_listing.slug} description",
+ )
+ assert unlinked.bundled_skills == []
+
+
[email protected](loop_scope="session")
+async def test_hire_installs_the_hub_skills_the_template_bundles(
+ server: SpinTestServer, test_user, hub_listing, skills_hub_on
+):
+ template = await _seed_template(
+ name="Maria", preload_listings=[], bundled=[hub_listing.id]
+ )
+
+ with _patch_skills_path(_FakeWorkspaceManager()):
+ hired = await experts_db.hire_expert(test_user.id, template.id, None)
+ installed = await read_user_skill_with_body(
+ test_user.id, hub_listing.slug, expert_id=hired.expert.id
+ )
+
+ assert installed is not None
+ assert installed.description == f"{hub_listing.slug} description"
+ assert hired.expert.skills == [hub_listing.slug]
+
+
[email protected](loop_scope="session")
+async def test_a_failed_bundled_skill_install_does_not_fail_the_hire(
+ server: SpinTestServer, test_user, hub_listing, skills_hub_on, monkeypatch
+):
+ install = AsyncMock(side_effect=RuntimeError("storage down"))
+ monkeypatch.setattr(experts_db.skill_db, "install_marketplace_skill", install)
+ template = await _seed_template(
+ name="Maria", preload_listings=[], bundled=[hub_listing.id]
+ )
+
+ hired = await experts_db.hire_expert(test_user.id, template.id, None)
+
+ install.assert_awaited_once()
+ assert hired.expert.skills == []
+
+
[email protected](loop_scope="session")
+async def test_hire_installs_nothing_while_the_hub_is_off(
+ server: SpinTestServer, test_user, hub_listing, monkeypatch
+):
+ monkeypatch.setattr(experts_db, "is_feature_enabled", AsyncMock(return_value=False))
+ install = AsyncMock()
+ monkeypatch.setattr(experts_db.skill_db, "install_marketplace_skill", install)
+ template = await _seed_template(
+ name="Maria", preload_listings=[], bundled=[hub_listing.id]
+ )
+
+ await experts_db.hire_expert(test_user.id, template.id, None)
+
+ install.assert_not_awaited()
+
+
@pytest.mark.asyncio(loop_scope="session")
async def test_hire_expert_is_idempotent_at_active_cap(server: SpinTestServer):
owner = await _create_seed_user()
@@ -2875,6 +2992,52 @@ def test_roster_assigns_two_to_four_workflows_with_one_scheduled_cadence():
assert scheduled == [EXPECTED_ROSTER_SCHEDULE]
+def test_roster_bundled_skills_are_hub_slugs():
+ for entry in seed.ROSTER:
+ for slug in entry["bundled_skills"]:
+ assert _NAME_RE.match(slug), (entry["name"], slug)
+
+
[email protected](loop_scope="session")
+async def test_seed_resolves_bundled_skill_slugs_to_listing_ids(
+ server: SpinTestServer, hub_listing, monkeypatch
+):
+ monkeypatch.setattr(
+ seed, "ROSTER", [{**seed.ROSTER[0], "bundled_skills": [hub_listing.slug]}]
+ )
+ template = await _seed_template(name="Maria", preload_listings=[])
+
+ resolved = await seed._resolve_roster_skills()
+ await seed._sync_bundled_skills(template.id, [resolved[hub_listing.slug]])
+ rows = await prisma.models.ExpertSkillListing.prisma().find_many(
+ where={"expertId": template.id}
+ )
+ assert [row.skillListingId for row in rows] == [hub_listing.id]
+
+ await seed._sync_bundled_skills(template.id, [])
+ remaining = await prisma.models.ExpertSkillListing.prisma().count(
+ where={"expertId": template.id}
+ )
+ assert remaining == 0
+
+
[email protected](loop_scope="session")
+async def test_seed_roster_rejects_unknown_bundled_skills_before_template_mutation(
+ server: SpinTestServer, monkeypatch: pytest.MonkeyPatch
+):
+ monkeypatch.setattr(seed, "_resolve_roster_preloads", AsyncMock(return_value={}))
+ monkeypatch.setattr(
+ seed, "ROSTER", [{**seed.ROSTER[0], "bundled_skills": ["no-such-hub-skill"]}]
+ )
+ upsert = AsyncMock()
+ monkeypatch.setattr(seed, "_upsert_template", upsert)
+
+ with pytest.raises(RuntimeError, match="no-such-hub-skill"):
+ await seed.seed_roster()
+
+ upsert.assert_not_awaited()
+
+
def test_roster_day_one_is_marias_three_rows_and_hidden_for_the_rest():
day_one = {entry["name"]: entry["day_one"] for entry in seed.ROSTER}
@@ -3401,7 +3564,7 @@ async def test_sync_preloads_updates_template_cadence(server: SpinTestServer):
"tagline": "",
"avatar_url": None,
"bio": "",
- "skills": [],
+ "bundled_skills": [],
"categories": [],
"identity": template.identity,
"preloads": [{"slug": listing.slug, "cron": "40 7 * * *"}],
@@ -3448,7 +3611,7 @@ async def test_seed_backfills_presentation_fields_onto_hired_copies(
"tagline": "Refreshed tagline",
"avatar_url": "/experts/maria.svg",
"bio": "Maria is a senior marketing strategist.",
- "skills": ["Content strategy", "SEO writing"],
+ "bundled_skills": [],
"categories": ["marketing"],
"identity": template.identity,
"voice_preferences": "Clear and confident.",
diff --git a/autogpt_platform/backend/backend/api/features/experts/models.py b/autogpt_platform/backend/backend/api/features/experts/models.py
index cebefcf574..9de2bdd540 100644
--- a/autogpt_platform/backend/backend/api/features/experts/models.py
+++ b/autogpt_platform/backend/backend/api/features/experts/models.py
@@ -241,6 +241,22 @@ class Expert(BaseModel):
pod_id: str | None = None
+class ExpertBundledSkill(BaseModel):
+ """A live Skills Hub listing a roster template comes with."""
+
+ id: str
+ slug: str
+ name: str
+ description: str
+
+
+class ExpertTemplate(Expert):
+ """A roster template as the marketplace shows it."""
+
+ # What a hire gets installed, in roster order; a template's `skills` is unused.
+ bundled_skills: list[ExpertBundledSkill] = Field(default_factory=list)
+
+
# Membership is deliberately not embedded: clients already hold the expert
# list and each Expert carries `pod_id`, so the roster groups client-side.
class ExpertPod(BaseModel):
diff --git a/autogpt_platform/backend/backend/api/features/experts/routes.py b/autogpt_platform/backend/backend/api/features/experts/routes.py
index cb7ade46a9..edc4b16c49 100644
--- a/autogpt_platform/backend/backend/api/features/experts/routes.py
+++ b/autogpt_platform/backend/backend/api/features/experts/routes.py
@@ -25,6 +25,7 @@ from backend.api.features.experts.models import (
ExpertSetupItem,
ExpertSkillsUpdate,
ExpertSoulUpdate,
+ ExpertTemplate,
ExpertWorkflowRef,
HireResult,
RaiseAttachment,
@@ -131,12 +132,16 @@ class CreateRaisedExpertRequest(BaseModel):
async def list_expert_templates(
search_query: str | None = fastapi.Query(default=None),
category: str | None = fastapi.Query(default=None),
-) -> list[Expert]:
+ user_id: str | None = Security(autogpt_auth_lib.get_optional_user_id),
+) -> list[ExpertTemplate]:
"""Roster templates, narrowed by a search term and/or a marketplace category.
Unpaginated: the roster is small, and every caller reads the whole list.
"""
- return await experts_db.list_templates(search_query=search_query, category=category)
+ templates = await experts_db.list_templates(
+ search_query=search_query, category=category
+ )
+ return await experts_db.with_bundled_skills(templates, user_id)
@router.post(
diff --git a/autogpt_platform/backend/backend/api/features/experts/routes_test.py b/autogpt_platform/backend/backend/api/features/experts/routes_test.py
index b42a572015..24a1979875 100644
--- a/autogpt_platform/backend/backend/api/features/experts/routes_test.py
+++ b/autogpt_platform/backend/backend/api/features/experts/routes_test.py
@@ -7,13 +7,15 @@ with AsyncMock at the route module's import site.
import json
from datetime import date
+from types import SimpleNamespace
from unittest.mock import AsyncMock
import fastapi
import fastapi.testclient
+import prisma.models
import pytest
import pytest_mock
-from autogpt_libs.auth.dependencies import get_request_context
+from autogpt_libs.auth.dependencies import get_optional_user_id, get_request_context
from autogpt_libs.auth.jwt_utils import get_jwt_payload
from pytest_snapshot.plugin import Snapshot
@@ -38,8 +40,10 @@ from backend.api.features.experts.models import (
RaiseResult,
)
from backend.api.features.experts.routes import public_router, router
+from backend.api.features.store.skill_model import MarketplaceSkill
from backend.api.rest_api import app as rest_app
from backend.util.exceptions import ConflictError, NotFoundError
+from backend.util.feature_flag import Flag
app = fastapi.FastAPI()
app.include_router(public_router)
@@ -142,6 +146,11 @@ def test_list_expert_templates(
new_callable=AsyncMock,
return_value=[template],
)
+ mocker.patch.object(
+ prisma.models.ExpertSkillListing,
+ "prisma",
+ return_value=SimpleNamespace(find_many=AsyncMock(return_value=[])),
+ )
response = client.get("/experts/templates")
@@ -175,6 +184,86 @@ def test_list_expert_templates_forwards_search_and_category(
mock_list.assert_awaited_once_with(search_query="Maria", category="marketing")
+ ("user_id", "flag_key"), [(None, "anonymous"), ("user-1", "user-1")]
+)
+def test_list_expert_templates_links_live_hub_skills(
+ mocker: pytest_mock.MockerFixture, user_id: str | None, flag_key: str
+) -> None:
+ app.dependency_overrides[get_optional_user_id] = lambda: user_id
+ flag, _ = _mock_templates_with_hub_skill(mocker, hub_on=True)
+
+ response = client.get("/experts/templates")
+
+ assert response.status_code == 200
+ assert response.json()[0]["bundled_skills"] == [
+ {
+ "id": "listing-1",
+ "slug": "brand-voice-guide",
+ "name": "brand-voice-guide",
+ "description": "Keeps every draft on-brand.",
+ }
+ ]
+ flag.assert_awaited_once_with(Flag.SKILLS_HUB, flag_key)
+
+
+def test_list_expert_templates_links_nothing_with_the_hub_off(
+ mocker: pytest_mock.MockerFixture,
+) -> None:
+ _, rows_query = _mock_templates_with_hub_skill(mocker, hub_on=False)
+
+ response = client.get("/experts/templates")
+
+ assert response.status_code == 200
+ assert response.json()[0]["bundled_skills"] == []
+ rows_query.assert_not_awaited()
+
+
+def _mock_templates_with_hub_skill(
+ mocker: pytest_mock.MockerFixture, *, hub_on: bool
+) -> tuple[AsyncMock, AsyncMock]:
+ template = _make_expert(
+ id="template-1",
+ is_template=True,
+ source_template_id=None,
+ )
+ mocker.patch(
+ "backend.api.features.experts.routes.experts_db.list_templates",
+ new_callable=AsyncMock,
+ return_value=[template],
+ )
+ rows_query = AsyncMock(
+ return_value=[
+ SimpleNamespace(expertId="template-1", skillListingId="listing-1")
+ ]
+ )
+ mocker.patch.object(
+ prisma.models.ExpertSkillListing,
+ "prisma",
+ return_value=SimpleNamespace(find_many=rows_query),
+ )
+ mocker.patch(
+ "backend.api.features.experts.experts_db.skill_db.get_live_skills",
+ new_callable=AsyncMock,
+ return_value={
+ "listing-1": MarketplaceSkill(
+ slug="brand-voice-guide",
+ name="brand-voice-guide",
+ description="Keeps every draft on-brand.",
+ categories=[],
+ required_providers=[],
+ install_count=0,
+ )
+ },
+ )
+ flag = mocker.patch(
+ "backend.api.features.experts.experts_db.is_feature_enabled",
+ new_callable=AsyncMock,
+ return_value=hub_on,
+ )
+ return flag, rows_query
+
+
# ─── Hire ──────────────────────────────────────────────────────────────
diff --git a/autogpt_platform/backend/backend/api/features/experts/seed.py b/autogpt_platform/backend/backend/api/features/experts/seed.py
index f625480ce0..f8944769c9 100644
--- a/autogpt_platform/backend/backend/api/features/experts/seed.py
+++ b/autogpt_platform/backend/backend/api/features/experts/seed.py
@@ -3,9 +3,9 @@
Run with: poetry run python -m backend.api.features.experts.seed
Upserts the three roster templates (Maria, Max, Frankie) by template name,
-so repeated runs keep the same template ids. Preload workflows are resolved
-from official store listing slugs; all listings are validated before any
-template is mutated. Each upsert also refreshes the presentation fields
+so repeated runs keep the same template ids. Preload workflows and bundled
+Skills Hub skills are resolved from listing slugs; all are validated before
+any template is mutated. Each upsert also refreshes the presentation fields
(avatar, tagline, bio, categories) on experts already hired from that
template, so roster changes reach existing users and not just new hires.
"""
@@ -57,7 +57,9 @@ class RosterEntry(TypedDict):
tagline: str
avatar_url: str | None
bio: str
- skills: list[str]
+ # Skills Hub listing slugs a hire gets installed. Listing ids differ per
+ # environment, so the seed resolves these to ids and the relation stores those.
+ bundled_skills: list[str]
# Canonical marketplace categories, so the category chip narrows the roster.
# Declared here rather than derived from `role`: "Ops" folds onto no
# canonical value, and a raised expert's role is free text.
@@ -80,13 +82,7 @@ ROSTER: list[RosterEntry] = [
"tagline": "Writes your LinkedIn posts, SEO articles, and webpage copy.",
"avatar_url": "/experts/maria.svg",
"bio": """I'm a senior marketing strategist — fifteen years across B2B SaaS and consumer brands — and I lead with positioning before tactics: who the customer is, what keeps them up at night, and why they'd pick you over doing nothing. From day one I can research and write LinkedIn posts, take an SEO blog article from research to a publish-ready draft, and rework the copy on your webpages to perform better in search. Everything ships in clear, confident prose with the jargon stripped out.""",
- "skills": [
- "Content strategy",
- "Social copy",
- "SEO writing",
- "Web copy",
- "Positioning",
- ],
+ "bundled_skills": [],
"categories": ["marketing", "content"],
"identity": """You are Maria, a senior marketing strategist with fifteen years of experience across B2B SaaS and consumer brands. You think in terms of positioning first: before any tactic, you want to know who the customer is, what keeps them up at night, and why they would choose this product over doing nothing. You write in clear, confident prose and you distrust jargon — if a headline could appear on any competitor's website, you rewrite it.
@@ -134,13 +130,7 @@ You are direct about trade-offs. If a campaign idea is clever but off-brand, you
"tagline": "Finds your leads, their decision-makers, and their contact details.",
"avatar_url": "/experts/max.svg",
"bio": """I'm a sales development expert who's built outbound pipelines for startups and mid-market teams, and I treat most pipeline problems as targeting problems in disguise — so I start by sharpening your ideal customer profile before I go hunting. From day one I can pull lists of businesses that fit that profile, surface the owner or decision-maker behind a company, and track down a contact's email address. Volume without fit is noise, and I say so plainly.""",
- "skills": [
- "Prospecting",
- "Lead qualification",
- "Contact research",
- "ICP targeting",
- "Account research",
- ],
+ "bundled_skills": [],
"categories": ["sales"],
"identity": """You are Max, a sales development expert who has built outbound pipelines for startups and mid-market companies. You believe pipeline problems are usually targeting problems in disguise, so you start every engagement by sharpening the ideal customer profile: industry, size, trigger events, and the specific pain your product removes. Volume without fit is noise, and you say so plainly.
@@ -172,13 +162,7 @@ You are rigorous about data quality. You flag when contact information looks sta
"tagline": "Starts your day briefed: meeting prep, support email, and a morning digest.",
"avatar_url": "/experts/frankie.svg",
"bio": """I'm an operations specialist who's run the back office for fast-growing teams, and my job is to keep you ahead of the routine instead of buried in it. From day one I can brief you before your business meetings; after you connect the required inbox sources, I can draft support replies and land a personalized morning digest on your desk at 7:40 in your timezone. I'm conservative about commitments: I never promise a date, refund, or policy exception on your behalf — I draft it and flag it for you to approve.""",
- "skills": [
- "Meeting prep",
- "Follow-ups",
- "Support triage",
- "Scheduling",
- "Checklists",
- ],
+ "bundled_skills": [],
"categories": ["operations", "support"],
"identity": """You are Frankie, an operations specialist who has run the back office for fast-growing teams. Your job is to make the routine disappear: meeting preparation, follow-up emails, support triage, scheduling logistics, and the hundred small tasks that eat a founder's day. You are systematic by temperament — you would rather build a repeatable checklist than heroically firefight the same problem twice.
@@ -329,7 +313,6 @@ async def _upsert_template(entry: RosterEntry) -> prisma.models.Expert:
),
"boundaries": entry["boundaries"],
"bio": entry["bio"],
- "skills": entry["skills"],
"categories": validate_canonical_categories(entry["categories"]),
"dayOne": SafeJson(encode_day_one(entry["day_one"])),
"isArchived": False,
@@ -428,13 +411,57 @@ async def _resolve_roster_preloads() -> dict[str, str]:
return resolved
+async def _resolve_roster_skills() -> dict[str, str]:
+ slugs = {slug for entry in ROSTER for slug in entry["bundled_skills"]}
+ if not slugs:
+ return {}
+ listings = await prisma.models.SkillListing.prisma().find_many(
+ where={"slug": {"in": sorted(slugs)}, "isDeleted": False}
+ )
+ resolved = {listing.slug: listing.id for listing in listings}
+ missing = sorted(slugs - resolved.keys())
+ if missing:
+ raise RuntimeError(
+ f"Skills Hub is missing roster listings for: {', '.join(missing)}. "
+ "Seed the starter skills before seeding the expert roster."
+ )
+ return resolved
+
+
+async def _sync_bundled_skills(template_id: str, listing_ids: list[str]) -> None:
+ await prisma.models.ExpertSkillListing.prisma().delete_many(
+ where={"expertId": template_id, "skillListingId": {"not_in": listing_ids}}
+ )
+ for position, listing_id in enumerate(listing_ids):
+ await prisma.models.ExpertSkillListing.prisma().upsert(
+ where={
+ "expertId_skillListingId": {
+ "expertId": template_id,
+ "skillListingId": listing_id,
+ }
+ },
+ data={
+ "create": {
+ "expertId": template_id,
+ "skillListingId": listing_id,
+ "position": position,
+ },
+ "update": {"position": position},
+ },
+ )
+
+
async def seed_roster() -> list[str]:
"""Upsert the roster templates and their preloads. Returns template ids."""
resolved_versions = await _resolve_roster_preloads()
+ resolved_skills = await _resolve_roster_skills()
template_ids = []
for entry in ROSTER:
template = await _upsert_template(entry)
await _sync_preloads(template.id, entry, resolved_versions)
+ await _sync_bundled_skills(
+ template.id, [resolved_skills[slug] for slug in entry["bundled_skills"]]
+ )
refreshed = await _backfill_hired_copies(template)
template_ids.append(template.id)
logger.info(
diff --git a/autogpt_platform/backend/backend/api/features/store/skill_db.py b/autogpt_platform/backend/backend/api/features/store/skill_db.py
index 4e396add2b..fc038bf3a2 100644
--- a/autogpt_platform/backend/backend/api/features/store/skill_db.py
+++ b/autogpt_platform/backend/backend/api/features/store/skill_db.py
@@ -4,8 +4,9 @@ Browse is rooted at :class:`SkillListingVersion` rather than the listing because
every filter and the ordering read version columns; ``ActiveFor`` constrains the
row to the listing's live version. Install count is displayed but is not a sort
key — a catalogue this size gains nothing from it, and it lives on the listing
-because installs accumulate across versions. It counts distinct installers: a
-re-install overwrites the user's copy and is not counted again.
+because installs accumulate across versions. It counts distinct installs per
+owner (personal library or expert): a re-install overwrites that copy and is
+not counted again.
"""
import prisma.enums
@@ -60,21 +61,37 @@ async def get_marketplace_skill(slug: str) -> skill_model.MarketplaceSkillDetail
return skill_model.MarketplaceSkillDetails.from_db(listing)
+async def get_live_skills(
+ listing_ids: list[str],
+) -> dict[str, skill_model.MarketplaceSkill]:
+ """The live listings among *listing_ids*, keyed by id, in one query."""
+ if not listing_ids:
+ return {}
+ listings = await prisma.models.SkillListing.prisma().find_many(
+ where=_live_listing_where({"id": {"in": listing_ids}}),
+ include=_LISTING_INCLUDE,
+ )
+ return {
+ listing.id: skill_model.MarketplaceSkill.from_db(listing)
+ for listing in listings
+ }
+
+
async def install_marketplace_skill(
- user_id: str, slug: str
+ user_id: str, slug: str, *, expert_id: str | None = None
) -> skill_model.InstalledSkill:
- """Copy a listing's SKILL.md into the caller's own skill library.
+ """Copy a listing's SKILL.md into *expert_id*'s skill folder, or the
+ caller's own library when ``None``.
The listing's slug becomes the installed skill's name, so an install is
idempotent and a re-install picks up a newer approved version.
"""
listing = await _find_live_listing(slug)
active = skill_model.active_version(listing)
- # A re-install overwrites the user's existing copy, so counting it again
- # would report installs rather than installers.
- is_new = all(s.name != listing.slug for s in await list_user_skills(user_id))
- # #14414 makes this the expert-owned install's call site, adding both the
- # `expert_id` argument here and the keyword on `store_user_skill`.
+ # A re-install overwrites the existing copy, so counting it again would
+ # report installs rather than installers. Counting only: no healing.
+ owned = await list_user_skills(user_id, expert_id, heal_missing=False)
+ is_new = all(s.name != listing.slug for s in owned)
await store_user_skill(
user_id,
name=listing.slug,
@@ -82,6 +99,7 @@ async def install_marketplace_skill(
body=active.body,
triggers=list(active.triggers),
version=str(active.version),
+ expert_id=expert_id,
)
if is_new:
await prisma.models.SkillListing.prisma().update(
@@ -94,21 +112,30 @@ async def install_marketplace_skill(
async def _find_live_listing(slug: str) -> prisma.models.SkillListing:
listing = await prisma.models.SkillListing.prisma().find_first(
- where={"slug": slug, "isDeleted": False, "hasApprovedVersion": True},
- include=_LISTING_INCLUDE,
+ where=_live_listing_where({"slug": slug}), include=_LISTING_INCLUDE
)
- if listing is None or listing.ActiveVersion is None:
- raise NotFoundError(f"Skill '{slug}' not found")
- active = listing.ActiveVersion
- if (
- active.submissionStatus != prisma.enums.SubmissionStatus.APPROVED
- or not active.isAvailable
- or active.isDeleted
- ):
+ if listing is None:
raise NotFoundError(f"Skill '{slug}' not found")
return listing
+def _live_listing_where(
+ match: prisma.types.SkillListingWhereInput,
+) -> prisma.types.SkillListingWhereInput:
+ return {
+ **match,
+ "isDeleted": False,
+ "hasApprovedVersion": True,
+ "ActiveVersion": {
+ "is": {
+ "submissionStatus": prisma.enums.SubmissionStatus.APPROVED,
+ "isAvailable": True,
+ "isDeleted": False,
+ }
+ },
+ }
+
+
def _live_version_where(
category: str | None, search_query: str | None
) -> prisma.types.SkillListingVersionWhereInput:
diff --git a/autogpt_platform/backend/backend/api/features/store/skill_db_test.py b/autogpt_platform/backend/backend/api/features/store/skill_db_test.py
index ee2ab03f3c..17a8408238 100644
--- a/autogpt_platform/backend/backend/api/features/store/skill_db_test.py
+++ b/autogpt_platform/backend/backend/api/features/store/skill_db_test.py
@@ -151,17 +151,56 @@ async def test_detail_of_an_off_shelf_listing_is_not_found(has_approved_version:
await skill_db.get_marketplace_skill("off-shelf-one")
-async def test_install_stores_under_the_listing_slug_and_counts(mocker):
- listing = await _make_listing("install-one", body="# do this\n")
+async def test_live_skills_holds_only_listings_on_the_shelf():
+ live_one = await _make_listing("live-one")
+ draft = await _make_listing("draft-one", approved=False, has_approved_version=True)
+ never = await _make_listing("never-approved", approved=False)
+ unavailable = await _make_listing("unavailable-one", available=False)
+ deleted = await _make_listing("deleted-one")
+ await prisma.models.SkillListing.prisma().update(
+ where={"id": deleted.id}, data={"isDeleted": True}
+ )
+ withdrawn = await _make_listing("withdrawn-one")
+ assert withdrawn.activeVersionId is not None
+ await prisma.models.SkillListingVersion.prisma().update(
+ where={"id": withdrawn.activeVersionId}, data={"isDeleted": True}
+ )
+
+ live = await skill_db.get_live_skills(
+ [
+ live_one.id,
+ draft.id,
+ never.id,
+ unavailable.id,
+ deleted.id,
+ withdrawn.id,
+ "missing-one",
+ ]
+ )
+
+ assert list(live) == [live_one.id]
+ assert live[live_one.id].name == "Live One"
+
+
[email protected]("expert_id", [None, "expert-1"])
+async def test_install_stores_under_the_listing_slug_and_counts(mocker, expert_id):
+ listing = await _make_listing(
+ f"install-one-{expert_id or 'library'}", body="# do this\n"
+ )
stored = mocker.patch.object(skill_db, "store_user_skill")
- mocker.patch.object(skill_db, "list_user_skills", return_value=[])
+ listed = mocker.patch.object(skill_db, "list_user_skills", return_value=[])
- result = await skill_db.install_marketplace_skill("user-1", "install-one")
+ result = await skill_db.install_marketplace_skill(
+ "user-1", listing.slug, expert_id=expert_id
+ )
+ # The count checks the folder being written: the expert's or the library.
+ listed.assert_awaited_once_with("user-1", expert_id, heal_missing=False)
stored.assert_awaited_once()
- assert stored.await_args.kwargs["name"] == "install-one"
+ assert stored.await_args.kwargs["name"] == listing.slug
+ assert stored.await_args.kwargs["expert_id"] == expert_id
assert stored.await_args.kwargs["body"] == "# do this\n"
- assert result.name == "install-one"
+ assert result.name == listing.slug
assert result.required_providers == ["google"]
refreshed = await prisma.models.SkillListing.prisma().find_unique(
diff --git a/autogpt_platform/backend/backend/copilot/eval/style/assembly.py b/autogpt_platform/backend/backend/copilot/eval/style/assembly.py
index a0ac20c98b..d8e8e33e23 100644
--- a/autogpt_platform/backend/backend/copilot/eval/style/assembly.py
+++ b/autogpt_platform/backend/backend/copilot/eval/style/assembly.py
@@ -79,7 +79,7 @@ def roster_expert(entry: RosterEntry) -> Expert:
role=entry["role"],
tagline=entry["tagline"],
bio=entry["bio"],
- skills=list(entry["skills"]),
+ skills=list(entry["bundled_skills"]),
identity=entry["identity"],
voice_preferences=entry["voice_preferences"],
voice_samples=list(entry["voice_samples"]),
diff --git a/autogpt_platform/backend/migrations/20260911122000_remove_hollow_expert_skills/migration.sql b/autogpt_platform/backend/migrations/20260911122000_remove_hollow_expert_skills/migration.sql
new file mode 100644
index 0000000000..e1957dc194
--- /dev/null
+++ b/autogpt_platform/backend/migrations/20260911122000_remove_hollow_expert_skills/migration.sql
@@ -0,0 +1,45 @@
+-- Delete every persona phrase the roster seed ever wrote as a skill (none has a
+-- SKILL.md behind it); a phrase whose SKILL.md does exist is a real assignment.
+WITH "phrases" AS (
+ SELECT ARRAY[
+ 'Content strategy', 'Social copy', 'SEO writing', 'Web copy', 'Positioning',
+ 'Email campaigns', 'Prospecting', 'Lead qualification', 'Contact research',
+ 'Cold outreach', 'ICP targeting', 'Account research', 'Meeting prep',
+ 'Follow-ups', 'Support triage', 'Scheduling', 'Checklists'
+ ]::TEXT[] AS "list"
+),
+"cleaned" AS (
+ SELECT e."id",
+ ARRAY(
+ SELECT t."name"
+ FROM UNNEST(e."skills") WITH ORDINALITY AS t("name", "position"),
+ -- The row may carry a display name ("Content strategy") for the
+ -- folder "content-strategy": skill_name_key()'s key, in SQL.
+ LATERAL (
+ SELECT regexp_replace(BTRIM(LOWER(t."name")), '[\s_-]+', '-', 'g')
+ ) AS k("slug")
+ WHERE t."name" <> ALL (p."list")
+ OR EXISTS (
+ SELECT 1
+ FROM "UserWorkspaceFile" f
+ JOIN "UserWorkspace" w ON w."id" = f."workspaceId"
+ WHERE w."userId" = e."ownerUserId"
+ AND NOT f."isDeleted"
+ -- The expert's own copy, or the owner-library file that the
+ -- per-expert ownership backfill copies on the next cold
+ -- listing — deleting the name is what would strand it.
+ AND f."path" IN (
+ '/experts/' || e."id" || '/skills/' || k."slug" || '/SKILL.md',
+ '/skills/' || k."slug" || '/SKILL.md'
+ )
+ )
+ ORDER BY t."position"
+ ) AS "skills"
+ FROM "Expert" e, "phrases" p
+ WHERE e."skills" && p."list"
+)
+UPDATE "Expert" e
+SET "skills" = c."skills"
+FROM "cleaned" c
+WHERE e."id" = c."id"
+ AND e."skills" IS DISTINCT FROM c."skills";
diff --git a/autogpt_platform/backend/migrations/20260911152800_add_expert_skill_listing/migration.sql b/autogpt_platform/backend/migrations/20260911152800_add_expert_skill_listing/migration.sql
new file mode 100644
index 0000000000..54efb45902
--- /dev/null
+++ b/autogpt_platform/backend/migrations/20260911152800_add_expert_skill_listing/migration.sql
@@ -0,0 +1,19 @@
+-- CreateTable
+CREATE TABLE "ExpertSkillListing" (
+ "expertId" TEXT NOT NULL,
+ "skillListingId" TEXT NOT NULL,
+ "position" INTEGER NOT NULL DEFAULT 0,
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+
+ CONSTRAINT "ExpertSkillListing_pkey" PRIMARY KEY ("expertId","skillListingId")
+);
+
+-- CreateIndex
+CREATE INDEX "ExpertSkillListing_skillListingId_idx" ON "ExpertSkillListing"("skillListingId");
+
+-- AddForeignKey
+ALTER TABLE "ExpertSkillListing" ADD CONSTRAINT "ExpertSkillListing_expertId_fkey" FOREIGN KEY ("expertId") REFERENCES "Expert"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "ExpertSkillListing" ADD CONSTRAINT "ExpertSkillListing_skillListingId_fkey" FOREIGN KEY ("skillListingId") REFERENCES "SkillListing"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+
diff --git a/autogpt_platform/backend/schema.prisma b/autogpt_platform/backend/schema.prisma
index e4fb472efb..6932f6eff3 100644
--- a/autogpt_platform/backend/schema.prisma
+++ b/autogpt_platform/backend/schema.prisma
@@ -1092,6 +1092,7 @@ model Expert {
GraphExecutions AgentGraphExecution[]
AgentPresets AgentPreset[]
PauseEvents ExpertPauseEvent[]
+ BundledSkills ExpertSkillListing[]
// Owner-scoped grouping into named "pods" (distinct from org-tenancy Team).
podId String?
@@ -1143,6 +1144,24 @@ model ExpertWorkflow {
@@index([expertId, createdAt, id])
}
+// A Skills Hub listing a roster template comes with; hiring installs its
+// active version into the new expert's own skills folder.
+model ExpertSkillListing {
+ expertId String
+ Expert Expert @relation(fields: [expertId], references: [id], onDelete: Cascade)
+
+ skillListingId String
+ SkillListing SkillListing @relation(fields: [skillListingId], references: [id], onDelete: Cascade)
+
+ // Display order, as the roster declares it.
+ position Int @default(0)
+
+ createdAt DateTime @default(now())
+
+ @@id([expertId, skillListingId])
+ @@index([skillListingId])
+}
+
// Which of the owner's integration credentials an expert may use.
// Deny-by-default: an expert with no rows here reaches nothing, so the
// seeding marker on Expert (credentialsSeededAt) is what keeps existing
@@ -2058,7 +2077,8 @@ model SkillListing {
OwningUser User? @relation(fields: [owningUserId], references: [id])
CreatorProfile Profile? @relation(fields: [owningUserId], references: [userId], map: "SkillListing_owner_Profile_fkey", onDelete: Cascade)
- Versions SkillListingVersion[] @relation("SkillListingVersions")
+ Versions SkillListingVersion[] @relation("SkillListingVersions")
+ BundledBy ExpertSkillListing[]
// Tenancy
owningOrgId String?
diff --git a/autogpt_platform/backend/snapshots/expert_templates_list b/autogpt_platform/backend/snapshots/expert_templates_list
index 07d8cf9c1a..3dffc7c48e 100644
--- a/autogpt_platform/backend/snapshots/expert_templates_list
+++ b/autogpt_platform/backend/snapshots/expert_templates_list
@@ -3,6 +3,7 @@
"avatar_url": null,
"bio": null,
"boundaries": "Ask before external actions.",
+ "bundled_skills": [],
"categories": [],
"color": "",
"credential_count": 0,
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/experts-section.test.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/experts-section.test.tsx
index a9a7bec629..7b692687fa 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/experts-section.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/experts-section.test.tsx
@@ -4,7 +4,12 @@ import {
} from "@/app/api/__generated__/endpoints/experts/experts.msw";
import { Expert } from "@/app/api/__generated__/models/expert";
import { server } from "@/mocks/mock-server";
-import { render, screen, waitFor } from "@/tests/integrations/test-utils";
+import {
+ render,
+ screen,
+ waitFor,
+ within,
+} from "@/tests/integrations/test-utils";
import { HttpResponse, http } from "msw";
import { beforeEach, describe, expect, test, vi } from "vitest";
import { MainMarkeplacePage } from "../components/MainMarketplacePage/MainMarketplacePage";
@@ -181,6 +186,56 @@ describe("Marketplace ExpertsSection", () => {
expect(raiseLink.getAttribute("href")).toBe("/raise");
});
+ test("lists the Hub skills a hire comes with on the card, and nothing else", async () => {
+ server.use(
+ getListExpertTemplatesMockHandler([
+ {
+ ...mariaTemplate,
+ skills: ["Content strategy", "brand-voice-guide"],
+ bundled_skills: [
+ {
+ id: "listing-1",
+ slug: "brand-voice-guide",
+ name: "brand-voice-guide",
+ description: "Keeps every draft on-brand.",
+ },
+ ],
+ },
+ ]),
+ getListExpertsMockHandler([]),
+ );
+
+ render(<MainMarkeplacePage />);
+
+ const card = await screen.findByRole(
+ "link",
+ { name: /Maria/ },
+ { timeout: 5_000 },
+ );
+ expect(within(card).getByText("Brand voice guide")).toBeDefined();
+ expect(within(card).queryByText("brand-voice-guide")).toBeNull();
+ expect(within(card).queryByText("Content strategy")).toBeNull();
+ });
+
+ test("shows no skills row on a card without Hub skills", async () => {
+ server.use(
+ getListExpertTemplatesMockHandler([
+ { ...mariaTemplate, skills: ["Content strategy"], bundled_skills: [] },
+ ]),
+ getListExpertsMockHandler([]),
+ );
+
+ render(<MainMarkeplacePage />);
+
+ const card = await screen.findByRole(
+ "link",
+ { name: /Maria/ },
+ { timeout: 5_000 },
+ );
+ expect(within(card).queryByText("Skills")).toBeNull();
+ expect(within(card).queryByText("Content strategy")).toBeNull();
+ });
+
test("hired template shows hired state", async () => {
server.use(
getListExpertTemplatesMockHandler([mariaTemplate]),
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertCard.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertCard.tsx
index 7282824a17..b7fc23ab71 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertCard.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertCard.tsx
@@ -1,4 +1,4 @@
-import { Expert } from "@/app/api/__generated__/models/expert";
+import { ExpertTemplate } from "@/app/api/__generated__/models/expertTemplate";
import {
Avatar,
AvatarFallback,
@@ -7,6 +7,7 @@ import {
import { cn } from "@/lib/utils";
import Link from "next/link";
import { getExpertAccent } from "../helpers";
+import { formatSkillTitle } from "../../SkillsSection/helpers";
import {
ArrowRight02Icon,
CheckmarkCircle02Icon,
@@ -15,7 +16,7 @@ import {
import { Icon } from "@/components/atoms/Icon/Icon";
interface Props {
- expert: Expert;
+ expert: ExpertTemplate;
isHired: boolean;
}
@@ -23,6 +24,7 @@ interface Props {
* shared and opened directly. */
export function ExpertCard({ expert, isHired }: Props) {
const accent = getExpertAccent(expert.role);
+ const skills = expert.bundled_skills ?? [];
return (
<Link
@@ -65,23 +67,23 @@ export function ExpertCard({ expert, isHired }: Props) {
) : null}
</div>
- {expert.skills && expert.skills.length > 0 ? (
+ {skills.length > 0 ? (
<div>
<div className="mb-1.5 text-[11px] font-medium uppercase tracking-[0.14em] text-zinc-400">
Skills
</div>
<div className="flex flex-wrap gap-1.5">
- {expert.skills.slice(0, 3).map((skill) => (
+ {skills.slice(0, 3).map((skill) => (
<span
- key={skill}
+ key={skill.id}
className="rounded-full bg-zinc-50 px-2.5 py-1 text-xs font-medium text-zinc-500 ring-1 ring-inset ring-zinc-200/80"
>
- {skill}
+ {formatSkillTitle(skill.name)}
</span>
))}
- {expert.skills.length > 3 ? (
+ {skills.length > 3 ? (
<span className="px-1 py-1 text-xs font-medium text-zinc-400">
- +{expert.skills.length - 3}
+ +{skills.length - 3}
</span>
) : null}
</div>
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/useExpertsSection.ts b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/useExpertsSection.ts
index a7615d3b03..374669e787 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/useExpertsSection.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/useExpertsSection.ts
@@ -3,6 +3,7 @@ import {
useListExpertTemplates,
} from "@/app/api/__generated__/endpoints/experts/experts";
import { Expert } from "@/app/api/__generated__/models/expert";
+import { ExpertTemplate } from "@/app/api/__generated__/models/expertTemplate";
import { useAuth } from "@/lib/auth/hooks/useAuth";
interface Args {
@@ -29,7 +30,7 @@ export function useExpertsSection({
{
query: {
enabled,
- select: (x) => x.data as Expert[],
+ select: (x) => x.data as ExpertTemplate[],
// The shelf keeps its cards across a chip change; search must not show a
// previous term's cards, so it waits on the page's loading gate instead.
placeholderData:
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertAccess.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertAccess.tsx
index 5a31963054..f245c39ce6 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertAccess.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertAccess.tsx
@@ -1,5 +1,6 @@
import { formatProviderName } from "@/components/contextual/IntegrationsPanel/helpers";
import { IntegrationLogo } from "@/components/molecules/IntegrationLogo/IntegrationLogo";
+import { ExpertPill } from "./ExpertPill";
import { ExpertSection } from "./ExpertSection";
interface Props {
@@ -17,17 +18,11 @@ export function ExpertAccess({ name, providers }: Props) {
>
<ul className="flex flex-wrap gap-2">
{providers.map((provider) => (
- <li
+ <ExpertPill
key={provider}
- className="flex min-w-0 items-center gap-2 rounded-lg bg-white px-2.5 py-1.5 text-sm text-zinc-700 ring-1 ring-inset ring-zinc-200/80"
- >
- {/* The label beside it already names the provider; without this a
- screen reader announces the name twice. */}
- <span aria-hidden="true" className="flex shrink-0">
- <IntegrationLogo provider={provider} />
- </span>
- <span className="truncate">{formatProviderName(provider)}</span>
- </li>
+ icon={<IntegrationLogo provider={provider} />}
+ label={formatProviderName(provider)}
+ />
))}
</ul>
</ExpertSection>
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertPage.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertPage.tsx
index 170f647a80..7c740c0dad 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertPage.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertPage.tsx
@@ -134,7 +134,7 @@ export function ExpertPage() {
accent={accent}
/>
<ExpertAbout key={expert.id} text={expert.bio || expert.identity} />
- <ExpertSkills skills={expert.skills ?? []} accent={accent} />
+ <ExpertSkills skills={expert.bundled_skills ?? []} accent={accent} />
<ExpertWorkflowList
name={expert.name}
workflows={expert.workflows}
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertPill.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertPill.tsx
new file mode 100644
index 0000000000..9ee9b07dab
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertPill.tsx
@@ -0,0 +1,49 @@
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { cn } from "@/lib/utils";
+import { ArrowUpRight01Icon } from "@hugeicons/core-free-icons";
+import Link from "next/link";
+import type { ReactNode } from "react";
+
+interface Props {
+ icon: ReactNode;
+ label: string;
+ href?: string;
+}
+
+const PILL_CLASS =
+ "flex min-w-0 items-center gap-2 rounded-lg bg-white px-2.5 py-1.5 text-sm text-zinc-700 ring-1 ring-inset ring-zinc-200/80";
+
+/** The flat item the expert page lists services and skills with. */
+export function ExpertPill({ icon, label, href }: Props) {
+ // The label names the item, so a screen reader must not hear the icon too.
+ const content = (
+ <>
+ <span aria-hidden="true" className="flex shrink-0">
+ {icon}
+ </span>
+ <span className="truncate">{label}</span>
+ </>
+ );
+
+ if (!href) return <li className={PILL_CLASS}>{content}</li>;
+
+ return (
+ <li className="min-w-0">
+ <Link
+ href={href}
+ className={cn(
+ PILL_CLASS,
+ "outline-none transition-colors hover:text-zinc-900 hover:ring-zinc-300 focus-visible:ring-2 focus-visible:ring-violet-600",
+ )}
+ >
+ {content}
+ <Icon
+ icon={ArrowUpRight01Icon}
+ size={14}
+ aria-hidden
+ className="shrink-0 text-zinc-400"
+ />
+ </Link>
+ </li>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertSkills.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertSkills.tsx
index 0bef645aa6..a8a46f46ea 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertSkills.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertSkills.tsx
@@ -1,9 +1,13 @@
-import { cn } from "@/lib/utils";
+import type { ExpertBundledSkill } from "@/app/api/__generated__/models/expertBundledSkill";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { BookOpen01Icon } from "@hugeicons/core-free-icons";
import type { ExpertAccent } from "../../../components/ExpertsSection/helpers";
+import { formatSkillTitle } from "../../../components/SkillsSection/helpers";
+import { ExpertPill } from "./ExpertPill";
import { ExpertSection } from "./ExpertSection";
interface Props {
- skills: string[];
+ skills: ExpertBundledSkill[];
accent: ExpertAccent;
}
@@ -12,19 +16,18 @@ export function ExpertSkills({ skills, accent }: Props) {
return (
<ExpertSection title="Skills">
- <div className="flex flex-wrap gap-2">
+ <ul className="flex flex-wrap gap-2">
{skills.map((skill) => (
- <span
- key={skill}
- className={cn(
- "inline-flex items-center rounded-lg px-2.5 py-1 text-sm font-medium leading-5",
- accent.chip,
- )}
- >
- {skill}
- </span>
+ <ExpertPill
+ key={skill.id}
+ icon={
+ <Icon icon={BookOpen01Icon} size={16} className={accent.icon} />
+ }
+ label={formatSkillTitle(skill.name)}
+ href={`/marketplace/skills/${skill.slug}`}
+ />
))}
- </div>
+ </ul>
</ExpertSection>
);
}
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/useExpertPage.ts b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/useExpertPage.ts
index 68d30c7e96..541e55eb70 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/useExpertPage.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/useExpertPage.ts
@@ -5,6 +5,7 @@ import {
import { useGetV1ListSystemProviders } from "@/app/api/__generated__/endpoints/integrations/integrations";
import { okData } from "@/app/api/helpers";
import { Expert } from "@/app/api/__generated__/models/expert";
+import { ExpertTemplate } from "@/app/api/__generated__/models/expertTemplate";
import { useAuth } from "@/lib/auth/hooks/useAuth";
import { Flag, useFlagStatus } from "@/services/feature-flags/use-get-flag";
@@ -23,7 +24,7 @@ export function useExpertPage({ expertId }: Args) {
const canHire = isLoggedIn && isHiringOpen;
const templatesQuery = useListExpertTemplates(undefined, {
- query: { select: (x) => x.data as Expert[] },
+ query: { select: (x) => x.data as ExpertTemplate[] },
});
const expertsQuery = useListExperts({
query: { select: (x) => x.data as Expert[], enabled: canHire },
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/__tests__/expert-page.test.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/__tests__/expert-page.test.tsx
index c6a64449f2..b13d71b566 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/__tests__/expert-page.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/__tests__/expert-page.test.tsx
@@ -180,7 +180,6 @@ describe("Marketplace expert page", () => {
await screen.findByRole("heading", { level: 1, name: "Maria" }),
).toBeDefined();
expect(screen.getByText("Grows your brand while you sleep")).toBeDefined();
- expect(screen.getByText("Content strategy")).toBeDefined();
expect(
within(screen.getByRole("region", { name: /^Workflows/ })).getByText(
"LinkedIn Post Generator",
@@ -230,6 +229,51 @@ describe("Marketplace expert page", () => {
expect(screen.queryByText(/^Runs /)).toBeNull();
});
+ test("shows only the Hub skills a hire comes with, as links", async () => {
+ server.use(
+ getListExpertTemplatesMockHandler([
+ {
+ ...mariaTemplate,
+ skills: ["Content strategy", "brand-voice-guide", "Positioning"],
+ bundled_skills: [
+ {
+ id: "listing-1",
+ slug: "brand-voice-guide",
+ name: "brand-voice-guide",
+ description: "Keeps every draft on-brand.",
+ },
+ ],
+ },
+ ]),
+ getListExpertsMockHandler([]),
+ );
+
+ renderPage();
+
+ const link = await screen.findByRole("link", { name: "Brand voice guide" });
+ expect(link.getAttribute("href")).toBe(
+ "/marketplace/skills/brand-voice-guide",
+ );
+ expect(screen.queryByText("brand-voice-guide")).toBeNull();
+ expect(screen.queryByText("Content strategy")).toBeNull();
+ expect(screen.queryByText("Positioning")).toBeNull();
+ });
+
+ test("shows no Skills section when a hire comes with no Hub skills", async () => {
+ server.use(
+ getListExpertTemplatesMockHandler([
+ { ...mariaTemplate, bundled_skills: [] },
+ ]),
+ getListExpertsMockHandler([]),
+ );
+
+ renderPage();
+
+ await screen.findByRole("heading", { level: 1, name: "Maria" });
+ expect(screen.queryByRole("heading", { name: "Skills" })).toBeNull();
+ expect(screen.queryByText("Content strategy")).toBeNull();
+ });
+
test("renders the services, plan and disclosure sections", async () => {
server.use(
getListExpertTemplatesMockHandler([mariaTemplate]),
@@ -285,7 +329,19 @@ describe("Marketplace expert page", () => {
test("lists the creator's day-one rows above the skills", async () => {
server.use(
getListExpertTemplatesMockHandler([
- { ...mariaTemplate, day_one: mariaDayOne },
+ // The Skills section only renders for a bundled Hub skill.
+ {
+ ...mariaTemplate,
+ day_one: mariaDayOne,
+ bundled_skills: [
+ {
+ id: "listing-1",
+ slug: "brand-voice-guide",
+ name: "brand-voice-guide",
+ description: "Keeps every draft on-brand.",
+ },
+ ],
+ },
]),
getListExpertsMockHandler([]),
);
diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.json
index 2e5d03b988..d724ede488 100644
--- a/autogpt_platform/frontend/src/app/api/openapi.json
+++ b/autogpt_platform/frontend/src/app/api/openapi.json
@@ -6539,6 +6539,7 @@
"summary": "List Expert Templates",
"description": "Roster templates, narrowed by a search term and/or a marketplace category.\n\nUnpaginated: the roster is small, and every caller reads the whole list.",
"operationId": "list_expert_templates",
+ "security": [{ "HTTPBearer": [] }],
"parameters": [
{
"name": "search_query",
@@ -6566,7 +6567,7 @@
"application/json": {
"schema": {
"type": "array",
- "items": { "$ref": "#/components/schemas/Expert" },
+ "items": { "$ref": "#/components/schemas/ExpertTemplate" },
"title": "Response List Expert Templates"
}
}
@@ -20822,6 +20823,18 @@
"title": "ExpertBudgetUpdate",
"description": "Set an expert's weekly spend cap in credits (100 = $1).\n\n``None`` falls back to the platform default; ``0`` disables the cap."
},
+ "ExpertBundledSkill": {
+ "properties": {
+ "id": { "type": "string", "title": "Id" },
+ "slug": { "type": "string", "title": "Slug" },
+ "name": { "type": "string", "title": "Name" },
+ "description": { "type": "string", "title": "Description" }
+ },
+ "type": "object",
+ "required": ["id", "slug", "name", "description"],
+ "title": "ExpertBundledSkill",
+ "description": "A live Skills Hub listing a roster template comes with."
+ },
"ExpertCredentialRef": {
"properties": {
"credential_id": { "type": "string", "title": "Credential Id" },
@@ -21186,6 +21199,139 @@
"title": "ExpertSoulUpdatedResponse",
"description": "Response for the two-step Soul edit tools.\n\nCarries the diff so the model must surface exactly what changed. ``applied``\nis False for the update_expert_soul preview (nothing written yet; the\none-time ``confirmation_id`` references the stored proposal) and True once\nconfirm_expert_soul_update saves the edit."
},
+ "ExpertTemplate": {
+ "properties": {
+ "id": { "type": "string", "title": "Id" },
+ "name": { "type": "string", "title": "Name" },
+ "avatar_url": {
+ "anyOf": [{ "type": "string" }, { "type": "null" }],
+ "title": "Avatar Url"
+ },
+ "color": { "type": "string", "title": "Color", "default": "" },
+ "role": { "type": "string", "title": "Role" },
+ "tagline": {
+ "anyOf": [{ "type": "string" }, { "type": "null" }],
+ "title": "Tagline"
+ },
+ "bio": {
+ "anyOf": [{ "type": "string" }, { "type": "null" }],
+ "title": "Bio"
+ },
+ "skills": {
+ "items": { "type": "string" },
+ "type": "array",
+ "title": "Skills"
+ },
+ "categories": {
+ "items": { "type": "string" },
+ "type": "array",
+ "title": "Categories",
+ "default": []
+ },
+ "identity": { "type": "string", "title": "Identity" },
+ "voice_preferences": {
+ "type": "string",
+ "title": "Voice Preferences"
+ },
+ "voice_samples": {
+ "items": { "$ref": "#/components/schemas/VoiceSample" },
+ "type": "array",
+ "title": "Voice Samples",
+ "default": []
+ },
+ "day_one": {
+ "items": { "$ref": "#/components/schemas/ExpertDayOneItem" },
+ "type": "array",
+ "maxItems": 3,
+ "title": "Day One",
+ "default": []
+ },
+ "boundaries": { "type": "string", "title": "Boundaries" },
+ "protected_soul_rules": {
+ "items": { "type": "string" },
+ "type": "array",
+ "title": "Protected Soul Rules"
+ },
+ "is_template": { "type": "boolean", "title": "Is Template" },
+ "source_template_id": {
+ "anyOf": [{ "type": "string" }, { "type": "null" }],
+ "title": "Source Template Id"
+ },
+ "is_archived": { "type": "boolean", "title": "Is Archived" },
+ "workflows": {
+ "items": { "$ref": "#/components/schemas/ExpertWorkflowRef" },
+ "type": "array",
+ "title": "Workflows"
+ },
+ "credential_count": {
+ "type": "integer",
+ "title": "Credential Count",
+ "default": 0
+ },
+ "credential_providers": {
+ "items": { "type": "string" },
+ "type": "array",
+ "title": "Credential Providers",
+ "default": []
+ },
+ "last_run_at": {
+ "anyOf": [
+ { "type": "string", "format": "date-time" },
+ { "type": "null" }
+ ],
+ "title": "Last Run At"
+ },
+ "last_run_status": {
+ "anyOf": [{ "type": "string" }, { "type": "null" }],
+ "title": "Last Run Status"
+ },
+ "weekly_budget": {
+ "anyOf": [{ "type": "integer" }, { "type": "null" }],
+ "title": "Weekly Budget"
+ },
+ "weekly_spend": {
+ "type": "integer",
+ "title": "Weekly Spend",
+ "default": 0
+ },
+ "schedules_paused_at": {
+ "anyOf": [
+ { "type": "string", "format": "date-time" },
+ { "type": "null" }
+ ],
+ "title": "Schedules Paused At"
+ },
+ "pod_id": {
+ "anyOf": [{ "type": "string" }, { "type": "null" }],
+ "title": "Pod Id"
+ },
+ "bundled_skills": {
+ "items": { "$ref": "#/components/schemas/ExpertBundledSkill" },
+ "type": "array",
+ "title": "Bundled Skills"
+ }
+ },
+ "type": "object",
+ "required": [
+ "id",
+ "name",
+ "avatar_url",
+ "role",
+ "tagline",
+ "bio",
+ "skills",
+ "identity",
+ "voice_preferences",
+ "boundaries",
+ "protected_soul_rules",
+ "is_template",
+ "source_template_id",
+ "is_archived",
+ "workflows"
+ ],
+ "title": "ExpertTemplate",
+ "description": "A roster template as the marketplace shows it."
+ },
"ExpertWorkflowChainItem": {
"properties": {
"kind": {