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): pods v1 — named expert groups (#14042)
Abhimanyu Yadav1eb68d23ef28
diff --git a/autogpt_platform/backend/backend/api/features/experts/experts_db.py b/autogpt_platform/backend/backend/api/features/experts/experts_db.pyindex 6b7a779841..07f7626a14 100644--- a/autogpt_platform/backend/backend/api/features/experts/experts_db.py+++ b/autogpt_platform/backend/backend/api/features/experts/experts_db.py@@ -15,6 +15,7 @@ from backend.api.features.experts.models import (PROTECTED_SOUL_RULES,Expert,ExpertIdentity,+ ExpertPod,ExpertRun,ExpertRunStatus,ExpertSoulFieldsPatch,@@ -80,6 +81,24 @@ class ExpertHireUnavailableError(Exception):self.expert_id = expert_id+class ExpertPodNotFoundError(Exception):+ def __init__(self, pod_id: str):+ super().__init__(f"Pod {pod_id} not found")+ self.pod_id = pod_id+++class ExpertPodNameTakenError(Exception):+ def __init__(self, name: str):+ super().__init__(f"A pod named {name!r} already exists")+ self.name = name+++class ExpertPodLimitReachedError(Exception):+ def __init__(self, limit: int):+ super().__init__(f"You can have at most {limit} pods")+ self.limit = limit++class ExpertLimitExceededError(Exception):def __init__(self, limit: int):super().__init__(f"Active expert limit of {limit} reached")@@ -156,6 +175,7 @@ def _to_model(weekly_budget=scheduling.effective_weekly_budget(row),weekly_spend=weekly_spend,schedules_paused_at=row.schedulesPausedAt,+ pod_id=row.podId,)@@ -1151,3 +1171,85 @@ async def archive_expert(user_id: str, expert_id: str) -> None:logger.exception(f"Failed to detach triggers while archiving expert #{expert_id}")+++# ─── Pods (owner-scoped named groups) ──────────────────────────────────++# Pods are a personal organisation aid, not a modelling primitive: a roster+# large enough to need more groups than this is not a roster any more. The cap+# also bounds what a scripted client can create.+MAX_PODS_PER_USER = 100+++async def create_pod(user_id: str, name: str) -> ExpertPod:+ """Create a pod owned by *user_id*.++ The count is deliberately not serialized against the insert. This cap is a+ guardrail on a self-scoped resource, not a billed quota, so a burst of+ concurrent creates may overshoot by the burst width before the next call is+ rejected — the bound that matters (a scripted client cannot grow the table+ without limit) still holds. Making it exact would mean an advisory lock or+ row lock on every create, which is the treatment ``credit.py`` reserves for+ balances and is not warranted here.+ """+ existing = await prisma.models.ExpertPod.prisma().count(where={"userId": user_id})+ if existing >= MAX_PODS_PER_USER:+ raise ExpertPodLimitReachedError(MAX_PODS_PER_USER)+ try:+ row = await prisma.models.ExpertPod.prisma().create(+ data={"userId": user_id, "name": name}+ )+ except prisma.errors.UniqueViolationError:+ raise ExpertPodNameTakenError(name)+ return _to_pod(row)+++async def list_pods(user_id: str) -> list[ExpertPod]:+ rows = await prisma.models.ExpertPod.prisma().find_many(+ where={"userId": user_id},+ order={"createdAt": "asc"},+ )+ return [_to_pod(row) for row in rows]+++async def assign_pod(user_id: str, expert_id: str, pod_id: str | None) -> Expert:+ """Move a hired expert into *pod_id*, or clear it when ``None``.++ Both the expert and the target pod must belong to *user_id*; a pod owned+ by someone else is treated as not found rather than silently ignored.+ """+ if pod_id is not None:+ pod = await prisma.models.ExpertPod.prisma().find_first(+ where={"id": pod_id, "userId": user_id}+ )+ if pod is None:+ raise ExpertPodNotFoundError(pod_id)++ try:+ updated = await prisma.models.Expert.prisma().update_many(+ where={+ "id": expert_id,+ "ownerUserId": user_id,+ "isTemplate": False,+ "isArchived": False,+ },+ data={"podId": pod_id},+ )+ except prisma.errors.ForeignKeyViolationError:+ # Clearing the FK cannot violate it, so pod_id is set here: the pod was+ # deleted between the ownership check above and this write. The None+ # branch is unreachable; re-raise rather than name a pod that isn't.+ if pod_id is None:+ raise+ raise ExpertPodNotFoundError(pod_id)+ if updated == 0:+ raise ExpertNotFoundError(expert_id)++ expert = await get_expert(user_id, expert_id)+ if expert is None:+ raise ExpertNotFoundError(expert_id)+ return expert+++def _to_pod(row: prisma.models.ExpertPod) -> ExpertPod:+ return ExpertPod(id=row.id, name=row.name, created_at=row.createdAt)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.pyindex d782cba3f9..5badce24d4 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@@ -2596,6 +2596,224 @@ async def test_seed_backfills_presentation_fields_onto_hired_copies(assert refreshed.name == "My Maria"+# ─── Pods ──────────────────────────────────────────────────────────────+++def _pod_name(prefix: str = "Pod") -> str:+ """Unique per call: pods are unique per (user, name) and the fixed test+ user's pods persist across tests and reruns."""+ return f"{prefix} {uuid.uuid4().hex[:8]}"++[email protected](loop_scope="session")+async def test_create_pod_and_assign_membership(server: SpinTestServer, test_user):+ template = await _seed_template(name="Maria", preload_listings=[])+ hired = await experts_db.hire_expert(test_user.id, template.id, None)++ name = _pod_name("Growth")+ pod = await experts_db.create_pod(test_user.id, name)+ assigned = await experts_db.assign_pod(test_user.id, hired.expert.id, pod.id)+ assert assigned.pod_id == pod.id++ pods = await experts_db.list_pods(test_user.id)+ matching = [p for p in pods if p.id == pod.id]+ assert len(matching) == 1+ assert matching[0].name == name+ # Membership is read off the expert list, not the pod payload.+ experts = await experts_db.list_experts(test_user.id)+ assert {e.id for e in experts if e.pod_id == pod.id} == {hired.expert.id}++[email protected](loop_scope="session")+async def test_create_pod_duplicate_name_raises(server: SpinTestServer, test_user):+ name = _pod_name("Growth")+ await experts_db.create_pod(test_user.id, name)+ with pytest.raises(experts_db.ExpertPodNameTakenError):+ await experts_db.create_pod(test_user.id, name)++[email protected](loop_scope="session")+async def test_create_pod_rejects_past_the_per_user_cap(+ server: SpinTestServer, test_user, monkeypatch: pytest.MonkeyPatch+):+ """The cap counts only the caller's own pods, so it is user-scoped."""+ # The fixed test user's pods persist across tests, so pin the cap one above+ # whatever is already there rather than assuming an empty slate.+ existing = len(await experts_db.list_pods(test_user.id))+ monkeypatch.setattr(experts_db, "MAX_PODS_PER_USER", existing + 1)++ await experts_db.create_pod(test_user.id, _pod_name("Capped"))+ with pytest.raises(experts_db.ExpertPodLimitReachedError):+ await experts_db.create_pod(test_user.id, _pod_name("Overflow"))++[email protected](loop_scope="session")+async def test_pod_names_unique_per_user_not_globally(+ server: SpinTestServer, test_user, other_user+):+ name = _pod_name("Shared")+ mine = await experts_db.create_pod(test_user.id, name)+ theirs = await experts_db.create_pod(other_user.id, name)+ assert mine.id != theirs.id++[email protected](loop_scope="session")+async def test_list_pods_is_user_scoped(server: SpinTestServer, test_user, other_user):+ mine = await experts_db.create_pod(test_user.id, _pod_name("Mine"))+ theirs = await experts_db.create_pod(other_user.id, _pod_name("Theirs"))++ pod_ids = {p.id for p in await experts_db.list_pods(test_user.id)}+ assert mine.id in pod_ids+ assert theirs.id not in pod_ids++[email protected](loop_scope="session")+async def test_list_pods_uses_creation_order(server: SpinTestServer, test_user):+ now = datetime.now(timezone.utc)+ later = await prisma.models.ExpertPod.prisma().create(+ data={+ "userId": test_user.id,+ "name": _pod_name("Later"),+ "createdAt": now + timedelta(days=1),+ }+ )+ earlier = await prisma.models.ExpertPod.prisma().create(+ data={+ "userId": test_user.id,+ "name": _pod_name("Earlier"),+ "createdAt": now,+ }+ )++ ordered_ids = [+ pod.id+ for pod in await experts_db.list_pods(test_user.id)+ if pod.id in {earlier.id, later.id}+ ]+ assert ordered_ids == [earlier.id, later.id]++[email protected](loop_scope="session")+async def test_assign_pod_rejects_other_users_pod(+ server: SpinTestServer, test_user, other_user+):+ template = await _seed_template(name="Maria", preload_listings=[])+ hired = await experts_db.hire_expert(test_user.id, template.id, None)+ foreign_pod = await experts_db.create_pod(other_user.id, _pod_name("Theirs"))++ with pytest.raises(experts_db.ExpertPodNotFoundError):+ await experts_db.assign_pod(test_user.id, hired.expert.id, foreign_pod.id)++[email protected](loop_scope="session")+async def test_assign_pod_rejects_other_users_expert(+ server: SpinTestServer, test_user, other_user+):+ template = await _seed_template(name="Maria", preload_listings=[])+ their_hire = await experts_db.hire_expert(other_user.id, template.id, None)+ pod = await experts_db.create_pod(test_user.id, _pod_name("Growth"))++ with pytest.raises(experts_db.ExpertNotFoundError):+ await experts_db.assign_pod(test_user.id, their_hire.expert.id, pod.id)++ theirs = await experts_db.get_expert(other_user.id, their_hire.expert.id)+ assert theirs is not None+ assert theirs.pod_id is None++[email protected](loop_scope="session")+async def test_assign_pod_rejects_template_expert(server: SpinTestServer, test_user):+ template = await _seed_template(name="Maria", preload_listings=[])+ pod = await experts_db.create_pod(test_user.id, _pod_name("Growth"))++ with pytest.raises(experts_db.ExpertNotFoundError):+ await experts_db.assign_pod(test_user.id, template.id, pod.id)++[email protected](loop_scope="session")+async def test_assign_pod_rejects_archived_expert(server: SpinTestServer, test_user):+ template = await _seed_template(name="Maria", preload_listings=[])+ hired = await experts_db.hire_expert(test_user.id, template.id, None)+ await experts_db.archive_expert(test_user.id, hired.expert.id)+ pod = await experts_db.create_pod(test_user.id, _pod_name("Growth"))++ with pytest.raises(experts_db.ExpertNotFoundError):+ await experts_db.assign_pod(test_user.id, hired.expert.id, pod.id)++[email protected](loop_scope="session")+async def test_assign_pod_unknown_expert_raises(server: SpinTestServer, test_user):+ pod = await experts_db.create_pod(test_user.id, _pod_name("Growth"))+ with pytest.raises(experts_db.ExpertNotFoundError):+ await experts_db.assign_pod(test_user.id, "does-not-exist", pod.id)++[email protected](loop_scope="session")+async def test_assign_pod_none_detaches(server: SpinTestServer, test_user):+ template = await _seed_template(name="Maria", preload_listings=[])+ hired = await experts_db.hire_expert(test_user.id, template.id, None)+ pod = await experts_db.create_pod(test_user.id, _pod_name("Growth"))+ await experts_db.assign_pod(test_user.id, hired.expert.id, pod.id)++ detached = await experts_db.assign_pod(test_user.id, hired.expert.id, None)+ assert detached.pod_id is None++[email protected](loop_scope="session")+async def test_assign_pod_moves_between_pods(server: SpinTestServer, test_user):+ template = await _seed_template(name="Maria", preload_listings=[])+ hired = await experts_db.hire_expert(test_user.id, template.id, None)+ first_pod = await experts_db.create_pod(test_user.id, _pod_name("First"))+ second_pod = await experts_db.create_pod(test_user.id, _pod_name("Second"))+ await experts_db.assign_pod(test_user.id, hired.expert.id, first_pod.id)++ moved = await experts_db.assign_pod(test_user.id, hired.expert.id, second_pod.id)++ assert moved.pod_id == second_pod.id++[email protected](loop_scope="session")+async def test_assign_pod_deleted_concurrently_raises_not_found(+ server: SpinTestServer, test_user+):+ """A pod deleted between the ownership check and the update must surface+ as not-found, not a foreign-key 500."""+ template = await _seed_template(name="Maria", preload_listings=[])+ hired = await experts_db.hire_expert(test_user.id, template.id, None)+ pod = await experts_db.create_pod(test_user.id, _pod_name("Growth"))++ real_find_first = prisma.models.ExpertPod.prisma().find_first++ async def find_then_delete(*args, **kwargs):+ row = await real_find_first(*args, **kwargs)+ await prisma.models.ExpertPod.prisma().delete(where={"id": pod.id})+ return row++ with (+ patch.object(+ prisma.models.ExpertPod.prisma().__class__,+ "find_first",+ side_effect=find_then_delete,+ ),+ pytest.raises(experts_db.ExpertPodNotFoundError),+ ):+ await experts_db.assign_pod(test_user.id, hired.expert.id, pod.id)++[email protected](loop_scope="session")+async def test_deleting_pod_detaches_its_experts(server: SpinTestServer, test_user):+ template = await _seed_template(name="Maria", preload_listings=[])+ hired = await experts_db.hire_expert(test_user.id, template.id, None)+ pod = await experts_db.create_pod(test_user.id, _pod_name("Growth"))+ await experts_db.assign_pod(test_user.id, hired.expert.id, pod.id)++ await prisma.models.ExpertPod.prisma().delete(where={"id": pod.id})++ refreshed = await experts_db.get_expert(test_user.id, hired.expert.id)+ assert refreshed is not None+ assert refreshed.pod_id is None++# ─── Work surface: run composition (pure, no DB) ────────────────────────diff --git a/autogpt_platform/backend/backend/api/features/experts/models.py b/autogpt_platform/backend/backend/api/features/experts/models.pyindex 41984fed5f..be68f3c79c 100644--- a/autogpt_platform/backend/backend/api/features/experts/models.py+++ b/autogpt_platform/backend/backend/api/features/experts/models.py@@ -96,6 +96,18 @@ class Expert(BaseModel):weekly_budget: int | None = Noneweekly_spend: int = 0schedules_paused_at: datetime | None = None+ # Owner-scoped grouping. None = ungrouped ("unpodded").+ pod_id: str | None = None+++# 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):+ """A named group of hired experts, scoped to the owner."""++ id: str+ name: str+ created_at: datetimeclass ExpertRun(BaseModel):diff --git a/autogpt_platform/backend/backend/api/features/experts/routes.py b/autogpt_platform/backend/backend/api/features/experts/routes.pyindex f4e9fa0491..aea7a0efee 100644--- a/autogpt_platform/backend/backend/api/features/experts/routes.py+++ b/autogpt_platform/backend/backend/api/features/experts/routes.py@@ -8,6 +8,7 @@ from backend.api.features.experts.models import (Expert,ExpertDetachPreview,ExpertIdentity,+ ExpertPod,ExpertRun,ExpertSoulUpdate,ExpertWorkflowRef,@@ -31,6 +32,25 @@ class InstallWorkflowRequest(BaseModel):store_listing_version_id: str+class CreatePodRequest(BaseModel):+ name: str = Field(min_length=1, max_length=100)++ @field_validator("name")+ @classmethod+ def strip_name(cls, value: str) -> str:+ stripped = value.strip()+ if not stripped:+ raise ValueError("Pod name must not be blank")+ return stripped+++class AssignPodRequest(BaseModel):+ # Required but nullable: an explicit {"pod_id": null} detaches the+ # expert, while an omitted field is rejected rather than treated as+ # a silent detach.+ pod_id: str | None++class CreateRaisedExpertRequest(BaseModel):name: str = Field(min_length=1, max_length=100)role: str | None = Field(default=None, max_length=100)@@ -135,6 +155,55 @@ async def list_experts(return await experts_db.list_experts(user_id)+# Pod routes are declared before "/{expert_id}" so "/experts/pods" is not+# swallowed by the expert-detail path parameter.+ "/pods",+ operation_id="create_expert_pod",+ responses={409: {"description": "Duplicate pod name, or the pod limit is reached"}},+)+async def create_expert_pod(+ request: CreatePodRequest,+ user_id: str = Security(autogpt_auth_lib.get_user_id),+) -> ExpertPod:+ try:+ return await experts_db.create_pod(user_id, request.name)+ except (+ experts_db.ExpertPodNameTakenError,+ experts_db.ExpertPodLimitReachedError,+ ) as e:+ # 409 rather than 422: the request is well-formed, it conflicts with+ # the caller's existing pods. Keeping 422 for schema validation alone+ # preserves the generated HTTPValidationError shape on this route.+ raise fastapi.HTTPException(status_code=409, detail=str(e))++[email protected]("/pods", operation_id="list_expert_pods")+async def list_expert_pods(+ user_id: str = Security(autogpt_auth_lib.get_user_id),+) -> list[ExpertPod]:+ return await experts_db.list_pods(user_id)+++ "/{expert_id}/pod",+ operation_id="assign_expert_pod",+ responses={404: {"description": "Expert or pod not found"}},+)+async def assign_expert_pod(+ expert_id: str,+ request: AssignPodRequest,+ user_id: str = Security(autogpt_auth_lib.get_user_id),+) -> Expert:+ try:+ return await experts_db.assign_pod(user_id, expert_id, request.pod_id)+ except (+ experts_db.ExpertNotFoundError,+ experts_db.ExpertPodNotFoundError,+ ):+ raise fastapi.HTTPException(status_code=404, detail="Expert or pod not found")++@router.get("/identities", operation_id="list_expert_identities")async def list_expert_identities(user_id: str = Security(autogpt_auth_lib.get_user_id),diff --git a/autogpt_platform/backend/backend/api/features/experts/routes_test.py b/autogpt_platform/backend/backend/api/features/experts/routes_test.pyindex 0088544f4d..43fe93ce28 100644--- a/autogpt_platform/backend/backend/api/features/experts/routes_test.py+++ b/autogpt_platform/backend/backend/api/features/experts/routes_test.py@@ -21,6 +21,7 @@ from backend.api.features.experts.models import (PROTECTED_SOUL_RULES,Expert,ExpertIdentity,+ ExpertPod,ExpertRun,ExpertSoulUpdate,ExpertWorkflowRef,@@ -874,3 +875,252 @@ def test_rehire_dependency_unavailable_returns_503(assert response.json() == {"detail": "Your expert is temporarily unavailable. Try again shortly."}+++# ─── Pods ──────────────────────────────────────────────────────────────+++def _make_pod(**overrides) -> ExpertPod:+ values = {+ "id": "pod-1",+ "name": "Growth",+ "created_at": "2026-08-14T00:00:00Z",+ }+ values.update(overrides)+ return ExpertPod(**values)+++def test_create_pod_returns_pod(+ mocker: pytest_mock.MockerFixture,+ test_user_id: str,+ configured_snapshot: Snapshot,+) -> None:+ mock_create = mocker.patch(+ "backend.api.features.experts.routes.experts_db.create_pod",+ new_callable=AsyncMock,+ return_value=_make_pod(),+ )++ response = client.post("/experts/pods", json={"name": "Growth"})++ assert response.status_code == 200+ assert response.json()["name"] == "Growth"+ mock_create.assert_awaited_once_with(test_user_id, "Growth")+ configured_snapshot.assert_match(+ json.dumps(response.json(), indent=2, sort_keys=True), "expert_pod_create"+ )+++def test_create_pod_strips_name(+ mocker: pytest_mock.MockerFixture,+ test_user_id: str,+) -> None:+ mock_create = mocker.patch(+ "backend.api.features.experts.routes.experts_db.create_pod",+ new_callable=AsyncMock,+ return_value=_make_pod(),+ )++ response = client.post("/experts/pods", json={"name": " Growth "})++ assert response.status_code == 200+ mock_create.assert_awaited_once_with(test_user_id, "Growth")++[email protected]("name", ["", " "])+def test_create_pod_rejects_blank_name(+ name: str,+ mocker: pytest_mock.MockerFixture,+ configured_snapshot: Snapshot,+) -> None:+ mock_create = mocker.patch(+ "backend.api.features.experts.routes.experts_db.create_pod",+ new_callable=AsyncMock,+ return_value=_make_pod(),+ )++ response = client.post("/experts/pods", json={"name": name})++ assert response.status_code == 422+ mock_create.assert_not_awaited()+ if name == " ":+ configured_snapshot.assert_match(+ json.dumps(response.json(), indent=2, sort_keys=True),+ "expert_pod_create_blank_name",+ )+++def test_create_pod_rejects_name_over_max_length(+ mocker: pytest_mock.MockerFixture,+) -> None:+ mock_create = mocker.patch(+ "backend.api.features.experts.routes.experts_db.create_pod",+ new_callable=AsyncMock,+ return_value=_make_pod(),+ )++ response = client.post("/experts/pods", json={"name": "x" * 101})++ assert response.status_code == 422+ mock_create.assert_not_awaited()+++def test_create_pod_at_limit_returns_409(+ mocker: pytest_mock.MockerFixture,+) -> None:+ mocker.patch(+ "backend.api.features.experts.routes.experts_db.create_pod",+ new_callable=AsyncMock,+ side_effect=experts_db.ExpertPodLimitReachedError(experts_db.MAX_PODS_PER_USER),+ )++ response = client.post("/experts/pods", json={"name": "Growth"})++ assert response.status_code == 409+ assert str(experts_db.MAX_PODS_PER_USER) in response.json()["detail"]+++def test_create_pod_duplicate_name_returns_409(+ mocker: pytest_mock.MockerFixture,+) -> None:+ mocker.patch(+ "backend.api.features.experts.routes.experts_db.create_pod",+ new_callable=AsyncMock,+ side_effect=experts_db.ExpertPodNameTakenError("Growth"),+ )++ response = client.post("/experts/pods", json={"name": "Growth"})++ assert response.status_code == 409+++def test_list_pods_returns_user_pods(+ mocker: pytest_mock.MockerFixture,+ test_user_id: str,+ configured_snapshot: Snapshot,+) -> None:+ mock_list = mocker.patch(+ "backend.api.features.experts.routes.experts_db.list_pods",+ new_callable=AsyncMock,+ return_value=[_make_pod()],+ )++ response = client.get("/experts/pods")++ assert response.status_code == 200+ data = response.json()+ assert data[0]["id"] == "pod-1"+ # Membership is not embedded — clients group from Expert.pod_id, so the+ # listing must not carry a members payload at all.+ assert "members" not in data[0]+ mock_list.assert_awaited_once_with(test_user_id)+ configured_snapshot.assert_match(+ json.dumps(data, indent=2, sort_keys=True), "expert_pods_list"+ )+++def test_pods_route_is_not_shadowed_by_expert_detail(+ mocker: pytest_mock.MockerFixture,+) -> None:+ """ "/pods" must win over "/{expert_id}", which only holds while the pod+ routes stay declared first. Fails loudly if they are ever reordered."""+ mock_list = mocker.patch(+ "backend.api.features.experts.routes.experts_db.list_pods",+ new_callable=AsyncMock,+ return_value=[_make_pod()],+ )+ mock_get = mocker.patch(+ "backend.api.features.experts.routes.experts_db.get_expert",+ new_callable=AsyncMock,+ return_value=_make_expert(),+ )++ response = client.get("/experts/pods")++ assert response.status_code == 200+ mock_list.assert_awaited_once()+ mock_get.assert_not_awaited()+++def test_assign_pod_returns_updated_expert(+ mocker: pytest_mock.MockerFixture,+ test_user_id: str,+ configured_snapshot: Snapshot,+) -> None:+ mock_assign = mocker.patch(+ "backend.api.features.experts.routes.experts_db.assign_pod",+ new_callable=AsyncMock,+ return_value=_make_expert(pod_id="pod-1"),+ )++ response = client.patch("/experts/expert-1/pod", json={"pod_id": "pod-1"})++ assert response.status_code == 200+ assert response.json()["pod_id"] == "pod-1"+ mock_assign.assert_awaited_once_with(test_user_id, "expert-1", "pod-1")+ configured_snapshot.assert_match(+ json.dumps(response.json(), indent=2, sort_keys=True), "expert_pod_assign"+ )+++def test_assign_pod_null_detaches(+ mocker: pytest_mock.MockerFixture,+ test_user_id: str,+) -> None:+ mock_assign = mocker.patch(+ "backend.api.features.experts.routes.experts_db.assign_pod",+ new_callable=AsyncMock,+ return_value=_make_expert(pod_id=None),+ )++ response = client.patch("/experts/expert-1/pod", json={"pod_id": None})++ assert response.status_code == 200+ assert response.json()["pod_id"] is None+ mock_assign.assert_awaited_once_with(test_user_id, "expert-1", None)+++def test_assign_pod_requires_explicit_pod_id(+ mocker: pytest_mock.MockerFixture,+) -> None:+ """An empty body must not be interpreted as a detach."""+ mock_assign = mocker.patch(+ "backend.api.features.experts.routes.experts_db.assign_pod",+ new_callable=AsyncMock,+ return_value=_make_expert(pod_id=None),+ )++ response = client.patch("/experts/expert-1/pod", json={})++ assert response.status_code == 422+ mock_assign.assert_not_awaited()+++def test_assign_pod_unknown_expert_returns_404(+ mocker: pytest_mock.MockerFixture,+) -> None:+ mocker.patch(+ "backend.api.features.experts.routes.experts_db.assign_pod",+ new_callable=AsyncMock,+ side_effect=experts_db.ExpertNotFoundError("nope"),+ )++ response = client.patch("/experts/nope/pod", json={"pod_id": "pod-1"})++ assert response.status_code == 404+ assert response.json()["detail"] == "Expert or pod not found"+++def test_assign_pod_unknown_pod_returns_404(+ mocker: pytest_mock.MockerFixture,+) -> None:+ mocker.patch(+ "backend.api.features.experts.routes.experts_db.assign_pod",+ new_callable=AsyncMock,+ side_effect=experts_db.ExpertPodNotFoundError("nope"),+ )++ response = client.patch("/experts/expert-1/pod", json={"pod_id": "nope"})++ assert response.status_code == 404+ assert response.json()["detail"] == "Expert or pod not found"diff --git a/autogpt_platform/backend/migrations/20260814120000_add_expert_pods/migration.sql b/autogpt_platform/backend/migrations/20260814120000_add_expert_pods/migration.sqlnew file mode 100644index 0000000000..afe4fb756f--- /dev/null+++ b/autogpt_platform/backend/migrations/20260814120000_add_expert_pods/migration.sql@@ -0,0 +1,24 @@+-- CreateTable+CREATE TABLE "ExpertPod" (+ "id" TEXT NOT NULL,+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,+ "userId" TEXT NOT NULL,+ "name" TEXT NOT NULL,++ CONSTRAINT "ExpertPod_pkey" PRIMARY KEY ("id")+);++-- CreateIndex+CREATE UNIQUE INDEX "ExpertPod_userId_name_key" ON "ExpertPod"("userId", "name");++-- AlterTable+ALTER TABLE "Expert" ADD COLUMN "podId" TEXT;++-- CreateIndex+CREATE INDEX "Expert_podId_idx" ON "Expert"("podId");++-- AddForeignKey+ALTER TABLE "ExpertPod" ADD CONSTRAINT "ExpertPod_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "Expert" ADD CONSTRAINT "Expert_podId_fkey" FOREIGN KEY ("podId") REFERENCES "ExpertPod"("id") ON DELETE SET NULL ON UPDATE CASCADE;diff --git a/autogpt_platform/backend/schema.prisma b/autogpt_platform/backend/schema.prismaindex f3f422d11a..f1f29105a7 100644--- a/autogpt_platform/backend/schema.prisma+++ b/autogpt_platform/backend/schema.prisma@@ -141,6 +141,7 @@ model User {LibraryAgents LibraryAgent[]LibraryFolders LibraryFolder[]OwnedExperts Expert[]+ ExpertPods ExpertPod[]Profile Profile[]UserOnboarding UserOnboarding?@@ -898,6 +899,10 @@ model Expert {AgentPresets AgentPreset[]PauseEvents ExpertPauseEvent[]+ // Owner-scoped grouping into named "pods" (distinct from org-tenancy Team).+ podId String?+ Pod ExpertPod? @relation(fields: [podId], references: [id], onDelete: SetNull)+// TenancyorganizationId String?teamId String?@@ -911,6 +916,7 @@ model Expert {@@index([isTemplate, isArchived])@@index([teamId])@@index([organizationId])+ @@index([podId])}// Join between an Expert and a workflow (marketplace agent) installed on it.@@ -958,6 +964,24 @@ model ExpertPauseEvent {@@index([expertId, createdAt])}+// A user-owned named group of the user's own experts. Distinct from the+// org-tenancy Team model: pods are a personal roster grouping with no+// members, invites, or org. Deleting a pod detaches its experts (SetNull).+model ExpertPod {+ id String @id @default(uuid())+ createdAt DateTime @default(now())++ userId String+ User User @relation(fields: [userId], references: [id], onDelete: Cascade)++ name String++ Experts Expert[]++ // Doubles as the userId lookup index for list_pods.+ @@unique([userId, name])+}+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// AGENT DEFINITION AND EXECUTION TABLES ////////diff --git a/autogpt_platform/backend/snapshots/expert_pod_assign b/autogpt_platform/backend/snapshots/expert_pod_assignnew file mode 100644index 0000000000..4b9b4ab758--- /dev/null+++ b/autogpt_platform/backend/snapshots/expert_pod_assign@@ -0,0 +1,27 @@+{+ "avatar_url": null,+ "bio": null,+ "boundaries": "Ask before external actions.",+ "id": "expert-1",+ "identity": "You are Maria, a pragmatic marketing specialist.",+ "is_archived": false,+ "is_template": false,+ "last_run_at": null,+ "last_run_status": null,+ "name": "Maria",+ "pod_id": "pod-1",+ "protected_soul_rules": [+ "The expert discloses that it is AI when acting externally.",+ "External actions require approval."+ ],+ "role": "Marketing Specialist",+ "schedules_paused_at": null,+ "skills": [],+ "source_template_id": "template-1",+ "tagline": "Grows your audience",+ "voice_preferences": "Direct and concise.",+ "voice_samples": [],+ "weekly_budget": null,+ "weekly_spend": 0,+ "workflows": []+}\ No newline at end of filediff --git a/autogpt_platform/backend/snapshots/expert_pod_create b/autogpt_platform/backend/snapshots/expert_pod_createnew file mode 100644index 0000000000..b39b160f5d--- /dev/null+++ b/autogpt_platform/backend/snapshots/expert_pod_create@@ -0,0 +1,5 @@+{+ "created_at": "2026-08-14T00:00:00Z",+ "id": "pod-1",+ "name": "Growth"+}\ No newline at end of filediff --git a/autogpt_platform/backend/snapshots/expert_pod_create_blank_name b/autogpt_platform/backend/snapshots/expert_pod_create_blank_namenew file mode 100644index 0000000000..38e2d0d440--- /dev/null+++ b/autogpt_platform/backend/snapshots/expert_pod_create_blank_name@@ -0,0 +1,16 @@+{+ "detail": [+ {+ "ctx": {+ "error": {}+ },+ "input": " ",+ "loc": [+ "body",+ "name"+ ],+ "msg": "Value error, Pod name must not be blank",+ "type": "value_error"+ }+ ]+}\ No newline at end of filediff --git a/autogpt_platform/backend/snapshots/expert_pods_list b/autogpt_platform/backend/snapshots/expert_pods_listnew file mode 100644index 0000000000..0fe5373f7e--- /dev/null+++ b/autogpt_platform/backend/snapshots/expert_pods_list@@ -0,0 +1,7 @@+[+ {+ "created_at": "2026-08-14T00:00:00Z",+ "id": "pod-1",+ "name": "Growth"+ }+]\ No newline at end of filediff --git a/autogpt_platform/backend/snapshots/expert_raise_default b/autogpt_platform/backend/snapshots/expert_raise_defaultindex 72161f196f..307a09efbc 100644--- a/autogpt_platform/backend/snapshots/expert_raise_default+++ b/autogpt_platform/backend/snapshots/expert_raise_default@@ -10,6 +10,7 @@"last_run_at": null,"last_run_status": null,"name": "Otto",+ "pod_id": null,"protected_soul_rules": ["The expert discloses that it is AI when acting externally.","External actions require approval."diff --git a/autogpt_platform/backend/snapshots/expert_raise_first_job b/autogpt_platform/backend/snapshots/expert_raise_first_jobindex 4c210830c9..c33aaa9081 100644--- a/autogpt_platform/backend/snapshots/expert_raise_first_job+++ b/autogpt_platform/backend/snapshots/expert_raise_first_job@@ -10,6 +10,7 @@"last_run_at": null,"last_run_status": null,"name": "Nova",+ "pod_id": null,"protected_soul_rules": ["The expert discloses that it is AI when acting externally.","External actions require approval."diff --git a/autogpt_platform/backend/snapshots/expert_raise_first_job_installation_failure b/autogpt_platform/backend/snapshots/expert_raise_first_job_installation_failureindex dff6d632fa..6be476a48d 100644--- a/autogpt_platform/backend/snapshots/expert_raise_first_job_installation_failure+++ b/autogpt_platform/backend/snapshots/expert_raise_first_job_installation_failure@@ -10,6 +10,7 @@"last_run_at": null,"last_run_status": null,"name": "Nova",+ "pod_id": null,"protected_soul_rules": ["The expert discloses that it is AI when acting externally.","External actions require approval."diff --git a/autogpt_platform/backend/snapshots/expert_soul_update b/autogpt_platform/backend/snapshots/expert_soul_updateindex 6cdb97beea..b0c5719248 100644--- a/autogpt_platform/backend/snapshots/expert_soul_update+++ b/autogpt_platform/backend/snapshots/expert_soul_update@@ -9,6 +9,7 @@"last_run_at": null,"last_run_status": null,"name": "Mara",+ "pod_id": null,"protected_soul_rules": ["The expert discloses that it is AI when acting externally.","External actions require approval."diff --git a/autogpt_platform/backend/snapshots/expert_templates_list b/autogpt_platform/backend/snapshots/expert_templates_listindex d3aeb90860..c3c52119e1 100644--- a/autogpt_platform/backend/snapshots/expert_templates_list+++ b/autogpt_platform/backend/snapshots/expert_templates_list@@ -10,6 +10,7 @@"last_run_at": null,"last_run_status": null,"name": "Maria",+ "pod_id": null,"protected_soul_rules": ["The expert discloses that it is AI when acting externally.","External actions require approval."diff --git a/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsxindex dc0b2ec3d5..33377872a8 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsx@@ -5,6 +5,10 @@ import {getInstallExpertWorkflowMockHandler,getInstallExpertWorkflowMockHandler404,getInstallExpertWorkflowMockHandler422,+ getAssignExpertPodMockHandler,+ getCreateExpertPodMockHandler,+ getListExpertPodsMockHandler,+ getListExpertPodsMockHandler401,getListExpertsMockHandler,getListExpertsMockHandler401,getResumeExpertSchedulesMockHandler,@@ -18,6 +22,7 @@ import {} from "@/app/api/__generated__/endpoints/library/library.msw";import { getGetV1ListExecutionSchedulesForAUserMockHandler } from "@/app/api/__generated__/endpoints/schedules/schedules.msw";import { Expert } from "@/app/api/__generated__/models/expert";+import { ExpertPod } from "@/app/api/__generated__/models/expertPod";import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";import { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";import { server } from "@/mocks/mock-server";@@ -120,6 +125,7 @@ function makeSchedule(beforeEach(() => {server.use(getGetV1ListExecutionSchedulesForAUserMockHandler([]),+ getListExpertPodsMockHandler([]),getGetV2ListLibraryAgentsMockHandler200(libraryResponse([])),);});@@ -170,6 +176,11 @@ vi.mock("next/navigation", () => ({},}));+async function openNewPodDialog(user: ReturnType<typeof userEvent.setup>) {+ await user.click(await screen.findByRole("button", { name: /create/i }));+ await user.click(await screen.findByRole("menuitem", { name: "New pod" }));+}+const hiredMaria: Expert = {id: "expert-maria",name: "Maria",@@ -259,6 +270,8 @@ describe("TeamPage", () => {name: "Build an agent from scratch",});expect(build.getAttribute("href")).toBe("/build");++ expect(screen.getByRole("menuitem", { name: "New pod" })).toBeDefined();});test("renders hired experts with a workflow count instead of chips", async () => {@@ -843,6 +856,301 @@ describe("TeamPage", () => {expect(await screen.findByText("Something went wrong")).toBeDefined();});+ test("groups experts under their pod with ungrouped members below", async () => {+ const growthPod: ExpertPod = {+ id: "pod-growth",+ name: "Growth",+ created_at: new Date("2026-08-14T00:00:00Z"),+ };+ const poddedMaria: Expert = { ...hiredMaria, pod_id: "pod-growth" };+ const lee: Expert = {+ ...hiredMaria,+ id: "expert-lee",+ name: "Lee",+ pod_id: null,+ };+ const archivedPoddedSam: Expert = {+ ...hiredMaria,+ id: "expert-sam",+ name: "Sam",+ pod_id: "pod-growth",+ is_archived: true,+ };+ server.use(+ getListExpertsMockHandler([poddedMaria, lee, archivedPoddedSam]),+ getListExpertPodsMockHandler([growthPod]),+ );++ render(<TeamPage />);++ const podHeader = await screen.findByRole("heading", { name: "Growth" });+ const maria = await screen.findByText("Maria");+ const leeNode = await screen.findByText("Lee");+ // Maria sits under the pod header; Lee is ungrouped below.+ const noPodHeader = screen.getByRole("heading", { name: "Ungrouped" });+ expect(+ podHeader.compareDocumentPosition(maria) &+ Node.DOCUMENT_POSITION_FOLLOWING,+ ).toBeTruthy();+ expect(+ maria.compareDocumentPosition(noPodHeader) &+ Node.DOCUMENT_POSITION_FOLLOWING,+ ).toBeTruthy();+ expect(+ noPodHeader.compareDocumentPosition(leeNode) &+ Node.DOCUMENT_POSITION_FOLLOWING,+ ).toBeTruthy();+ // Archived experts never render, even with a pod_id.+ expect(screen.queryByText("Sam")).toBeNull();+ });++ test("shows a pod with no members instead of hiding it", async () => {+ const emptyPod: ExpertPod = {+ id: "pod-empty",+ name: "Support",+ created_at: new Date("2026-08-14T00:00:00Z"),+ };+ server.use(+ getListExpertsMockHandler([hiredMaria]),+ getListExpertPodsMockHandler([emptyPod]),+ );++ render(<TeamPage />);++ const podHeader = await screen.findByRole("heading", { name: "Support" });+ const emptyCopy = await screen.findByText("No experts in this pod yet.");+ expect(+ podHeader.compareDocumentPosition(emptyCopy) &+ Node.DOCUMENT_POSITION_FOLLOWING,+ ).toBeTruthy();+ // The unpodded expert still renders under its own section.+ expect(await screen.findByText("Maria")).toBeDefined();+ });++ test("creates a pod from the New pod dialog", async () => {+ const user = userEvent.setup();+ let createdName: string | undefined;+ server.use(+ getListExpertsMockHandler([hiredMaria]),+ getCreateExpertPodMockHandler(async ({ request }) => {+ const body = (await request.json()) as { name: string };+ createdName = body.name;+ return {+ id: "pod-new",+ name: body.name,+ created_at: new Date("2026-08-14T00:00:00Z"),+ };+ }),+ );++ render(<TeamPage />);++ await openNewPodDialog(user);+ const nameInput = await screen.findByRole("textbox", { name: /pod name/i });+ await user.type(nameInput, "Growth");+ await user.click(screen.getByRole("button", { name: "Create pod" }));++ await waitFor(() => expect(createdName).toBe("Growth"));+ });++ test("keeps the New pod dialog open and shows the reason when creation fails", async () => {+ const user = userEvent.setup();+ server.use(+ getListExpertsMockHandler([hiredMaria]),+ http.post("/api/proxy/api/experts/pods", () =>+ HttpResponse.json(+ { detail: "A pod named 'Growth' already exists" },+ { status: 409 },+ ),+ ),+ );++ render(<TeamPage />);++ await openNewPodDialog(user);+ const nameInput = await screen.findByRole("textbox", { name: /pod name/i });+ await user.type(nameInput, "Growth");+ await user.click(screen.getByRole("button", { name: "Create pod" }));++ await waitFor(() =>+ expect(toastMock).toHaveBeenCalledWith(+ expect.objectContaining({+ title: "Could not create pod",+ description: "A pod named 'Growth' already exists",+ variant: "destructive",+ }),+ ),+ );+ // The dialog must survive the failure with the typed name intact.+ expect(screen.getByRole("dialog", { name: "New pod" })).toBeDefined();+ expect((nameInput as HTMLInputElement).value).toBe("Growth");+ });++ test("clears the pod name after cancelling and reopening the dialog", async () => {+ const user = userEvent.setup();+ server.use(getListExpertsMockHandler([hiredMaria]));++ render(<TeamPage />);++ await openNewPodDialog(user);+ const nameInput = await screen.findByRole("textbox", { name: /pod name/i });+ expect(nameInput.getAttribute("maxlength")).toBe("100");+ await user.type(nameInput, "Draft pod");+ await user.click(screen.getByRole("button", { name: "Cancel" }));+ await waitFor(() =>+ expect(screen.queryByRole("dialog", { name: "New pod" })).toBeNull(),+ );++ await openNewPodDialog(user);+ const reopenedNameInput = await screen.findByRole("textbox", {+ name: /pod name/i,+ });+ expect((reopenedNameInput as HTMLInputElement).value).toBe("");+ });++ test("moves an expert into a pod from the card menu", async () => {+ const user = userEvent.setup();+ const growthPod: ExpertPod = {+ id: "pod-growth",+ name: "Growth",+ created_at: new Date("2026-08-14T00:00:00Z"),+ };+ let assignedPodId: string | null | undefined;+ let expertRequests = 0;+ server.use(+ getListExpertsMockHandler(() => {+ expertRequests += 1;+ return [hiredMaria];+ }),+ getListExpertPodsMockHandler([growthPod]),+ getAssignExpertPodMockHandler(async ({ request }) => {+ const body = (await request.json()) as { pod_id: string | null };+ assignedPodId = body.pod_id;+ return { ...hiredMaria, pod_id: body.pod_id };+ }),+ );++ render(<TeamPage />);++ await screen.findByText("Maria");+ await waitFor(() => expect(expertRequests).toBe(1));+ await user.click(screen.getByRole("button", { name: "Move to pod" }));+ await user.click(await screen.findByRole("menuitem", { name: /Growth/ }));++ await waitFor(() => expect(assignedPodId).toBe("pod-growth"));+ expect(toastMock).toHaveBeenCalledWith({ title: "Moved to Growth" });+ // The PATCH response is written into the cache, so the heavy roster query+ // is never refetched and the card reflects the move immediately.+ expect(+ await screen.findByRole("button", {+ name: "Move to pod (currently Growth)",+ }),+ ).toBeDefined();+ expect(expertRequests).toBe(1);+ });++ test("removes an expert from its pod from the card menu", async () => {+ const user = userEvent.setup();+ const growthPod: ExpertPod = {+ id: "pod-growth",+ name: "Growth",+ created_at: new Date("2026-08-14T00:00:00Z"),+ };+ const poddedMaria: Expert = { ...hiredMaria, pod_id: growthPod.id };+ let assignedPodId: string | null | undefined;+ server.use(+ getListExpertsMockHandler([poddedMaria]),+ getListExpertPodsMockHandler([growthPod]),+ getAssignExpertPodMockHandler(async ({ request }) => {+ const body = (await request.json()) as { pod_id: string | null };+ assignedPodId = body.pod_id;+ return { ...poddedMaria, pod_id: body.pod_id };+ }),+ );++ render(<TeamPage />);++ await screen.findByText("Maria");+ // The trigger names the pod the expert is already in.+ const trigger = screen.getByRole("button", {+ name: "Move to pod (currently Growth)",+ });+ expect(trigger.textContent).toContain("Growth");+ await user.click(trigger);+ await user.click(+ await screen.findByRole("menuitem", { name: "Remove from pod" }),+ );++ await waitFor(() => expect(assignedPodId).toBeNull());+ expect(toastMock).toHaveBeenCalledWith({ title: "Removed from pod" });+ });++ test("shows the assign failure reason and refreshes stale pods", async () => {+ const user = userEvent.setup();+ const growthPod: ExpertPod = {+ id: "pod-growth",+ name: "Growth",+ created_at: new Date("2026-08-14T00:00:00Z"),+ };+ let podRequests = 0;+ server.use(+ getListExpertsMockHandler([hiredMaria]),+ getListExpertPodsMockHandler(() => {+ podRequests += 1;+ return podRequests === 1 ? [growthPod] : [];+ }),+ http.patch("/api/proxy/api/experts/expert-maria/pod", () =>+ HttpResponse.json(+ { detail: "Expert or pod not found" },+ { status: 404 },+ ),+ ),+ );++ render(<TeamPage />);++ await screen.findByText("Maria");+ await user.click(screen.getByRole("button", { name: "Move to pod" }));+ await user.click(await screen.findByRole("menuitem", { name: /Growth/ }));++ await waitFor(() =>+ expect(toastMock).toHaveBeenCalledWith({+ title: "Could not move expert",+ description: "Expert or pod not found",+ variant: "destructive",+ }),+ );+ await waitFor(() =>+ expect(screen.queryByRole("button", { name: "Move to pod" })).toBeNull(),+ );+ });++ test("keeps the roster in loading state until pods resolve", async () => {+ server.use(+ getListExpertsMockHandler([hiredMaria]),+ getListExpertPodsMockHandler(() => new Promise(() => {})),+ );++ render(<TeamPage />);++ await screen.findByText("Autopilot");+ await new Promise((resolve) => setTimeout(resolve, 50));+ // Experts resolved but pods have not: no card may render yet, or a+ // podded expert would flash as ungrouped.+ expect(screen.queryByText("Maria")).toBeNull();+ });++ test("shows an error card when loading pods fails", async () => {+ server.use(+ getListExpertsMockHandler([hiredMaria]),+ getListExpertPodsMockHandler401(),+ );++ render(<TeamPage />);++ expect(await screen.findByText("Something went wrong")).toBeDefined();+ });+test("calls notFound() when the flag is resolved and disabled", () => {let listRequests = 0;server.use(diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/CreateMenu/CreateMenu.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/CreateMenu/CreateMenu.tsxindex 8c0d8f1ab7..ab9999f55f 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/components/CreateMenu/CreateMenu.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/CreateMenu/CreateMenu.tsx@@ -13,10 +13,15 @@ import {FlowIcon,PlusSignIcon,UserAdd01Icon,+ UserGroupIcon,} from "@hugeicons/core-free-icons";import Link from "next/link";-export function CreateMenu() {+interface Props {+ onNewPod: () => void;+}++export function CreateMenu({ onNewPod }: Props) {return (<DropdownMenu><DropdownMenuTrigger asChild>@@ -40,6 +45,10 @@ export function CreateMenu() {Build an agent from scratch</Link></DropdownMenuItem>+ <DropdownMenuItem onSelect={onNewPod}>+ <Icon icon={UserGroupIcon} className="mr-2 size-4" />+ New pod+ </DropdownMenuItem></DropdownMenuContent></DropdownMenu>);diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/ExpertTeamCard.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/ExpertTeamCard.tsxindex f6d70c6e05..9afd72d13d 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/ExpertTeamCard.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/ExpertTeamCard.tsx@@ -1,4 +1,5 @@import { Expert } from "@/app/api/__generated__/models/expert";+import { ExpertPod } from "@/app/api/__generated__/models/expertPod";import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";import {Avatar,@@ -6,14 +7,25 @@ import {AvatarImage,} from "@/components/atoms/Avatar/Avatar";import { Button } from "@/components/atoms/Button/Button";-import { cn } from "@/lib/utils";-import Link from "next/link";import { Icon } from "@/components/atoms/Icon/Icon";+import { Progress } from "@/components/atoms/Progress/Progress";import { Text } from "@/components/atoms/Text/Text";-import { PencilIcon, PlusSignIcon } from "@hugeicons/core-free-icons";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuSeparator,+ DropdownMenuTrigger,+} from "@/components/molecules/DropdownMenu/DropdownMenu";+import { cn } from "@/lib/utils";+import {+ PencilIcon,+ PlusSignIcon,+ Tick02Icon,+ UserGroupIcon,+} from "@hugeicons/core-free-icons";+import Link from "next/link";import { MouseEvent } from "react";--import { Progress } from "@/components/atoms/Progress/Progress";import {getNeedsSetupCount,getScheduleCountLabel,@@ -26,15 +38,21 @@ import { useExpertTeamCard } from "./useExpertTeamCard";interface Props {expert: Expert;schedules: GraphExecutionJobInfo[];+ pods: ExpertPod[];+ currentPod: ExpertPod | undefined;onInstallWorkflow: (expertId: string) => void;onEditSoul: (expertId: string) => void;+ onAssignPod: (expertId: string, podId: string | null) => void;}export function ExpertTeamCard({expert,schedules,+ pods,+ currentPod,onInstallWorkflow,onEditSoul,+ onAssignPod,}: Props) {const workflowCount = expert.workflows.length;const needsSetupCount = getNeedsSetupCount(expert, schedules);@@ -156,6 +174,50 @@ export function ExpertTeamCard({>Install workflow</Button>+ {pods.length > 0 ? (+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button+ variant="ghost"+ size="small"+ leftIcon={<Icon icon={UserGroupIcon} size={16} />}+ aria-label={+ currentPod+ ? `Move to pod (currently ${currentPod.name})`+ : "Move to pod"+ }+ >+ {currentPod ? currentPod.name : "Move to pod"}+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent+ align="end"+ className="max-h-72 w-52 overflow-y-auto"+ >+ {pods.map((pod) => (+ <DropdownMenuItem+ key={pod.id}+ onSelect={() => onAssignPod(expert.id, pod.id)}+ >+ <span className="flex-1 truncate">{pod.name}</span>+ {expert.pod_id === pod.id ? (+ <Icon icon={Tick02Icon} size={16} className="ml-2" />+ ) : null}+ </DropdownMenuItem>+ ))}+ {expert.pod_id ? (+ <>+ <DropdownMenuSeparator />+ <DropdownMenuItem+ onSelect={() => onAssignPod(expert.id, null)}+ >+ Remove from pod+ </DropdownMenuItem>+ </>+ ) : null}+ </DropdownMenuContent>+ </DropdownMenu>+ ) : null}</div><FireExpertDialogexpertId={expert.id}diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/NewPodDialog/NewPodDialog.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/NewPodDialog/NewPodDialog.tsxnew file mode 100644index 0000000000..341fdae83c--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/NewPodDialog/NewPodDialog.tsx@@ -0,0 +1,69 @@+"use client";++import { Button } from "@/components/atoms/Button/Button";+import { Input } from "@/components/atoms/Input/Input";+import { Dialog } from "@/components/molecules/Dialog/Dialog";+import { FormEvent, useEffect, useState } from "react";+import { POD_NAME_MAX_LENGTH } from "../../helpers";++interface Props {+ open: boolean;+ onClose: () => void;+ onCreate: (name: string) => void;+ isCreating: boolean;+}++export function NewPodDialog({ open, onClose, onCreate, isCreating }: Props) {+ const [name, setName] = useState("");+ const trimmed = name.trim();++ useEffect(() => {+ if (!open) setName("");+ }, [open]);++ function handleSubmit(event: FormEvent) {+ event.preventDefault();+ if (!trimmed) return;+ onCreate(trimmed);+ }++ return (+ <Dialog+ title="New pod"+ styling={{ maxWidth: "28rem" }}+ controlled={{+ isOpen: open,+ set: (next) => {+ if (!next) onClose();+ },+ }}+ >+ <Dialog.Content>+ <form onSubmit={handleSubmit} className="flex flex-col gap-4 px-1">+ <Input+ id="pod-name"+ label="Pod name"+ placeholder="e.g. Growth"+ value={name}+ maxLength={POD_NAME_MAX_LENGTH}+ onChange={(event) => setName(event.target.value)}+ wrapperClassName="!mb-0"+ />+ <div className="flex justify-end gap-2">+ <Button type="button" variant="secondary" onClick={onClose}>+ Cancel+ </Button>+ <Button+ type="submit"+ variant="primary"+ disabled={!trimmed || isCreating}+ loading={isCreating}+ >+ Create pod+ </Button>+ </div>+ </form>+ </Dialog.Content>+ </Dialog>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/TeamRoster/TeamRoster.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/TeamRoster/TeamRoster.tsxnew file mode 100644index 0000000000..87087607e7--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/TeamRoster/TeamRoster.tsx@@ -0,0 +1,87 @@+import { Expert } from "@/app/api/__generated__/models/expert";+import { ExpertPod } from "@/app/api/__generated__/models/expertPod";+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";+import { Text } from "@/components/atoms/Text/Text";+import { ReactNode } from "react";+import { TEAM_GRID_CLASS } from "../../helpers";+import { AutopilotCard } from "../AutopilotCard";++interface Props {+ isLoading: boolean;+ podGroups: { pod: ExpertPod; experts: Expert[] }[];+ ungroupedExperts: Expert[];+ renderCard: (expert: Expert) => ReactNode;+}++interface SectionHeaderProps {+ name: string;+ count: number;+}++export function TeamRoster({+ isLoading,+ podGroups,+ ungroupedExperts,+ renderCard,+}: Props) {+ if (isLoading) {+ return (+ <div className={TEAM_GRID_CLASS}>+ <AutopilotCard />+ {[0, 1, 2].map((index) => (+ <Skeleton key={index} className="h-48 w-full rounded-2xl" />+ ))}+ </div>+ );+ }++ if (podGroups.length === 0) {+ return (+ <div className={TEAM_GRID_CLASS}>+ <AutopilotCard />+ {ungroupedExperts.map(renderCard)}+ </div>+ );+ }++ return (+ <div className="space-y-8">+ <div className={TEAM_GRID_CLASS}>+ <AutopilotCard />+ </div>+ {podGroups.map((group) => (+ <section key={group.pod.id} className="space-y-3">+ <SectionHeader name={group.pod.name} count={group.experts.length} />+ {group.experts.length > 0 ? (+ <div className={TEAM_GRID_CLASS}>+ {group.experts.map(renderCard)}+ </div>+ ) : (+ <Text variant="small" className="text-zinc-500">+ No experts in this pod yet.+ </Text>+ )}+ </section>+ ))}+ {ungroupedExperts.length > 0 ? (+ <section className="space-y-3">+ <SectionHeader name="Ungrouped" count={ungroupedExperts.length} />+ <div className={TEAM_GRID_CLASS}>+ {ungroupedExperts.map(renderCard)}+ </div>+ </section>+ ) : null}+ </div>+ );+}++function SectionHeader({ name, count }: SectionHeaderProps) {+ return (+ <div className="flex items-baseline gap-2">+ <Text variant="h4">{name}</Text>+ <Text variant="small" className="text-zinc-500">+ {count} {count === 1 ? "expert" : "experts"}+ </Text>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/team/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/team/helpers.test.tsnew file mode 100644index 0000000000..b83d3ca322--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/team/helpers.test.ts@@ -0,0 +1,92 @@+import { Expert } from "@/app/api/__generated__/models/expert";+import { ExpertPod } from "@/app/api/__generated__/models/expertPod";+import { describe, expect, test } from "vitest";+import { getAssignToastTitle, groupExpertsByPods } from "./helpers";++function makeExpert(id: string, podId: string | null = null): Expert {+ return {+ id,+ name: id,+ avatar_url: null,+ role: "Role",+ tagline: null,+ bio: null,+ skills: [],+ identity: "identity",+ voice_preferences: "",+ boundaries: "",+ protected_soul_rules: [],+ is_template: false,+ source_template_id: null,+ is_archived: false,+ workflows: [],+ pod_id: podId,+ };+}++function makePod(id: string, name: string): ExpertPod {+ return { id, name, created_at: new Date("2026-08-14T00:00:00Z") };+}++describe("groupExpertsByPods", () => {+ test("places experts under their pod and the rest ungrouped", () => {+ const growth = makePod("pod-growth", "Growth");+ const support = makePod("pod-support", "Support");+ const { groups, ungrouped } = groupExpertsByPods(+ [+ makeExpert("maria", "pod-growth"),+ makeExpert("sam", "pod-support"),+ makeExpert("lee"),+ ],+ [growth, support],+ );++ expect(groups.map((g) => g.pod.name)).toEqual(["Growth", "Support"]);+ expect(groups[0].experts.map((e) => e.id)).toEqual(["maria"]);+ expect(groups[1].experts.map((e) => e.id)).toEqual(["sam"]);+ expect(ungrouped.map((e) => e.id)).toEqual(["lee"]);+ });++ test("keeps an empty pod as a group", () => {+ const { groups } = groupExpertsByPods(+ [makeExpert("lee")],+ [makePod("pod-empty", "Empty")],+ );+ expect(groups).toHaveLength(1);+ expect(groups[0].experts).toEqual([]);+ });++ test("treats a dangling pod_id as ungrouped", () => {+ const { groups, ungrouped } = groupExpertsByPods(+ [makeExpert("maria", "pod-deleted")],+ [makePod("pod-growth", "Growth")],+ );+ expect(groups[0].experts).toEqual([]);+ expect(ungrouped.map((e) => e.id)).toEqual(["maria"]);+ });++ test("returns everything ungrouped when there are no pods", () => {+ const { groups, ungrouped } = groupExpertsByPods(+ [makeExpert("maria"), makeExpert("sam")],+ [],+ );+ expect(groups).toEqual([]);+ expect(ungrouped).toHaveLength(2);+ });+});++describe("getAssignToastTitle", () => {+ test("names the destination pod when it is known", () => {+ expect(+ getAssignToastTitle({ podId: "pod-growth", destinationName: "Growth" }),+ ).toBe("Moved to Growth");+ });++ test("falls back to a generic title when the pod list is stale", () => {+ expect(getAssignToastTitle({ podId: "pod-growth" })).toBe("Expert moved");+ });++ test("reports a detach regardless of the destination name", () => {+ expect(getAssignToastTitle({ podId: null })).toBe("Removed from pod");+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/team/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/team/helpers.tsindex a2e69c0e9a..b75fe38725 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/helpers.ts+++ b/autogpt_platform/frontend/src/app/(platform)/team/helpers.ts@@ -1,8 +1,60 @@import { Expert } from "@/app/api/__generated__/models/expert";+import { ExpertPod } from "@/app/api/__generated__/models/expertPod";import { ExpertWorkflowRef } from "@/app/api/__generated__/models/expertWorkflowRef";import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";import { formatDistanceToNow } from "date-fns";+interface PodGroup {+ pod: ExpertPod;+ experts: Expert[];+}++export const TEAM_GRID_CLASS =+ "grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3";++/** Mirrors `CreatePodRequest.name`'s `max_length` on the backend. */+export const POD_NAME_MAX_LENGTH = 100;++interface AssignToastArgs {+ podId: string | null;+ destinationName?: string;+}++/** `destinationName` is absent when the target pod is missing from the locally+ * cached pod list, which the caller repairs by refetching pods. */+export function getAssignToastTitle({+ podId,+ destinationName,+}: AssignToastArgs) {+ if (podId === null) return "Removed from pod";+ return destinationName ? `Moved to ${destinationName}` : "Expert moved";+}++/** Split hired experts into their named pods (creation order, all pods kept+ * so a just-created empty pod still shows) plus the ungrouped remainder. An+ * expert whose `pod_id` points at a missing pod falls back to ungrouped. */+export function groupExpertsByPods(+ experts: Expert[],+ pods: ExpertPod[],+): { groups: PodGroup[]; ungrouped: Expert[] } {+ const membersByPod = new Map<string, Expert[]>(+ pods.map((pod) => [pod.id, []]),+ );+ const ungrouped: Expert[] = [];+ for (const expert of experts) {+ const members = expert.pod_id ? membersByPod.get(expert.pod_id) : undefined;+ if (members) members.push(expert);+ else ungrouped.push(expert);+ }+ return {+ groups: pods.map((pod) => ({+ pod,+ experts: membersByPod.get(pod.id) ?? [],+ })),+ ungrouped,+ };+}+export function getLastRunLabel(expert: Expert) {if (!expert.last_run_at) return null;const when = formatDistanceToNow(new Date(expert.last_run_at), {diff --git a/autogpt_platform/frontend/src/app/(platform)/team/page.tsx b/autogpt_platform/frontend/src/app/(platform)/team/page.tsxindex f7869292d6..7e87af7a5c 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/page.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/page.tsx@@ -1,5 +1,6 @@"use client";+import { Expert } from "@/app/api/__generated__/models/expert";import { AITeamIcon } from "@/components/atoms/AITeamIcon/AITeamIcon";import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";import { Text } from "@/components/atoms/Text/Text";@@ -7,22 +8,27 @@ import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";import { InstallWorkflowPicker } from "@/components/molecules/InstallWorkflowPicker/InstallWorkflowPicker";import { Flag, useFlagStatus } from "@/services/feature-flags/use-get-flag";import { notFound } from "next/navigation";-import { AutopilotCard } from "./components/AutopilotCard";import { CreateMenu } from "./components/CreateMenu/CreateMenu";import { EmptyTeamState } from "./components/EmptyTeamState";import { ExpertTeamCard } from "./components/ExpertTeamCard/ExpertTeamCard";+import { NewPodDialog } from "./components/NewPodDialog/NewPodDialog";import { SoulDrawer } from "./components/SoulDrawer/SoulDrawer";+import { TeamRoster } from "./components/TeamRoster/TeamRoster";+import { TEAM_GRID_CLASS } from "./helpers";import { WhatRunsZone } from "./components/WhatRunsZone/WhatRunsZone";import { useTeamPage } from "./useTeamPage";const MAIN_CLASS ="container min-h-screen space-y-6 pb-20 pt-16 sm:px-8 md:px-12";-const GRID_CLASS = "grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3";export default function TeamPage() {const { enabled, ready } = useFlagStatus(Flag.HIRE_EXPERTS);const {hiredExperts,+ pods,+ podForExpert,+ podGroups,+ ungroupedExperts,schedules,schedulesForExpert,isLoading,@@ -35,12 +41,18 @@ export default function TeamPage() {soulDrawerKey,openSoul,closeSoul,+ isNewPodOpen,+ openNewPod,+ closeNewPod,+ createPod,+ isCreatingPod,+ assignPod,} = useTeamPage({ enabled: Boolean(enabled) && ready });if (!ready) {return (<main className={MAIN_CLASS}>- <div className={GRID_CLASS}>+ <div className={TEAM_GRID_CLASS}>{[0, 1, 2].map((i) => (<Skeleton key={i} className="h-48 w-full rounded-2xl" />))}@@ -53,6 +65,21 @@ export default function TeamPage() {notFound();}+ function renderCard(expert: Expert) {+ return (+ <ExpertTeamCard+ key={expert.id}+ expert={expert}+ schedules={schedulesForExpert(expert)}+ pods={pods}+ currentPod={podForExpert(expert)}+ onInstallWorkflow={installWorkflow}+ onEditSoul={openSoul}+ onAssignPod={assignPod}+ />+ );+ }+return (<main className={MAIN_CLASS}><div className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">@@ -65,27 +92,19 @@ export default function TeamPage() {Autopilot and your hired experts, ready to work.</Text></div>- <CreateMenu />- </div>- <div className={GRID_CLASS}>- <AutopilotCard />- {isLoading- ? [0, 1, 2].map((i) => (- <Skeleton key={i} className="h-48 w-full rounded-2xl" />- ))- : hiredExperts.map((expert) => (- <ExpertTeamCard- key={expert.id}- expert={expert}- schedules={schedulesForExpert(expert)}- onInstallWorkflow={installWorkflow}- onEditSoul={openSoul}- />- ))}+ <CreateMenu onNewPod={openNewPod} /></div>{!isLoading && !isError && hiredExperts.length > 0 ? (<WhatRunsZone experts={hiredExperts} schedules={schedules} />) : null}++ <TeamRoster+ isLoading={isLoading}+ podGroups={podGroups}+ ungroupedExperts={ungroupedExperts}+ renderCard={renderCard}+ />+{isError ? (<ErrorCardcontext="your team"@@ -93,7 +112,10 @@ export default function TeamPage() {onRetry={() => refetch()}/>) : null}- {!isLoading && !isError && hiredExperts.length === 0 ? (+ {!isLoading &&+ !isError &&+ hiredExperts.length === 0 &&+ podGroups.length === 0 ? (<EmptyTeamState />) : null}<InstallWorkflowPicker@@ -103,6 +125,12 @@ export default function TeamPage() {onClose={closeWorkflowPicker}/><SoulDrawer key={soulDrawerKey} expert={soulExpert} onClose={closeSoul} />+ <NewPodDialog+ open={isNewPodOpen}+ onClose={closeNewPod}+ onCreate={createPod}+ isCreating={isCreatingPod}+ /></main>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/team/useTeamPage.ts b/autogpt_platform/frontend/src/app/(platform)/team/useTeamPage.tsindex 5f91e43f06..44ada2b27a 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/useTeamPage.ts+++ b/autogpt_platform/frontend/src/app/(platform)/team/useTeamPage.ts@@ -1,30 +1,137 @@-import { useListExperts } from "@/app/api/__generated__/endpoints/experts/experts";+import {+ getListExpertPodsQueryKey,+ getListExpertsQueryKey,+ listExperts,+ useAssignExpertPod,+ useCreateExpertPod,+ useListExpertPods,+ useListExperts,+} from "@/app/api/__generated__/endpoints/experts/experts";import { useGetV1ListExecutionSchedulesForAUser } from "@/app/api/__generated__/endpoints/schedules/schedules";import { Expert } from "@/app/api/__generated__/models/expert";+import { ExpertPod } from "@/app/api/__generated__/models/expertPod";import { okData } from "@/app/api/helpers";+import { toast } from "@/components/molecules/Toast/use-toast";+import { useQueryClient } from "@tanstack/react-query";import { useState } from "react";-import { getExpertSchedules } from "./helpers";+import {+ getAssignToastTitle,+ getExpertSchedules,+ groupExpertsByPods,+} from "./helpers";interface Args {enabled: boolean;}export function useTeamPage({ enabled }: Args) {+ const queryClient = useQueryClient();const [pickerExpertId, setPickerExpertId] = useState<string | null>(null);const [soulExpertId, setSoulExpertId] = useState<string | null>(null);const [soulDrawerKey, setSoulDrawerKey] = useState(0);+ const [isNewPodOpen, setIsNewPodOpen] = useState(false);const expertsQuery = useListExperts({- query: { select: (x) => x.data as Expert[], enabled },+ query: { select: (res) => (okData(res) ?? []) as Expert[], enabled },+ });+ const podsQuery = useListExpertPods({+ query: {+ select: (res) => (okData(res) ?? []) as ExpertPod[],+ enabled,+ },});const schedulesQuery = useGetV1ListExecutionSchedulesForAUser({query: { select: (res) => okData(res) ?? [], enabled },});+ const pods = podsQuery.data ?? [];+ // Built once per render so each card resolves its pod in O(1) instead of+ // scanning the full list.+ const podsById = new Map(pods.map((pod) => [pod.id, pod]));++ function podForExpert(expert: Expert) {+ return expert.pod_id ? podsById.get(expert.pod_id) : undefined;+ }++ function invalidateExperts() {+ return queryClient.invalidateQueries({+ queryKey: getListExpertsQueryKey(),+ });+ }++ function invalidatePods() {+ return queryClient.invalidateQueries({+ queryKey: getListExpertPodsQueryKey(),+ });+ }++ function writeExpertToCache(updated: Expert) {+ const key = getListExpertsQueryKey();+ const cached =+ queryClient.getQueryData<Awaited<ReturnType<typeof listExperts>>>(key);+ if (cached?.status !== 200) return invalidateExperts();+ queryClient.setQueryData(key, {+ ...cached,+ data: cached.data.map((expert) =>+ expert.id === updated.id ? updated : expert,+ ),+ });+ }++ const { mutate: createPodMutate, isPending: isCreatingPod } =+ useCreateExpertPod({+ mutation: {+ onSuccess: () => {+ void invalidatePods();+ setIsNewPodOpen(false);+ },+ onError: (error) => {+ // The dialog stays open (it only closes on success) so the typed+ // name survives; surface the server's reason, e.g. the 409's+ // "already exists" detail.+ toast({+ title: "Could not create pod",+ description: error instanceof Error ? error.message : undefined,+ variant: "destructive",+ });+ },+ },+ });++ const { mutate: assignPodMutate } = useAssignExpertPod({+ mutation: {+ onSuccess: (response, variables) => {+ // The PATCH returns the updated expert, so patch it into the cached+ // roster instead of refetching the heavy list_experts join.+ if (response.status === 200) writeExpertToCache(response.data);+ else void invalidateExperts();++ const podId = variables.data.pod_id;+ const destination = pods.find((pod) => pod.id === podId);+ // A pod we don't know about means the cached pod list is stale.+ if (podId !== null && !destination) void invalidatePods();+ toast({+ title: getAssignToastTitle({+ podId,+ destinationName: destination?.name,+ }),+ });+ },+ onError: (error) => {+ void invalidatePods();+ toast({+ title: "Could not move expert",+ description: error instanceof Error ? error.message : undefined,+ variant: "destructive",+ });+ },+ },+ });const hiredExperts = (expertsQuery.data ?? []).filter((expert) => !expert.is_template && !expert.is_archived,);const schedules = schedulesQuery.data ?? [];+ const { groups, ungrouped } = groupExpertsByPods(hiredExperts, pods);function schedulesForExpert(expert: Expert) {return getExpertSchedules(expert, schedules);@@ -39,7 +146,11 @@ export function useTeamPage({ enabled }: Args) {}function refetch() {- return Promise.all([expertsQuery.refetch(), schedulesQuery.refetch()]);+ return Promise.all([+ expertsQuery.refetch(),+ podsQuery.refetch(),+ schedulesQuery.refetch(),+ ]);}function closeSoul() {@@ -51,12 +162,37 @@ export function useTeamPage({ enabled }: Args) {setSoulDrawerKey((current) => current + 1);}+ function createPod(name: string) {+ createPodMutate({ data: { name } });+ }++ function assignPod(expertId: string, podId: string | null) {+ assignPodMutate({ expertId, data: { pod_id: podId } });+ }++ function openNewPod() {+ setIsNewPodOpen(true);+ }++ function closeNewPod() {+ setIsNewPodOpen(false);+ }+return {hiredExperts,+ pods,+ podForExpert,+ podGroups: groups,+ ungroupedExperts: ungrouped,schedules,schedulesForExpert,- isLoading: enabled && (expertsQuery.isLoading || schedulesQuery.isLoading),- isError: expertsQuery.isError || schedulesQuery.isError,+ isLoading:+ enabled &&+ (expertsQuery.isLoading ||+ podsQuery.isLoading ||+ schedulesQuery.isLoading),+ isError:+ expertsQuery.isError || podsQuery.isError || schedulesQuery.isError,refetch,installWorkflow,pickerExpertId,@@ -66,5 +202,11 @@ export function useTeamPage({ enabled }: Args) {soulDrawerKey,openSoul,closeSoul,+ isNewPodOpen,+ openNewPod,+ closeNewPod,+ createPod,+ isCreatingPod,+ assignPod,};}diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.jsonindex 55ead2b322..d0ddd56257 100644--- a/autogpt_platform/frontend/src/app/api/openapi.json+++ b/autogpt_platform/frontend/src/app/api/openapi.json@@ -5941,6 +5941,69 @@"security": [{ "HTTPBearerJWT": [] }]}},+ "/api/experts/pods": {+ "get": {+ "tags": ["v2", "experts", "experts", "private"],+ "summary": "List Expert Pods",+ "operationId": "list_expert_pods",+ "responses": {+ "200": {+ "description": "Successful Response",+ "content": {+ "application/json": {+ "schema": {+ "items": { "$ref": "#/components/schemas/ExpertPod" },+ "type": "array",+ "title": "Response List Expert Pods"+ }+ }+ }+ },+ "401": {+ "$ref": "#/components/responses/HTTP401NotAuthenticatedError"+ }+ },+ "security": [{ "HTTPBearerJWT": [] }]+ },+ "post": {+ "tags": ["v2", "experts", "experts", "private"],+ "summary": "Create Expert Pod",+ "operationId": "create_expert_pod",+ "requestBody": {+ "content": {+ "application/json": {+ "schema": { "$ref": "#/components/schemas/CreatePodRequest" }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "Successful Response",+ "content": {+ "application/json": {+ "schema": { "$ref": "#/components/schemas/ExpertPod" }+ }+ }+ },+ "401": {+ "$ref": "#/components/responses/HTTP401NotAuthenticatedError"+ },+ "409": {+ "description": "Duplicate pod name, or the pod limit is reached"+ },+ "422": {+ "description": "Validation Error",+ "content": {+ "application/json": {+ "schema": { "$ref": "#/components/schemas/HTTPValidationError" }+ }+ }+ }+ },+ "security": [{ "HTTPBearerJWT": [] }]+ }+ },"/api/experts/raise": {"post": {"tags": ["v2", "experts", "experts", "private"],@@ -6115,6 +6178,52 @@}}},+ "/api/experts/{expert_id}/pod": {+ "patch": {+ "tags": ["v2", "experts", "experts", "private"],+ "summary": "Assign Expert Pod",+ "operationId": "assign_expert_pod",+ "security": [{ "HTTPBearerJWT": [] }],+ "parameters": [+ {+ "name": "expert_id",+ "in": "path",+ "required": true,+ "schema": { "type": "string", "title": "Expert Id" }+ }+ ],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": { "$ref": "#/components/schemas/AssignPodRequest" }+ }+ }+ },+ "responses": {+ "200": {+ "description": "Successful Response",+ "content": {+ "application/json": {+ "schema": { "$ref": "#/components/schemas/Expert" }+ }+ }+ },+ "401": {+ "$ref": "#/components/responses/HTTP401NotAuthenticatedError"+ },+ "404": { "description": "Expert or pod not found" },+ "422": {+ "description": "Validation Error",+ "content": {+ "application/json": {+ "schema": { "$ref": "#/components/schemas/HTTPValidationError" }+ }+ }+ }+ }+ }+ },"/api/experts/{expert_id}/runs": {"get": {"tags": ["v2", "experts", "experts", "private"],@@ -14886,6 +14995,17 @@"required": ["answer", "documents", "success"],"title": "ApiResponse"},+ "AssignPodRequest": {+ "properties": {+ "pod_id": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Pod Id"+ }+ },+ "type": "object",+ "required": ["pod_id"],+ "title": "AssignPodRequest"+ },"AuthEmailRequest": {"properties": {"type": {@@ -16947,6 +17067,19 @@"required": ["name", "slug"],"title": "CreateOrgRequest"},+ "CreatePodRequest": {+ "properties": {+ "name": {+ "type": "string",+ "maxLength": 100,+ "minLength": 1,+ "title": "Name"+ }+ },+ "type": "object",+ "required": ["name"],+ "title": "CreatePodRequest"+ },"CreateRaisedExpertRequest": {"properties": {"name": {@@ -18302,6 +18435,10 @@{ "type": "null" }],"title": "Schedules Paused At"+ },+ "pod_id": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Pod Id"}},"type": "object",@@ -18357,6 +18494,21 @@"required": ["id", "name", "avatar_url", "role", "is_archived"],"title": "ExpertIdentity"},+ "ExpertPod": {+ "properties": {+ "id": { "type": "string", "title": "Id" },+ "name": { "type": "string", "title": "Name" },+ "created_at": {+ "type": "string",+ "format": "date-time",+ "title": "Created At"+ }+ },+ "type": "object",+ "required": ["id", "name", "created_at"],+ "title": "ExpertPod",+ "description": "A named group of hired experts, scoped to the owner."+ },"ExpertRun": {"properties": {"execution_id": { "type": "string", "title": "Execution Id" },