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(backend): home dashboard aggregation endpoint (#13904)
Abhimanyu Yadavd2e2c4ccaaa8
diff --git a/autogpt_platform/backend/backend/api/features/executions/activity_gate.py b/autogpt_platform/backend/backend/api/features/executions/activity_gate.pynew file mode 100644index 0000000000..cc7a2dfbd4--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/executions/activity_gate.py@@ -0,0 +1,38 @@+"""Feature-flag gate for AI-generated activity summaries on executions.++Summaries are persisted regardless of the flag, so every route that returns+executions has to scrub them when `AI_ACTIVITY_STATUS` is off for the user.+"""++from typing import TypeVar++from backend.data import execution as execution_db+from backend.util.feature_flag import Flag, is_feature_enabled++ExecutionT = TypeVar("ExecutionT", bound=execution_db.GraphExecutionMeta)+++async def hide_activity_summaries_if_disabled(+ executions: list[ExecutionT], user_id: str+) -> list[ExecutionT]:+ """Hide activity summaries and scores if AI_ACTIVITY_STATUS feature is disabled."""+ if await is_feature_enabled(Flag.AI_ACTIVITY_STATUS, user_id):+ return executions+ return [_without_activity_features(execution) for execution in executions]+++async def hide_activity_summary_if_disabled(+ execution: ExecutionT, user_id: str+) -> ExecutionT:+ """Hide activity summary and score for a single execution if AI_ACTIVITY_STATUS feature is disabled."""+ if await is_feature_enabled(Flag.AI_ACTIVITY_STATUS, user_id):+ return execution+ return _without_activity_features(execution)+++def _without_activity_features(execution: ExecutionT) -> ExecutionT:+ if not execution.stats:+ return execution+ return execution.model_copy(+ update={"stats": execution.stats.without_activity_features()}+ )diff --git a/autogpt_platform/backend/backend/api/features/home/__init__.py b/autogpt_platform/backend/backend/api/features/home/__init__.pynew file mode 100644index 0000000000..8b13789179--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/home/__init__.py@@ -0,0 +1 @@+diff --git a/autogpt_platform/backend/backend/api/features/home/activity.py b/autogpt_platform/backend/backend/api/features/home/activity.pynew file mode 100644index 0000000000..c392d23eb4--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/home/activity.py@@ -0,0 +1,206 @@+from datetime import datetime, timedelta++from backend.api.features.experts.models import Expert+from backend.data.execution import ExecutionStatus, GraphExecutionMeta+from backend.data.execution_cost_summary import UserExecutionCostSummary+from backend.executor.scheduler import CopilotTurnJobInfo, GraphExecutionJobInfo++from .helpers import (+ UNKNOWN_AGENT,+ AgentRef,+ as_utc,+ as_utc_or_none,+ parse_datetime,+ run_link,+ split_summary,+ to_home_expert,+)+from .models import (+ HomeActiveTask,+ HomeBriefing,+ HomeBriefingOutcome,+ HomeDailyActivity,+ HomeUpcomingTask,+ HomeWeekSummary,+)++_MAX_OUTCOMES = 4+_MAX_ACTIVE = 3+_MAX_UPCOMING = 4+++def compose_briefing(+ *,+ now: datetime,+ executions: list[GraphExecutionMeta],+ expert_by_id: dict[str, Expert],+ agent_by_graph: dict[str, AgentRef],+) -> HomeBriefing:+ window_start = now - timedelta(hours=24)+ terminal = [+ execution+ for execution in executions+ if execution.status in {ExecutionStatus.COMPLETED, ExecutionStatus.FAILED}+ and _occurred_at(execution, now) >= window_start+ ]+ # Failures first (they need a decision), then most recent within each group.+ terminal.sort(+ key=lambda execution: (+ execution.status == ExecutionStatus.COMPLETED,+ -_occurred_at(execution, now).timestamp(),+ )+ )+ outcomes = [+ _briefing_outcome(execution, expert_by_id, agent_by_graph)+ for execution in terminal[:_MAX_OUTCOMES]+ ]+ completed = sum(+ execution.status == ExecutionStatus.COMPLETED for execution in terminal+ )+ failed = sum(execution.status == ExecutionStatus.FAILED for execution in terminal)+ shown_completed = sum(outcome.status == "completed" for outcome in outcomes)+ return HomeBriefing(+ generated_at=now,+ window_started_at=window_start,+ completed_count=completed,+ failed_count=failed,+ routine_count=max(0, completed - shown_completed),+ outcomes=outcomes,+ )+++def compose_active_tasks(+ executions: list[GraphExecutionMeta],+ expert_by_id: dict[str, Expert],+ agent_by_graph: dict[str, AgentRef],+) -> list[HomeActiveTask]:+ active = [+ execution+ for execution in executions+ if execution.status in {ExecutionStatus.RUNNING, ExecutionStatus.QUEUED}+ ]+ return [+ _active_task(execution, expert_by_id, agent_by_graph)+ for execution in active[:_MAX_ACTIVE]+ ]+++def _active_task(+ execution: GraphExecutionMeta,+ expert_by_id: dict[str, Expert],+ agent_by_graph: dict[str, AgentRef],+) -> HomeActiveTask:+ agent = agent_by_graph.get(execution.graph_id, UNKNOWN_AGENT)+ return HomeActiveTask(+ id=execution.id,+ title=agent.name,+ status="running" if execution.status == ExecutionStatus.RUNNING else "queued",+ expert=(+ to_home_expert(expert_by_id[execution.expert_id])+ if execution.expert_id in expert_by_id+ else None+ ),+ started_at=as_utc_or_none(execution.started_at),+ link=run_link(agent.library_agent_id, execution.id),+ )+++def compose_upcoming_tasks(+ schedules: list[GraphExecutionJobInfo | CopilotTurnJobInfo],+ expert_by_schedule: dict[str, Expert],+) -> list[HomeUpcomingTask]:+ upcoming = []+ for schedule in schedules:+ next_run = parse_datetime(schedule.next_run_time)+ if next_run is None:+ continue+ if isinstance(schedule, GraphExecutionJobInfo):+ expert = expert_by_schedule.get(schedule.id)+ upcoming.append(+ HomeUpcomingTask(+ id=schedule.id,+ title=schedule.agent_name or schedule.name,+ kind="agent",+ expert=to_home_expert(expert) if expert else None,+ next_run_time=next_run,+ )+ )+ else:+ upcoming.append(+ HomeUpcomingTask(+ id=schedule.id,+ title=schedule.name,+ kind="followup",+ next_run_time=next_run,+ )+ )+ upcoming.sort(key=lambda task: task.next_run_time)+ return upcoming[:_MAX_UPCOMING]+++def compose_week_summary(+ summary: UserExecutionCostSummary, credits_balance: int | None+) -> HomeWeekSummary:+ return HomeWeekSummary(+ run_count=summary.run_count,+ completed_count=summary.success_run_count,+ review_count=summary.review_run_count,+ failed_count=summary.failed_run_count,+ total_runtime_seconds=summary.total_duration_seconds,+ timed_run_count=summary.duration_run_count,+ total_cost_cents=summary.total_cents,+ credits_balance=credits_balance,+ daily=[+ HomeDailyActivity(+ date=day.date,+ completed_count=day.success_count,+ review_count=day.review_count,+ failed_count=day.failed_count,+ )+ for day in summary.daily+ ],+ )+++def _briefing_outcome(+ execution: GraphExecutionMeta,+ expert_by_id: dict[str, Expert],+ agent_by_graph: dict[str, AgentRef],+) -> HomeBriefingOutcome:+ agent = agent_by_graph.get(execution.graph_id, UNKNOWN_AGENT)+ raw_summary = execution.stats.activity_status if execution.stats else None+ error = execution.stats.error if execution.stats else None+ failed = execution.status == ExecutionStatus.FAILED+ if failed:+ fallback_detail = (+ error or "Open the run to inspect the failure and choose the next step."+ )+ else:+ fallback_detail = "Completed successfully."+ # Only an AI summary may become the headline. A raw exception string is the+ # detail, never the card title.+ title, detail = split_summary(+ raw_summary,+ fallback_title=f"{agent.name} {'needs a retry' if failed else 'finished'}",+ fallback_detail=fallback_detail,+ )+ return HomeBriefingOutcome(+ id=execution.id,+ status="failed" if failed else "completed",+ title=title,+ summary=detail,+ expert=(+ to_home_expert(expert_by_id[execution.expert_id])+ if execution.expert_id in expert_by_id+ else None+ ),+ agent_name=agent.name,+ occurred_at=as_utc_or_none(execution.ended_at or execution.started_at),+ duration_seconds=execution.stats.duration if execution.stats else 0,+ cost_cents=execution.stats.cost if execution.stats else 0,+ link=run_link(agent.library_agent_id, execution.id),+ )+++def _occurred_at(execution: GraphExecutionMeta, now: datetime) -> datetime:+ return as_utc(execution.ended_at or execution.started_at or now)diff --git a/autogpt_platform/backend/backend/api/features/home/activity_test.py b/autogpt_platform/backend/backend/api/features/home/activity_test.pynew file mode 100644index 0000000000..779418061d--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/home/activity_test.py@@ -0,0 +1,306 @@+from datetime import date, datetime, timedelta, timezone++from backend.data.execution import ExecutionStatus, GraphExecutionMeta+from backend.data.execution_cost_summary import UserDailyCost, UserExecutionCostSummary+from backend.executor.scheduler import CopilotTurnJobInfo, GraphExecutionJobInfo++from .activity import (+ compose_active_tasks,+ compose_briefing,+ compose_upcoming_tasks,+ compose_week_summary,+)+from .helpers import AgentRef++NOW = datetime(2026, 8, 10, 9, 0, tzinfo=timezone.utc)+TRIAGE = {"graph": AgentRef(name="Inbox triage", library_agent_id="library-agent")}+++def _execution(+ *,+ exec_id: str,+ status: ExecutionStatus,+ ended_at: datetime,+ activity_status: str | None = None,+ error: str | None = None,+ expert_id: str | None = None,+) -> GraphExecutionMeta:+ return GraphExecutionMeta(+ id=exec_id,+ user_id="user",+ graph_id="graph",+ graph_version=1,+ inputs=None,+ credential_inputs=None,+ nodes_input_masks=None,+ preset_id=None,+ status=status,+ started_at=ended_at - timedelta(minutes=1),+ ended_at=ended_at,+ expert_id=expert_id,+ stats=GraphExecutionMeta.Stats(activity_status=activity_status, error=error),+ )+++def test_briefing_ignores_runs_outside_the_24h_window() -> None:+ briefing = compose_briefing(+ now=NOW,+ executions=[+ _execution(+ exec_id="fresh",+ status=ExecutionStatus.COMPLETED,+ ended_at=NOW - timedelta(hours=2),+ ),+ _execution(+ exec_id="stale",+ status=ExecutionStatus.COMPLETED,+ ended_at=NOW - timedelta(hours=30),+ ),+ ],+ expert_by_id={},+ agent_by_graph={"graph": AgentRef(name="Inbox triage", library_agent_id=None)},+ )++ assert briefing.window_started_at == NOW - timedelta(hours=24)+ assert briefing.completed_count == 1+ assert [outcome.id for outcome in briefing.outcomes] == ["fresh"]+++def test_briefing_lists_failures_before_successes() -> None:+ briefing = compose_briefing(+ now=NOW,+ executions=[+ _execution(+ exec_id="ok",+ status=ExecutionStatus.COMPLETED,+ ended_at=NOW - timedelta(hours=1),+ activity_status="Sorted 12 emails. Nothing needed a reply.",+ ),+ _execution(+ exec_id="broken",+ status=ExecutionStatus.FAILED,+ ended_at=NOW - timedelta(hours=3),+ ),+ ],+ expert_by_id={},+ agent_by_graph={"graph": AgentRef(name="Inbox triage", library_agent_id=None)},+ )++ assert [outcome.status for outcome in briefing.outcomes] == ["failed", "completed"]+ assert briefing.failed_count == 1+ assert briefing.outcomes[0].title == "Inbox triage needs a retry"+ assert briefing.outcomes[1].title == "Sorted 12 emails."+ assert briefing.outcomes[1].summary == "Nothing needed a reply."+++def test_briefing_counts_unlisted_successes_as_routine() -> None:+ executions = [+ _execution(+ exec_id=f"run-{index}",+ status=ExecutionStatus.COMPLETED,+ ended_at=NOW - timedelta(hours=1),+ )+ for index in range(6)+ ]++ briefing = compose_briefing(+ now=NOW,+ executions=executions,+ expert_by_id={},+ agent_by_graph={"graph": AgentRef(name="Inbox triage", library_agent_id=None)},+ )++ assert briefing.completed_count == 6+ assert len(briefing.outcomes) == 4+ assert briefing.routine_count == 2+++def test_week_summary_maps_status_counts_and_credits() -> None:+ summary = compose_week_summary(+ UserExecutionCostSummary(+ total_cents=420,+ run_count=10,+ billable_run_count=8,+ failed_cost_cents=15,+ success_run_count=7,+ failed_run_count=2,+ review_run_count=1,+ total_duration_seconds=93.5,+ duration_run_count=9,+ by_agent=[],+ top_runs=[],+ daily=[+ UserDailyCost(+ date=date(2026, 8, 9),+ cost_cents=120,+ run_count=3,+ success_count=2,+ failed_count=1,+ review_count=0,+ )+ ],+ ),+ 250,+ )++ assert summary.run_count == 10+ assert summary.completed_count == 7+ assert summary.failed_count == 2+ assert summary.review_count == 1+ assert summary.total_runtime_seconds == 93.5+ assert summary.timed_run_count == 9+ assert summary.total_cost_cents == 420+ assert summary.credits_balance == 250+ assert summary.daily[0].completed_count == 2+ assert summary.daily[0].failed_count == 1+++def test_briefing_keeps_a_raw_error_out_of_the_headline() -> None:+ briefing = compose_briefing(+ now=NOW,+ executions=[+ _execution(+ exec_id="broken",+ status=ExecutionStatus.FAILED,+ ended_at=NOW - timedelta(hours=1),+ error="KeyError: 'recipient'",+ )+ ],+ expert_by_id={},+ agent_by_graph=TRIAGE,+ )++ assert briefing.outcomes[0].title == "Inbox triage needs a retry"+ assert briefing.outcomes[0].summary == "KeyError: 'recipient'"+++def test_briefing_orders_each_status_group_most_recent_first() -> None:+ briefing = compose_briefing(+ now=NOW,+ executions=[+ _execution(+ exec_id="old-failure",+ status=ExecutionStatus.FAILED,+ ended_at=NOW - timedelta(hours=8),+ ),+ _execution(+ exec_id="new-failure",+ status=ExecutionStatus.FAILED,+ ended_at=NOW - timedelta(hours=1),+ ),+ _execution(+ exec_id="old-success",+ status=ExecutionStatus.COMPLETED,+ ended_at=NOW - timedelta(hours=9),+ ),+ _execution(+ exec_id="new-success",+ status=ExecutionStatus.COMPLETED,+ ended_at=NOW - timedelta(hours=2),+ ),+ ],+ expert_by_id={},+ agent_by_graph=TRIAGE,+ )++ assert [outcome.id for outcome in briefing.outcomes] == [+ "new-failure",+ "old-failure",+ "new-success",+ "old-success",+ ]+++def test_active_tasks_map_status_and_cap_the_list() -> None:+ executions = [+ _execution(+ exec_id=f"queued-{index}",+ status=ExecutionStatus.QUEUED,+ ended_at=NOW,+ )+ for index in range(3)+ ]+ executions.insert(+ 0,+ _execution(exec_id="running", status=ExecutionStatus.RUNNING, ended_at=NOW),+ )+ executions.append(+ _execution(exec_id="done", status=ExecutionStatus.COMPLETED, ended_at=NOW)+ )++ tasks = compose_active_tasks(executions, {}, TRIAGE)++ assert [task.id for task in tasks] == ["running", "queued-0", "queued-1"]+ assert [task.status for task in tasks] == ["running", "queued", "queued"]+ assert tasks[0].title == "Inbox triage"+ assert tasks[0].expert is None+ assert tasks[0].link == (+ "/library/agents/library-agent?activeTab=runs&activeItem=running"+ )+++def test_active_task_falls_back_when_the_graph_is_unknown() -> None:+ tasks = compose_active_tasks(+ [_execution(exec_id="run", status=ExecutionStatus.RUNNING, ended_at=NOW)],+ {},+ {},+ )++ assert tasks[0].title == "Agent task"+ assert tasks[0].link is None+++def _graph_job(job_id: str, next_run: str) -> GraphExecutionJobInfo:+ return GraphExecutionJobInfo(+ id=job_id,+ schedule_id=job_id,+ name=job_id,+ agent_name="Inbox triage",+ next_run_time=next_run,+ user_id="user",+ graph_id="graph",+ graph_version=1,+ cron="0 9 * * *",+ input_data={},+ )+++def _copilot_job(job_id: str, next_run: str) -> CopilotTurnJobInfo:+ return CopilotTurnJobInfo(+ id=job_id,+ schedule_id=job_id,+ name="Follow up on the invoice",+ next_run_time=next_run,+ user_id="user",+ cron="0 9 * * *",+ message="ping",+ )+++def test_upcoming_tasks_sort_by_next_run_and_cap_the_list() -> None:+ jobs = [+ _graph_job("late", "2026-08-10T18:00:00Z"),+ _copilot_job("followup", "2026-08-10T12:00:00Z"),+ _graph_job("early", "2026-08-10T09:00:00Z"),+ _graph_job("mid", "2026-08-10T11:00:00Z"),+ _graph_job("latest", "2026-08-10T23:00:00Z"),+ ]++ tasks = compose_upcoming_tasks(jobs, {})++ assert [task.id for task in tasks] == ["early", "mid", "followup", "late"]+ assert [task.kind for task in tasks] == ["agent", "agent", "followup", "agent"]+ assert tasks[0].title == "Inbox triage"+ assert tasks[2].title == "Follow up on the invoice"+++def test_upcoming_tasks_skip_unparseable_next_run_times() -> None:+ tasks = compose_upcoming_tasks(+ [+ _graph_job("broken", "not-a-timestamp"),+ _graph_job("good", "2026-08-10T09:00:00Z"),+ ],+ {},+ )++ assert [task.id for task in tasks] == ["good"]diff --git a/autogpt_platform/backend/backend/api/features/home/agents.py b/autogpt_platform/backend/backend/api/features/home/agents.pynew file mode 100644index 0000000000..4b20245df0--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/home/agents.py@@ -0,0 +1,55 @@+from datetime import datetime++from backend.api.features.experts.models import Expert++from .helpers import setup_count, to_home_expert+from .models import HomeAgentStatus, HomeTeamSummary++_STATUS_RANK = {"working": 0, "paused": 1, "needs_setup": 2, "failed": 3, "ready": 4}+++def compose_agent_statuses(+ *,+ experts: list[Expert],+ running_expert_ids: set[str],+ next_run_by_expert: dict[str, datetime],+) -> list[HomeAgentStatus]:+ statuses = [+ _agent_status(expert, running_expert_ids, next_run_by_expert)+ for expert in experts+ ]+ return sorted(statuses, key=lambda item: _STATUS_RANK[item.status])+++def compose_team_summary(agents: list[HomeAgentStatus]) -> HomeTeamSummary:+ return HomeTeamSummary(+ total=len(agents),+ ready=sum(agent.status == "ready" for agent in agents),+ working=sum(agent.status == "working" for agent in agents),+ needs_attention=sum(+ agent.status in {"paused", "needs_setup", "failed"} for agent in agents+ ),+ )+++def _agent_status(+ expert: Expert,+ running_expert_ids: set[str],+ next_run_by_expert: dict[str, datetime],+) -> HomeAgentStatus:+ if expert.id in running_expert_ids:+ status, detail = "working", "Working on a task now"+ elif expert.schedules_paused_at:+ status, detail = "paused", "Scheduled work is paused"+ elif setup_count(expert) > 0:+ status, detail = "needs_setup", "A connection needs setup"+ elif expert.last_run_status == "FAILED":+ status, detail = "failed", "Last run failed"+ else:+ status, detail = "ready", "Ready for the next task"+ return HomeAgentStatus(+ expert=to_home_expert(expert),+ status=status,+ detail=detail,+ next_run_time=next_run_by_expert.get(expert.id),+ )diff --git a/autogpt_platform/backend/backend/api/features/home/agents_test.py b/autogpt_platform/backend/backend/api/features/home/agents_test.pynew file mode 100644index 0000000000..1ae60cb127--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/home/agents_test.py@@ -0,0 +1,112 @@+from datetime import datetime, timezone++from backend.api.features.experts.models import Expert, ExpertWorkflowRef++from .agents import compose_agent_statuses, compose_team_summary++NOW = datetime(2026, 8, 10, 9, 0, tzinfo=timezone.utc)+++def _expert(+ *,+ expert_id: str,+ schedules_paused_at: datetime | None = None,+ last_run_status: str | None = None,+ needs_setup: bool = False,+) -> Expert:+ return Expert(+ id=expert_id,+ name=f"Expert {expert_id}",+ avatar_url=None,+ role="Assistant",+ tagline=None,+ bio=None,+ skills=[],+ identity="",+ voice_preferences="",+ boundaries="",+ protected_soul_rules=[],+ is_template=False,+ source_template_id=None,+ is_archived=False,+ workflows=[+ ExpertWorkflowRef(+ id=f"workflow-{expert_id}",+ store_listing_version_id=None,+ library_agent_id=None,+ graph_id=f"graph-{expert_id}",+ name="Inbox triage",+ description=None,+ schedule_cron="0 9 * * *" if needs_setup else None,+ schedule_id=None,+ )+ ],+ last_run_status=last_run_status,+ schedules_paused_at=schedules_paused_at,+ )+++def test_working_outranks_paused_and_setup() -> None:+ statuses = compose_agent_statuses(+ experts=[+ _expert(expert_id="busy", schedules_paused_at=NOW, needs_setup=True),+ _expert(expert_id="idle"),+ ],+ running_expert_ids={"busy"},+ next_run_by_expert={},+ )++ assert [status.status for status in statuses] == ["working", "ready"]+++def test_status_precedence_walks_down_to_failed() -> None:+ statuses = compose_agent_statuses(+ experts=[+ _expert(expert_id="ready"),+ _expert(expert_id="failed", last_run_status="FAILED"),+ _expert(expert_id="setup", needs_setup=True),+ _expert(expert_id="paused", schedules_paused_at=NOW, needs_setup=True),+ ],+ running_expert_ids=set(),+ next_run_by_expert={},+ )++ assert [status.status for status in statuses] == [+ "paused",+ "needs_setup",+ "failed",+ "ready",+ ]+++def test_team_summary_groups_non_ready_states_as_attention() -> None:+ statuses = compose_agent_statuses(+ experts=[+ _expert(expert_id="ready"),+ _expert(expert_id="working"),+ _expert(expert_id="paused", schedules_paused_at=NOW),+ _expert(expert_id="setup", needs_setup=True),+ ],+ running_expert_ids={"working"},+ next_run_by_expert={},+ )++ summary = compose_team_summary(statuses)++ assert summary.total == 4+ assert summary.ready == 1+ assert summary.working == 1+ assert summary.needs_attention == 2+++def test_next_run_time_comes_from_the_expert_index() -> None:+ earliest = datetime(2026, 8, 10, 10, 0, tzinfo=timezone.utc)++ statuses = compose_agent_statuses(+ experts=[_expert(expert_id="scheduled"), _expert(expert_id="idle")],+ running_expert_ids=set(),+ next_run_by_expert={"scheduled": earliest},+ )++ next_runs = {status.expert.id: status.next_run_time for status in statuses}+ assert next_runs == {"scheduled": earliest, "idle": None}diff --git a/autogpt_platform/backend/backend/api/features/home/attention.py b/autogpt_platform/backend/backend/api/features/home/attention.pynew file mode 100644index 0000000000..948d51d0ec--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/home/attention.py@@ -0,0 +1,145 @@+import json+from datetime import datetime, timedelta, timezone+from urllib.parse import quote++from backend.api.features.executions.review.model import PendingHumanReviewModel+from backend.api.features.experts.models import Expert+from backend.executor.scheduler import CopilotTurnJobInfo, GraphExecutionJobInfo++from .helpers import as_utc, run_link, setup_count, to_home_expert+from .models import HomeAction, HomeAttentionItem, HomeExpert++# Longest payload preview we return before clipping it with an ellipsis.+_PREVIEW_MAX = 140+++def compose_attention_items(+ *,+ now: datetime,+ experts: list[Expert],+ reviews: list[PendingHumanReviewModel],+ schedules: list[GraphExecutionJobInfo | CopilotTurnJobInfo],+ credits_balance: int | None,+) -> list[HomeAttentionItem]:+ items = [_review_attention(review, now) for review in reviews]+ items.extend(+ _expert_attention(expert) for expert in experts if _needs_attention(expert)+ )+ if credits_balance is not None and credits_balance <= 0 and schedules:+ items.append(_credits_attention(len(schedules)))+ return sorted(items, key=_attention_sort_key)+++def _review_attention(+ review: PendingHumanReviewModel, now: datetime+) -> HomeAttentionItem:+ title = review.instructions or review.agent_name or "Review an agent decision"+ created_at = as_utc(review.created_at)+ return HomeAttentionItem(+ id=f"approval-{review.node_exec_id}",+ kind="approval",+ priority=("high" if now - created_at > timedelta(hours=24) else "normal"),+ title=title,+ description="Your agent paused before taking an external action.",+ why_it_matters="The task cannot continue until you approve or decline it.",+ expert=_review_expert(review),+ agent_name=review.agent_name,+ created_at=created_at,+ preview=_payload_preview(review.payload),+ review=review,+ primary_action=HomeAction(label="Review", href=_review_link(review)),+ )+++def _expert_attention(expert: Expert) -> HomeAttentionItem:+ summary = to_home_expert(expert)+ if expert.schedules_paused_at:+ budget = expert.weekly_budget+ description = (+ f"Weekly budget reached: {expert.weekly_spend} of {budget} credits."+ if budget is not None and expert.weekly_spend >= budget+ else "Scheduled work is paused."+ )+ return HomeAttentionItem(+ id=f"paused-{expert.id}",+ kind="paused",+ priority="high",+ title=f"Review {expert.name}'s paused work",+ description=description,+ why_it_matters="Upcoming tasks will not run while this agent is paused.",+ expert=summary,+ created_at=as_utc(expert.schedules_paused_at),+ primary_action=HomeAction(+ label="Review budget", href=f"/team/{quote(expert.id)}"+ ),+ )+ count = setup_count(expert)+ return HomeAttentionItem(+ id=f"setup-{expert.id}",+ kind="setup",+ priority="normal",+ title=f"Finish setting up {expert.name}",+ description=(+ "1 scheduled workflow needs setup."+ if count == 1+ else f"{count} scheduled workflows need setup."+ ),+ why_it_matters="Those workflows cannot run until their connections are ready.",+ expert=summary,+ primary_action=HomeAction(+ label="Finish setup", href=f"/team/{quote(expert.id)}"+ ),+ )+++def _credits_attention(schedule_count: int) -> HomeAttentionItem:+ return HomeAttentionItem(+ id="credits",+ kind="credits",+ priority="high",+ title="Add credits for scheduled work",+ description=(+ f"{schedule_count} upcoming task{'s' if schedule_count != 1 else ''} may not run."+ ),+ why_it_matters="Agents need a positive balance before paid blocks can start.",+ primary_action=HomeAction(label="Add credits", href="/profile/credits"),+ )+++def _review_expert(review: PendingHumanReviewModel) -> HomeExpert | None:+ if not review.expert_id or not review.expert_name:+ return None+ return HomeExpert(+ id=review.expert_id,+ name=review.expert_name,+ role="Agent",+ avatar_url=review.expert_avatar_url,+ )+++def _needs_attention(expert: Expert) -> bool:+ return bool(expert.schedules_paused_at or setup_count(expert) > 0)+++def _payload_preview(payload: object) -> str | None:+ if payload is None:+ return None+ rendered = payload if isinstance(payload, str) else json.dumps(payload, default=str)+ compact = " ".join(rendered.split())+ if len(compact) <= _PREVIEW_MAX:+ return compact+ return f"{compact[:_PREVIEW_MAX - 3]}…"+++def _attention_sort_key(item: HomeAttentionItem) -> tuple[int, datetime]:+ priority = 0 if item.priority == "high" else 1+ created = item.created_at or datetime.max.replace(tzinfo=timezone.utc)+ return priority, created+++def _review_link(review: PendingHumanReviewModel) -> str:+ if review.session_id:+ return f"/copilot?sessionId={quote(review.session_id)}"+ if review.library_agent_id:+ return run_link(review.library_agent_id, review.graph_exec_id) or "/library"+ return "/library"diff --git a/autogpt_platform/backend/backend/api/features/home/attention_test.py b/autogpt_platform/backend/backend/api/features/home/attention_test.pynew file mode 100644index 0000000000..60837ea0ad--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/home/attention_test.py@@ -0,0 +1,280 @@+from datetime import datetime, timedelta, timezone++from prisma.enums import ReviewStatus++from backend.api.features.executions.review.model import PendingHumanReviewModel+from backend.api.features.experts.models import Expert, ExpertWorkflowRef+from backend.executor.scheduler import GraphExecutionJobInfo++from .attention import compose_attention_items++NOW = datetime(2026, 8, 9, 12, 0, tzinfo=timezone.utc)+++def _review(+ created_at: datetime, *, node_exec_id: str = "node-execution"+) -> PendingHumanReviewModel:+ return PendingHumanReviewModel(+ node_exec_id=node_exec_id,+ node_id="node",+ user_id="user",+ graph_exec_id="graph-execution",+ graph_id="graph",+ graph_version=1,+ payload={"recipient": "[email protected]"},+ instructions="Send the prepared message",+ editable=True,+ status=ReviewStatus.WAITING,+ created_at=created_at,+ )+++def _expert(*, needs_setup: bool = False) -> Expert:+ return Expert(+ id="expert",+ name="Ada",+ avatar_url=None,+ role="Assistant",+ tagline=None,+ bio=None,+ skills=[],+ identity="",+ voice_preferences="",+ boundaries="",+ protected_soul_rules=[],+ is_template=False,+ source_template_id=None,+ is_archived=False,+ workflows=[+ ExpertWorkflowRef(+ id="workflow",+ store_listing_version_id=None,+ library_agent_id=None,+ graph_id="graph",+ name="Inbox triage",+ description=None,+ schedule_cron="0 9 * * *" if needs_setup else None,+ schedule_id=None,+ )+ ],+ )+++def _schedule() -> GraphExecutionJobInfo:+ return GraphExecutionJobInfo(+ id="schedule",+ name="Daily triage",+ next_run_time="2026-08-10T09:00:00+00:00",+ user_id="user",+ graph_id="graph",+ graph_version=1,+ cron="0 9 * * *",+ input_data={},+ )+++def test_review_priority_uses_dashboard_generation_time() -> None:+ now = datetime(2026, 8, 9, 12, 0, tzinfo=timezone.utc)++ items = compose_attention_items(+ now=now,+ experts=[],+ reviews=[_review(now - timedelta(hours=25))],+ schedules=[],+ credits_balance=None,+ )++ assert items[0].priority == "high"+++def test_review_payload_is_compacted_for_preview() -> None:+ now = datetime(2026, 8, 9, 12, 0, tzinfo=timezone.utc)++ items = compose_attention_items(+ now=now,+ experts=[],+ reviews=[_review(now - timedelta(hours=1))],+ schedules=[],+ credits_balance=None,+ )++ assert items[0].priority == "normal"+ assert items[0].preview == '{"recipient": "[email protected]"}'+++def test_high_priority_sorts_first_then_oldest() -> None:+ items = compose_attention_items(+ now=NOW,+ experts=[],+ reviews=[+ _review(NOW - timedelta(hours=2), node_exec_id="recent-normal"),+ _review(NOW - timedelta(hours=5), node_exec_id="older-normal"),+ _review(NOW - timedelta(hours=30), node_exec_id="stale-high"),+ ],+ schedules=[],+ credits_balance=None,+ )++ assert [item.id for item in items] == [+ "approval-stale-high",+ "approval-older-normal",+ "approval-recent-normal",+ ]+++def test_setup_item_is_raised_for_workflows_without_a_schedule() -> None:+ items = compose_attention_items(+ now=NOW,+ experts=[_expert(needs_setup=True)],+ reviews=[],+ schedules=[],+ credits_balance=None,+ )++ assert [(item.kind, item.priority) for item in items] == [("setup", "normal")]+ assert items[0].description == "1 scheduled workflow needs setup."+++def test_empty_balance_only_warns_when_schedules_exist() -> None:+ without_schedules = compose_attention_items(+ now=NOW, experts=[], reviews=[], schedules=[], credits_balance=0+ )+ with_schedules = compose_attention_items(+ now=NOW, experts=[], reviews=[], schedules=[_schedule()], credits_balance=0+ )++ assert without_schedules == []+ assert [item.kind for item in with_schedules] == ["credits"]+ assert with_schedules[0].primary_action.href == "/profile/credits"+++def test_positive_balance_raises_no_credits_item() -> None:+ items = compose_attention_items(+ now=NOW, experts=[], reviews=[], schedules=[_schedule()], credits_balance=500+ )++ assert items == []+++def test_naive_timestamps_are_normalised_to_utc() -> None:+ naive_created = (NOW - timedelta(hours=30)).replace(tzinfo=None)+ paused_expert = _expert()+ paused_expert.schedules_paused_at = (NOW - timedelta(hours=2)).replace(tzinfo=None)++ items = compose_attention_items(+ now=NOW,+ experts=[paused_expert, _expert(needs_setup=True)],+ reviews=[_review(naive_created, node_exec_id="naive")],+ schedules=[],+ credits_balance=None,+ )++ assert [item.id for item in items] == [+ "approval-naive",+ "paused-expert",+ "setup-expert",+ ]+ assert items[0].priority == "high"+ assert items[0].created_at == NOW - timedelta(hours=30)+++def _paused_expert(*, weekly_budget: int | None, weekly_spend: int) -> Expert:+ expert = _expert()+ expert.schedules_paused_at = NOW - timedelta(hours=3)+ expert.weekly_budget = weekly_budget+ expert.weekly_spend = weekly_spend+ return expert+++def test_paused_expert_explains_a_breached_budget() -> None:+ items = compose_attention_items(+ now=NOW,+ experts=[_paused_expert(weekly_budget=500, weekly_spend=500)],+ reviews=[],+ schedules=[],+ credits_balance=None,+ )++ assert items[0].kind == "paused"+ assert items[0].description == "Weekly budget reached: 500 of 500 credits."+++def test_paused_expert_without_a_breached_budget_stays_generic() -> None:+ items = compose_attention_items(+ now=NOW,+ experts=[_paused_expert(weekly_budget=500, weekly_spend=10)],+ reviews=[],+ schedules=[],+ credits_balance=None,+ )++ assert items[0].description == "Scheduled work is paused."+++def test_long_payloads_are_truncated_with_an_ellipsis() -> None:+ review = _review(NOW - timedelta(hours=1))+ review.payload = {"body": "x" * 400}++ items = compose_attention_items(+ now=NOW,+ experts=[],+ reviews=[review],+ schedules=[],+ credits_balance=None,+ )++ preview = items[0].preview+ assert preview is not None+ assert len(preview) == 138+ assert preview.endswith("…")+++def test_review_link_prefers_the_copilot_session() -> None:+ review = _review(NOW - timedelta(hours=1))+ review.session_id = "session 1"++ items = compose_attention_items(+ now=NOW,+ experts=[],+ reviews=[review],+ schedules=[],+ credits_balance=None,+ )++ assert items[0].primary_action.href == "/copilot?sessionId=session%201"+++def test_review_link_falls_back_to_the_library_run_then_the_library() -> None:+ with_agent = _review(NOW - timedelta(hours=1), node_exec_id="with-agent")+ with_agent.library_agent_id = "library-agent"+ bare = _review(NOW - timedelta(hours=1), node_exec_id="bare")++ items = compose_attention_items(+ now=NOW,+ experts=[],+ reviews=[with_agent, bare],+ schedules=[],+ credits_balance=None,+ )++ hrefs = {item.id: item.primary_action.href for item in items}+ assert hrefs["approval-with-agent"] == (+ "/library/agents/library-agent?activeTab=runs&activeItem=graph-execution"+ )+ assert hrefs["approval-bare"] == "/library"+++def test_review_without_expert_details_has_no_expert() -> None:+ review = _review(NOW - timedelta(hours=1))+ review.expert_id = "expert"+ review.expert_name = None++ items = compose_attention_items(+ now=NOW,+ experts=[],+ reviews=[review],+ schedules=[],+ credits_balance=None,+ )++ assert items[0].expert is Nonediff --git a/autogpt_platform/backend/backend/api/features/home/compose.py b/autogpt_platform/backend/backend/api/features/home/compose.pynew file mode 100644index 0000000000..5524f127c0--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/home/compose.py@@ -0,0 +1,80 @@+from datetime import datetime++from backend.api.features.executions.review.model import PendingHumanReviewModel+from backend.api.features.experts.models import Expert+from backend.api.features.library.model import LibraryAgentRef+from backend.data.execution import ExecutionStatus, GraphExecutionMeta+from backend.data.execution_cost_summary import UserExecutionCostSummary+from backend.executor.scheduler import CopilotTurnJobInfo, GraphExecutionJobInfo++from .activity import (+ compose_active_tasks,+ compose_briefing,+ compose_upcoming_tasks,+ compose_week_summary,+)+from .agents import compose_agent_statuses, compose_team_summary+from .attention import compose_attention_items+from .helpers import agent_refs_by_graph, experts_by_schedule, next_runs_by_expert+from .models import HomeDashboardResponse+++def compose_home_dashboard(+ *,+ now: datetime,+ experts: list[Expert],+ executions: list[GraphExecutionMeta],+ reviews: list[PendingHumanReviewModel],+ schedules: list[GraphExecutionJobInfo | CopilotTurnJobInfo],+ library_refs: list[LibraryAgentRef],+ cost_summary: UserExecutionCostSummary,+ credits_balance: int | None,+ timezone_name: str,+) -> HomeDashboardResponse:+ hired = [+ expert+ for expert in experts+ if not expert.is_template and not expert.is_archived+ ]+ expert_by_id = {expert.id: expert for expert in hired}+ agent_by_graph = agent_refs_by_graph(hired, library_refs)+ graph_schedules = [+ schedule+ for schedule in schedules+ if isinstance(schedule, GraphExecutionJobInfo)+ ]+ expert_by_schedule = experts_by_schedule(hired, graph_schedules)+ running_expert_ids = {+ execution.expert_id+ for execution in executions+ if execution.expert_id+ and execution.status in {ExecutionStatus.RUNNING, ExecutionStatus.QUEUED}+ }+ agents = compose_agent_statuses(+ experts=hired,+ running_expert_ids=running_expert_ids,+ next_run_by_expert=next_runs_by_expert(graph_schedules, expert_by_schedule),+ )++ return HomeDashboardResponse(+ generated_at=now,+ timezone=timezone_name,+ attention=compose_attention_items(+ now=now,+ experts=hired,+ reviews=reviews,+ schedules=schedules,+ credits_balance=credits_balance,+ ),+ briefing=compose_briefing(+ now=now,+ executions=executions,+ expert_by_id=expert_by_id,+ agent_by_graph=agent_by_graph,+ ),+ active_tasks=compose_active_tasks(executions, expert_by_id, agent_by_graph),+ upcoming_tasks=compose_upcoming_tasks(schedules, expert_by_schedule),+ team=compose_team_summary(agents),+ agents=agents,+ week=compose_week_summary(cost_summary, credits_balance),+ )diff --git a/autogpt_platform/backend/backend/api/features/home/compose_test.py b/autogpt_platform/backend/backend/api/features/home/compose_test.pynew file mode 100644index 0000000000..d24227d1c2--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/home/compose_test.py@@ -0,0 +1,75 @@+from datetime import datetime, timezone++from backend.api.features.experts.models import Expert, ExpertWorkflowRef+from backend.data.execution_cost_summary import UserExecutionCostSummary++from .compose import compose_home_dashboard++NOW = datetime(2026, 8, 10, 9, 0, tzinfo=timezone.utc)+++def _expert(+ expert_id: str, *, is_template: bool = False, is_archived: bool = False+) -> Expert:+ return Expert(+ id=expert_id,+ name=f"Expert {expert_id}",+ avatar_url=None,+ role="Assistant",+ tagline=None,+ bio=None,+ skills=[],+ identity="",+ voice_preferences="",+ boundaries="",+ protected_soul_rules=[],+ is_template=is_template,+ source_template_id=None,+ is_archived=is_archived,+ workflows=[+ ExpertWorkflowRef(+ id=f"workflow-{expert_id}",+ store_listing_version_id=None,+ library_agent_id=None,+ graph_id=f"graph-{expert_id}",+ name="Inbox triage",+ description=None,+ schedule_cron="0 9 * * *",+ schedule_id=None,+ )+ ],+ )+++def _cost_summary() -> UserExecutionCostSummary:+ return UserExecutionCostSummary(+ total_cents=0,+ run_count=0,+ billable_run_count=0,+ failed_cost_cents=0,+ by_agent=[],+ top_runs=[],+ daily=[],+ )+++def test_templates_and_archived_experts_are_left_off_the_dashboard() -> None:+ dashboard = compose_home_dashboard(+ now=NOW,+ experts=[+ _expert("hired"),+ _expert("template", is_template=True),+ _expert("archived", is_archived=True),+ ],+ executions=[],+ reviews=[],+ schedules=[],+ library_refs=[],+ cost_summary=_cost_summary(),+ credits_balance=100,+ timezone_name="UTC",+ )++ assert [agent.expert.id for agent in dashboard.agents] == ["hired"]+ assert dashboard.team.total == 1+ assert [item.id for item in dashboard.attention] == ["setup-hired"]diff --git a/autogpt_platform/backend/backend/api/features/home/helpers.py b/autogpt_platform/backend/backend/api/features/home/helpers.pynew file mode 100644index 0000000000..65a5b9c87f--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/home/helpers.py@@ -0,0 +1,140 @@+from datetime import datetime, timezone+from urllib.parse import quote++from pydantic import BaseModel, ConfigDict++from backend.api.features.experts.models import Expert+from backend.api.features.library.model import LibraryAgentRef+from backend.executor.scheduler import GraphExecutionJobInfo++from .models import HomeExpert++# Longest a summary's first sentence may run before it is clipped into a title.+_TITLE_MAX = 120+++def to_home_expert(expert: Expert) -> HomeExpert:+ return HomeExpert(+ id=expert.id,+ name=expert.name,+ role=expert.role,+ avatar_url=expert.avatar_url,+ )+++def experts_by_schedule(+ experts: list[Expert], schedules: list[GraphExecutionJobInfo]+) -> dict[str, Expert]:+ """Map job id to owning expert.++ `graph_id` is not a schedule key — one graph can back several jobs, and an+ org context mixes in teammates' jobs — so attribute a job by its own expert+ stamp, falling back to the workflow whose schedule created it.+ """+ expert_by_id = {expert.id: expert for expert in experts}+ expert_by_schedule_id = {+ workflow.schedule_id: expert+ for expert in experts+ for workflow in expert.workflows+ if workflow.schedule_id+ }+ owners = {+ schedule.id: expert_by_id.get(schedule.expert_id or "")+ or expert_by_schedule_id.get(schedule.id)+ for schedule in schedules+ }+ return {schedule_id: expert for schedule_id, expert in owners.items() if expert}+++def next_runs_by_expert(+ schedules: list[GraphExecutionJobInfo], expert_by_schedule: dict[str, Expert]+) -> dict[str, datetime]:+ """Earliest upcoming run per expert, across every job that expert owns."""+ earliest: dict[str, datetime] = {}+ for schedule in schedules:+ expert = expert_by_schedule.get(schedule.id)+ next_run = parse_datetime(schedule.next_run_time)+ if not expert or next_run is None:+ continue+ current = earliest.get(expert.id)+ if current is None or next_run < current:+ earliest[expert.id] = next_run+ return earliest+++class AgentRef(BaseModel):+ model_config = ConfigDict(frozen=True)++ name: str+ library_agent_id: str | None+++UNKNOWN_AGENT = AgentRef(name="Agent task", library_agent_id=None)+++def agent_refs_by_graph(+ experts: list[Expert], refs: list[LibraryAgentRef]+) -> dict[str, AgentRef]:+ agents = {+ ref.graph_id: AgentRef(+ name=ref.name or UNKNOWN_AGENT.name, library_agent_id=ref.id+ )+ for ref in refs+ }+ for expert in experts:+ for workflow in expert.workflows:+ if workflow.graph_id:+ current = agents.get(workflow.graph_id, UNKNOWN_AGENT)+ agents[workflow.graph_id] = AgentRef(+ name=workflow.name or current.name,+ library_agent_id=workflow.library_agent_id+ or current.library_agent_id,+ )+ return agents+++def setup_count(expert: Expert) -> int:+ return sum(+ bool(workflow.schedule_cron and not workflow.schedule_id)+ for workflow in expert.workflows+ )+++def as_utc(value: datetime) -> datetime:+ """Stored timestamps can come back naive; comparing those to an aware `now`+ raises, so pin anything naive to UTC before it reaches arithmetic or sorting.+ """+ return value if value.tzinfo is not None else value.replace(tzinfo=timezone.utc)+++def as_utc_or_none(value: datetime | None) -> datetime | None:+ return as_utc(value) if value else None+++def parse_datetime(value: str) -> datetime | None:+ try:+ parsed = datetime.fromisoformat(value.replace("Z", "+00:00"))+ except ValueError:+ return None+ return as_utc(parsed)+++def run_link(library_id: str | None, execution_id: str) -> str | None:+ if not library_id:+ return None+ return (+ f"/library/agents/{quote(library_id)}"+ f"?activeTab=runs&activeItem={quote(execution_id)}"+ )+++def split_summary(+ value: str | None, *, fallback_title: str, fallback_detail: str+) -> tuple[str, str]:+ compact = " ".join(value.split()) if value else ""+ if not compact:+ return fallback_title, fallback_detail+ if ". " not in compact:+ return compact[:_TITLE_MAX], fallback_detail+ title, detail = compact.split(". ", 1)+ return f"{title}.", detaildiff --git a/autogpt_platform/backend/backend/api/features/home/helpers_test.py b/autogpt_platform/backend/backend/api/features/home/helpers_test.pynew file mode 100644index 0000000000..e48e831062--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/home/helpers_test.py@@ -0,0 +1,167 @@+from datetime import datetime, timezone++from backend.api.features.experts.models import Expert, ExpertWorkflowRef+from backend.executor.scheduler import GraphExecutionJobInfo++from .activity import compose_upcoming_tasks+from .helpers import (+ experts_by_schedule,+ next_runs_by_expert,+ parse_datetime,+ run_link,+ split_summary,+)++SHARED_GRAPH = "graph-shared"+++def _expert(expert_id: str, *, schedule_id: str | None = None) -> Expert:+ return Expert(+ id=expert_id,+ name=f"Expert {expert_id}",+ avatar_url=None,+ role="Assistant",+ tagline=None,+ bio=None,+ skills=[],+ identity="",+ voice_preferences="",+ boundaries="",+ protected_soul_rules=[],+ is_template=False,+ source_template_id=None,+ is_archived=False,+ workflows=[+ ExpertWorkflowRef(+ id=f"workflow-{expert_id}",+ store_listing_version_id=None,+ library_agent_id=None,+ graph_id=SHARED_GRAPH,+ name="Inbox triage",+ description=None,+ schedule_id=schedule_id,+ )+ ],+ )+++def _job(+ job_id: str, *, next_run: str, expert_id: str | None = None+) -> GraphExecutionJobInfo:+ return GraphExecutionJobInfo(+ id=job_id,+ schedule_id=job_id,+ name=job_id,+ next_run_time=next_run,+ user_id="user",+ graph_id=SHARED_GRAPH,+ graph_version=1,+ cron="0 9 * * *",+ input_data={},+ expert_id=expert_id,+ )+++def test_jobs_sharing_a_graph_keep_their_own_owner() -> None:+ experts = [_expert("alice"), _expert("bob")]+ jobs = [+ _job("job-alice", next_run="2026-08-10T10:00:00Z", expert_id="alice"),+ _job("job-bob", next_run="2026-08-10T11:00:00Z", expert_id="bob"),+ ]++ owners = experts_by_schedule(experts, jobs)++ assert {job_id: expert.id for job_id, expert in owners.items()} == {+ "job-alice": "alice",+ "job-bob": "bob",+ }+++def test_job_without_expert_stamp_falls_back_to_workflow_schedule() -> None:+ experts = [_expert("alice", schedule_id="job-legacy")]+ jobs = [_job("job-legacy", next_run="2026-08-10T10:00:00Z")]++ owners = experts_by_schedule(experts, jobs)++ assert owners["job-legacy"].id == "alice"+++def test_unowned_job_is_left_unattributed() -> None:+ jobs = [_job("job-teammate", next_run="2026-08-10T10:00:00Z", expert_id="carol")]++ assert experts_by_schedule([_expert("alice")], jobs) == {}+++def test_next_run_uses_earliest_of_an_experts_jobs() -> None:+ experts = [_expert("alice")]+ jobs = [+ _job("job-late", next_run="2026-08-10T18:00:00Z", expert_id="alice"),+ _job("job-early", next_run="2026-08-10T10:00:00Z", expert_id="alice"),+ ]++ next_runs = next_runs_by_expert(jobs, experts_by_schedule(experts, jobs))++ assert next_runs == {"alice": datetime(2026, 8, 10, 10, 0, tzinfo=timezone.utc)}+++def test_upcoming_tasks_attribute_each_job_to_its_own_expert() -> None:+ experts = [_expert("alice"), _expert("bob")]+ jobs = [+ _job("job-alice", next_run="2026-08-10T10:00:00Z", expert_id="alice"),+ _job("job-bob", next_run="2026-08-10T11:00:00Z", expert_id="bob"),+ ]++ tasks = compose_upcoming_tasks(list(jobs), experts_by_schedule(experts, jobs))++ assert [(task.id, task.expert.id if task.expert else None) for task in tasks] == [+ ("job-alice", "alice"),+ ("job-bob", "bob"),+ ]+++def test_split_summary_uses_fallbacks_for_empty_input() -> None:+ assert split_summary(None, fallback_title="Ran", fallback_detail="All good") == (+ "Ran",+ "All good",+ )+ assert split_summary(" ", fallback_title="Ran", fallback_detail="All good") == (+ "Ran",+ "All good",+ )+++def test_split_summary_clips_a_single_sentence_title() -> None:+ title, detail = split_summary(+ "x" * 200, fallback_title="Ran", fallback_detail="All good"+ )++ assert title == "x" * 120+ assert detail == "All good"+++def test_split_summary_splits_on_the_first_sentence() -> None:+ assert split_summary(+ "Sorted 12 emails. Nothing needed a reply.",+ fallback_title="Ran",+ fallback_detail="All good",+ ) == ("Sorted 12 emails.", "Nothing needed a reply.")+++def test_parse_datetime_pins_naive_values_to_utc() -> None:+ assert parse_datetime("2026-08-10T09:00:00") == datetime(+ 2026, 8, 10, 9, 0, tzinfo=timezone.utc+ )+ assert parse_datetime("2026-08-10T09:00:00Z") == datetime(+ 2026, 8, 10, 9, 0, tzinfo=timezone.utc+ )+++def test_parse_datetime_returns_none_for_garbage() -> None:+ assert parse_datetime("not-a-timestamp") is None+++def test_run_link_needs_a_library_agent() -> None:+ assert run_link(None, "execution") is None+ assert run_link("library agent", "exec/1") == (+ "/library/agents/library%20agent?activeTab=runs&activeItem=exec/1"+ )diff --git a/autogpt_platform/backend/backend/api/features/home/models.py b/autogpt_platform/backend/backend/api/features/home/models.pynew file mode 100644index 0000000000..1ada6e4e36--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/home/models.py@@ -0,0 +1,120 @@+from datetime import date, datetime+from typing import Literal++from pydantic import BaseModel++from backend.api.features.executions.review.model import PendingHumanReviewModel+++class HomeExpert(BaseModel):+ id: str+ name: str+ role: str+ avatar_url: str | None+++class HomeAction(BaseModel):+ label: str+ href: str+++class HomeAttentionItem(BaseModel):+ id: str+ kind: Literal["approval", "setup", "paused", "credits"]+ priority: Literal["high", "normal"]+ title: str+ description: str+ why_it_matters: str+ expert: HomeExpert | None = None+ agent_name: str | None = None+ created_at: datetime | None = None+ preview: str | None = None+ review: PendingHumanReviewModel | None = None+ primary_action: HomeAction+ secondary_action: HomeAction | None = None+++class HomeBriefingOutcome(BaseModel):+ id: str+ status: Literal["completed", "failed"]+ title: str+ summary: str+ expert: HomeExpert | None = None+ agent_name: str+ occurred_at: datetime | None = None+ duration_seconds: float = 0+ cost_cents: int = 0+ link: str | None = None+++class HomeBriefing(BaseModel):+ generated_at: datetime+ window_started_at: datetime+ completed_count: int+ failed_count: int+ routine_count: int+ outcomes: list[HomeBriefingOutcome]+++class HomeActiveTask(BaseModel):+ id: str+ title: str+ status: Literal["running", "queued"]+ expert: HomeExpert | None = None+ started_at: datetime | None = None+ link: str | None = None+++class HomeUpcomingTask(BaseModel):+ id: str+ title: str+ kind: Literal["agent", "followup"]+ expert: HomeExpert | None = None+ next_run_time: datetime+++class HomeAgentStatus(BaseModel):+ expert: HomeExpert+ status: Literal["ready", "working", "needs_setup", "paused", "failed"]+ detail: str+ next_run_time: datetime | None = None+++class HomeTeamSummary(BaseModel):+ total: int+ ready: int+ working: int+ needs_attention: int+++class HomeDailyActivity(BaseModel):+ date: date+ completed_count: int+ review_count: int+ failed_count: int+++class HomeWeekSummary(BaseModel):+ run_count: int+ completed_count: int+ review_count: int+ failed_count: int+ total_runtime_seconds: float+ # Runs that actually contributed to `total_runtime_seconds`; dividing by+ # `run_count` would bias an average down with in-flight/stats-less runs.+ timed_run_count: int+ total_cost_cents: int+ credits_balance: int | None+ daily: list[HomeDailyActivity]+++class HomeDashboardResponse(BaseModel):+ generated_at: datetime+ timezone: str+ attention: list[HomeAttentionItem]+ briefing: HomeBriefing+ active_tasks: list[HomeActiveTask]+ upcoming_tasks: list[HomeUpcomingTask]+ team: HomeTeamSummary+ agents: list[HomeAgentStatus]+ week: HomeWeekSummarydiff --git a/autogpt_platform/backend/backend/api/features/home/routes.py b/autogpt_platform/backend/backend/api/features/home/routes.pynew file mode 100644index 0000000000..43e5e704d7--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/home/routes.py@@ -0,0 +1,23 @@+import autogpt_libs.auth as autogpt_auth_lib+from autogpt_libs.auth import get_request_context+from autogpt_libs.auth.models import RequestContext+from fastapi import APIRouter, Security++from .models import HomeDashboardResponse+from .service import build_home_dashboard++router = APIRouter(+ prefix="/home",+ tags=["home", "private"],+ dependencies=[Security(autogpt_auth_lib.requires_user)],+)++[email protected]("", operation_id="get_home_dashboard")+async def get_home_dashboard(+ user_id: str = Security(autogpt_auth_lib.get_user_id),+ ctx: RequestContext = Security(get_request_context),+) -> HomeDashboardResponse:+ # `organization_id` only selects the credit model; every other source on this+ # page is owner-scoped.+ return await build_home_dashboard(user_id=user_id, organization_id=ctx.org_id)diff --git a/autogpt_platform/backend/backend/api/features/home/routes_test.py b/autogpt_platform/backend/backend/api/features/home/routes_test.pynew file mode 100644index 0000000000..8297e5c2f2--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/home/routes_test.py@@ -0,0 +1,119 @@+from datetime import datetime, timezone+from unittest.mock import AsyncMock++import fastapi+import fastapi.testclient+import pytest+from pytest_mock import MockerFixture++from .models import (+ HomeAction,+ HomeAttentionItem,+ HomeBriefing,+ HomeDashboardResponse,+ HomeTeamSummary,+ HomeWeekSummary,+)+from .routes import router++app = fastapi.FastAPI()+app.include_router(router)+client = fastapi.testclient.TestClient(app)++NOW = datetime(2026, 8, 10, 9, 0, tzinfo=timezone.utc)++[email protected](autouse=True)+def setup_app_auth(mock_jwt_user):+ from autogpt_libs.auth import get_request_context+ from autogpt_libs.auth.jwt_utils import get_jwt_payload++ app.dependency_overrides[get_jwt_payload] = mock_jwt_user["get_jwt_payload"]+ app.dependency_overrides[get_request_context] = mock_jwt_user["get_request_context"]+ yield+ app.dependency_overrides.clear()+++def _dashboard() -> HomeDashboardResponse:+ return HomeDashboardResponse(+ generated_at=NOW,+ timezone="UTC",+ attention=[+ HomeAttentionItem(+ id="approval-node",+ kind="approval",+ priority="high",+ title="Send the prepared message",+ description="Your agent paused before taking an external action.",+ why_it_matters="The task cannot continue until you decide.",+ primary_action=HomeAction(label="Review", href="/library"),+ )+ ],+ briefing=HomeBriefing(+ generated_at=NOW,+ window_started_at=NOW,+ completed_count=0,+ failed_count=0,+ routine_count=0,+ outcomes=[],+ ),+ active_tasks=[],+ upcoming_tasks=[],+ team=HomeTeamSummary(total=0, ready=0, working=0, needs_attention=0),+ agents=[],+ week=HomeWeekSummary(+ run_count=0,+ completed_count=0,+ review_count=0,+ failed_count=0,+ total_runtime_seconds=0,+ timed_run_count=0,+ total_cost_cents=0,+ credits_balance=None,+ daily=[],+ ),+ )+++def test_get_home_dashboard_returns_single_payload(+ mocker: MockerFixture, test_user_id: str+) -> None:+ build = mocker.patch(+ "backend.api.features.home.routes.build_home_dashboard",+ AsyncMock(return_value=_dashboard()),+ )++ response = client.get("/home")++ assert response.status_code == 200+ body = response.json()+ assert body["timezone"] == "UTC"+ assert body["attention"][0]["kind"] == "approval"+ assert set(body) >= {"attention", "briefing", "active_tasks", "team", "week"}+ build.assert_awaited_once_with(user_id=test_user_id, organization_id="test-org")+++def test_personal_context_passes_no_organization(+ mocker: MockerFixture, test_user_id: str+) -> None:+ from autogpt_libs.auth import get_request_context+ from autogpt_libs.auth.models import RequestContext++ app.dependency_overrides[get_request_context] = lambda: RequestContext(+ user_id=test_user_id,+ org_id=None,+ team_id=None,+ is_org_owner=False,+ is_org_admin=False,+ is_org_billing_manager=False,+ is_team_admin=False,+ is_team_billing_manager=False,+ seat_status=None,+ )+ build = mocker.patch(+ "backend.api.features.home.routes.build_home_dashboard",+ AsyncMock(return_value=_dashboard()),+ )++ assert client.get("/home").status_code == 200+ build.assert_awaited_once_with(user_id=test_user_id, organization_id=None)diff --git a/autogpt_platform/backend/backend/api/features/home/service.py b/autogpt_platform/backend/backend/api/features/home/service.pynew file mode 100644index 0000000000..16e6f1abd9--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/home/service.py@@ -0,0 +1,154 @@+import asyncio+import logging+from datetime import datetime, timedelta, timezone+from typing import Any++from pydantic import BaseModel++from backend.api.features.executions.activity_gate import (+ hide_activity_summaries_if_disabled,+)+from backend.api.features.executions.review.model import PendingHumanReviewModel+from backend.api.features.experts import experts_db+from backend.api.features.experts.models import Expert+from backend.api.features.library import db as library_db+from backend.data import execution as execution_db+from backend.data import human_review as review_db+from backend.data import user as user_db+from backend.data.credit import get_credit_model+from backend.data.execution import GraphExecutionMeta+from backend.data.execution_cost_summary import (+ UserExecutionCostSummary,+ get_user_cost_summary,+)+from backend.executor.scheduler import CopilotTurnJobInfo, GraphExecutionJobInfo+from backend.util.clients import get_scheduler_client+from backend.util.timezone_utils import get_user_timezone_or_utc++from .compose import compose_home_dashboard+from .models import HomeDashboardResponse++logger = logging.getLogger(__name__)++_EXECUTION_LIMIT = 300+_REVIEW_LIMIT = 100+++class HomeSourceData(BaseModel):+ experts: list[Expert]+ executions: list[GraphExecutionMeta]+ reviews: list[PendingHumanReviewModel]+ cost_summary: UserExecutionCostSummary+ schedules: list[GraphExecutionJobInfo | CopilotTurnJobInfo]+ credits_balance: int | None+ timezone_name: str+++async def build_home_dashboard(+ *,+ user_id: str,+ organization_id: str | None = None,+) -> HomeDashboardResponse:+ now = datetime.now(timezone.utc)+ week_start = now - timedelta(days=7)+ data = await _load_home_source_data(+ user_id=user_id,+ organization_id=organization_id,+ now=now,+ week_start=week_start,+ )+ graph_ids = list(+ {execution.graph_id for execution in data.executions}+ | {review.graph_id for review in data.reviews}+ )+ library_refs = await library_db.get_library_agent_refs_by_graph_ids(+ user_id, graph_ids+ )++ return compose_home_dashboard(+ now=now,+ experts=data.experts,+ executions=data.executions,+ reviews=data.reviews,+ schedules=data.schedules,+ library_refs=library_refs,+ cost_summary=data.cost_summary,+ credits_balance=data.credits_balance,+ timezone_name=data.timezone_name,+ )+++async def _load_home_source_data(+ *,+ user_id: str,+ organization_id: str | None,+ now: datetime,+ week_start: datetime,+) -> HomeSourceData:+ experts_task = asyncio.create_task(experts_db.list_experts(user_id))+ executions_task = asyncio.create_task(+ execution_db.get_graph_executions(+ user_id=user_id,+ created_time_gte=week_start,+ created_time_lte=now,+ limit=_EXECUTION_LIMIT,+ )+ )+ reviews_task = asyncio.create_task(+ review_db.get_pending_reviews_for_user(user_id, page=1, page_size=_REVIEW_LIMIT)+ )+ cost_summary_task = asyncio.create_task(+ get_user_cost_summary(user_id=user_id, since=week_start, until=now)+ )+ schedules_task = asyncio.create_task(_get_schedules(user_id=user_id))+ credits_task = asyncio.create_task(+ _get_credits(user_id=user_id, organization_id=organization_id)+ )+ user_task = asyncio.create_task(user_db.get_user_by_id(user_id))+ # Gather rather than awaiting one by one: a failure in the first task would+ # otherwise leave the rest detached with their exceptions never retrieved.+ started: list[asyncio.Task[Any]] = [+ experts_task,+ executions_task,+ reviews_task,+ cost_summary_task,+ schedules_task,+ credits_task,+ user_task,+ ]+ await asyncio.gather(*started)+ user = user_task.result()+ return HomeSourceData(+ experts=experts_task.result(),+ executions=await hide_activity_summaries_if_disabled(+ executions_task.result(), user_id+ ),+ reviews=reviews_task.result(),+ cost_summary=cost_summary_task.result(),+ schedules=schedules_task.result(),+ credits_balance=credits_task.result(),+ timezone_name=get_user_timezone_or_utc(user.timezone if user else None),+ )+++async def _get_schedules(+ *,+ user_id: str,+) -> list[GraphExecutionJobInfo | CopilotTurnJobInfo]:+ # Deliberately owner-scoped: executions, reviews and cost totals on this page+ # are all personal, so org/team schedules would surface upcoming runs whose+ # outcomes and approvals could never appear anywhere else on the dashboard.+ try:+ return await get_scheduler_client().get_execution_schedules(user_id=user_id)+ except Exception:+ logger.warning("Home could not load schedules for user %s", user_id[:12])+ return []+++async def _get_credits(*, user_id: str, organization_id: str | None) -> int | None:+ try:+ model = await get_credit_model(user_id, organization_id)+ return await model.get_credits(user_id, organization_id)+ except Exception:+ logger.warning("Home could not load credits for user %s", user_id[:12])+ return Nonediff --git a/autogpt_platform/backend/backend/api/features/home/service_test.py b/autogpt_platform/backend/backend/api/features/home/service_test.pynew file mode 100644index 0000000000..bdf5bdc29d--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/home/service_test.py@@ -0,0 +1,162 @@+from datetime import datetime, timedelta, timezone+from unittest.mock import AsyncMock, MagicMock++import pytest+from pytest_mock import MockerFixture++from backend.data.execution import ExecutionStatus, GraphExecutionMeta+from backend.data.execution_cost_summary import UserExecutionCostSummary++from .service import build_home_dashboard+++def _execution() -> GraphExecutionMeta:+ # `build_home_dashboard` reads the live clock, so anchor the run to now — a+ # fixed timestamp would drop out of the 24h briefing window over time.+ ran_at = datetime.now(timezone.utc) - timedelta(minutes=5)+ return GraphExecutionMeta(+ id="exec-1",+ user_id="user-1",+ graph_id="graph-1",+ graph_version=1,+ inputs=None,+ credential_inputs=None,+ nodes_input_masks=None,+ preset_id=None,+ status=ExecutionStatus.COMPLETED,+ started_at=ran_at,+ ended_at=ran_at,+ stats=GraphExecutionMeta.Stats(activity_status="Booked the flight."),+ )+++def _cost_summary() -> UserExecutionCostSummary:+ return UserExecutionCostSummary(+ total_cents=0,+ run_count=0,+ billable_run_count=0,+ failed_cost_cents=0,+ by_agent=[],+ top_runs=[],+ daily=[],+ )+++def home_dependencies(mocker: MockerFixture):+ mocker.patch(+ "backend.api.features.home.service.experts_db.list_experts",+ AsyncMock(return_value=[]),+ )+ mocker.patch(+ "backend.api.features.home.service.execution_db.get_graph_executions",+ AsyncMock(return_value=[_execution()]),+ )+ mocker.patch(+ "backend.api.features.home.service.review_db.get_pending_reviews_for_user",+ AsyncMock(return_value=[]),+ )+ mocker.patch(+ "backend.api.features.home.service.get_user_cost_summary",+ AsyncMock(return_value=_cost_summary()),+ )+ mocker.patch(+ "backend.api.features.home.service.library_db.get_library_agent_refs_by_graph_ids",+ AsyncMock(return_value=[]),+ )+ mocker.patch(+ "backend.api.features.home.service.user_db.get_user_by_id",+ AsyncMock(return_value=None),+ )+ scheduler = MagicMock()+ scheduler.get_execution_schedules = AsyncMock(return_value=[])+ mocker.patch(+ "backend.api.features.home.service.get_scheduler_client", return_value=scheduler+ )+ credit_model = MagicMock()+ credit_model.get_credits = AsyncMock(return_value=100)+ mocker.patch(+ "backend.api.features.home.service.get_credit_model",+ AsyncMock(return_value=credit_model),+ )+++async def test_activity_summary_surfaces_when_flag_enabled(+ mocker: MockerFixture, home_dependencies+) -> None:+ mocker.patch(+ "backend.api.features.executions.activity_gate.is_feature_enabled",+ AsyncMock(return_value=True),+ )++ dashboard = await build_home_dashboard(user_id="user-1")++ assert dashboard.briefing.outcomes[0].title == "Booked the flight."+++async def test_activity_summary_hidden_when_flag_disabled(+ mocker: MockerFixture, home_dependencies+) -> None:+ mocker.patch(+ "backend.api.features.executions.activity_gate.is_feature_enabled",+ AsyncMock(return_value=False),+ )++ dashboard = await build_home_dashboard(user_id="user-1")++ assert dashboard.briefing.outcomes[0].title == "Agent task finished"+++async def test_schedules_stay_owner_scoped_inside_an_organization(+ mocker: MockerFixture, home_dependencies+) -> None:+ mocker.patch(+ "backend.api.features.executions.activity_gate.is_feature_enabled",+ AsyncMock(return_value=True),+ )+ scheduler = MagicMock()+ scheduler.get_execution_schedules = AsyncMock(return_value=[])+ mocker.patch(+ "backend.api.features.home.service.get_scheduler_client", return_value=scheduler+ )+ credit_model = MagicMock()+ credit_model.get_credits = AsyncMock(return_value=100)+ get_credit_model = mocker.patch(+ "backend.api.features.home.service.get_credit_model",+ AsyncMock(return_value=credit_model),+ )++ await build_home_dashboard(user_id="user-1", organization_id="org-1")++ # Executions, reviews and cost totals are personal, so a teammate's schedule+ # would show an upcoming run whose outcome never lands anywhere else.+ scheduler.get_execution_schedules.assert_awaited_once_with(user_id="user-1")+ get_credit_model.assert_awaited_once_with("user-1", "org-1")+++async def test_scheduler_and_credit_failures_degrade_instead_of_failing_the_page(+ mocker: MockerFixture, home_dependencies+) -> None:+ mocker.patch(+ "backend.api.features.executions.activity_gate.is_feature_enabled",+ AsyncMock(return_value=True),+ )+ scheduler = MagicMock()+ scheduler.get_execution_schedules = AsyncMock(side_effect=RuntimeError("scheduler"))+ mocker.patch(+ "backend.api.features.home.service.get_scheduler_client", return_value=scheduler+ )+ mocker.patch(+ "backend.api.features.home.service.get_credit_model",+ AsyncMock(side_effect=RuntimeError("credits")),+ )++ dashboard = await build_home_dashboard(user_id="user-1")++ assert dashboard.upcoming_tasks == []+ assert dashboard.week.credits_balance is None+ assert dashboard.briefing.outcomes[0].title == "Booked the flight."diff --git a/autogpt_platform/backend/backend/api/features/v1.py b/autogpt_platform/backend/backend/api/features/v1.pyindex ab09eb18a4..a134fa748b 100644--- a/autogpt_platform/backend/backend/api/features/v1.py+++ b/autogpt_platform/backend/backend/api/features/v1.py@@ -36,6 +36,10 @@ from starlette.status import ()from typing_extensions import Optional, TypedDict+from backend.api.features.executions.activity_gate import (+ hide_activity_summaries_if_disabled,+ hide_activity_summary_if_disabled,+)from backend.api.features.experts import experts_dbfrom backend.api.features.store.exceptions import VirusDetectedError, VirusScanErrorfrom backend.api.features.workspace.routes import create_file_download_response@@ -2170,23 +2174,6 @@ async def list_graph_executions()-async def hide_activity_summaries_if_disabled(- executions: list[execution_db.GraphExecutionMeta], user_id: str-) -> list[execution_db.GraphExecutionMeta]:- """Hide activity summaries and scores if AI_ACTIVITY_STATUS feature is disabled."""- if await is_feature_enabled(Flag.AI_ACTIVITY_STATUS, user_id):- return executions # Return as-is if feature is enabled-- # Filter out activity features if disabled- filtered_executions = []- for execution in executions:- if execution.stats:- filtered_stats = execution.stats.without_activity_features()- execution = execution.model_copy(update={"stats": filtered_stats})- filtered_executions.append(execution)- return filtered_executions--@v1_router.get(path="/graphs/{graph_id}/executions/{graph_exec_id}",summary="Get execution details",@@ -2232,21 +2219,6 @@ async def get_graph_execution(return result-async def hide_activity_summary_if_disabled(- execution: execution_db.GraphExecution | execution_db.GraphExecutionWithNodes,- user_id: str,-) -> execution_db.GraphExecution | execution_db.GraphExecutionWithNodes:- """Hide activity summary and score for a single execution if AI_ACTIVITY_STATUS feature is disabled."""- if await is_feature_enabled(Flag.AI_ACTIVITY_STATUS, user_id):- return execution # Return as-is if feature is enabled-- # Filter out activity features if disabled- if execution.stats:- filtered_stats = execution.stats.without_activity_features()- return execution.model_copy(update={"stats": filtered_stats})- return execution--@v1_router.delete(path="/executions/{graph_exec_id}",summary="Delete graph execution",diff --git a/autogpt_platform/backend/backend/api/rest_api.py b/autogpt_platform/backend/backend/api/rest_api.pyindex 9167d35075..d6c0869faa 100644--- a/autogpt_platform/backend/backend/api/rest_api.py+++ b/autogpt_platform/backend/backend/api/rest_api.py@@ -33,6 +33,7 @@ import backend.api.features.chat.routes as chat_routesimport backend.api.features.chat.share as chat_shareimport backend.api.features.executions.review.routesimport backend.api.features.experts.routes as experts_routes+import backend.api.features.home.routes as home_routesimport backend.api.features.library.dbimport backend.api.features.library.modelimport backend.api.features.library.routes@@ -431,6 +432,7 @@ app.include_router(backend.api.features.library.routes.router, tags=["v2"], prefix="/api/library")app.include_router(experts_routes.router, tags=["v2", "experts"], prefix="/api")+app.include_router(home_routes.router, prefix="/api")app.include_router(backend.api.features.otto.routes.router, tags=["v2", "otto"], prefix="/api/otto")diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.jsonindex 028f229aa8..1f9667f1a7 100644--- a/autogpt_platform/frontend/src/app/api/openapi.json+++ b/autogpt_platform/frontend/src/app/api/openapi.json@@ -6610,6 +6610,29 @@}}},+ "/api/home": {+ "get": {+ "tags": ["home", "private"],+ "summary": "Get Home Dashboard",+ "operationId": "get_home_dashboard",+ "responses": {+ "200": {+ "description": "Successful Response",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HomeDashboardResponse"+ }+ }+ }+ },+ "401": {+ "$ref": "#/components/responses/HTTP401NotAuthenticatedError"+ }+ },+ "security": [{ "HTTPBearerJWT": [] }]+ }+ },"/api/integrations/ayrshare/sso_url": {"get": {"tags": ["v1", "integrations"],@@ -18672,6 +18695,351 @@"required": ["expert", "failed_preloads"],"title": "HireResult"},+ "HomeAction": {+ "properties": {+ "label": { "type": "string", "title": "Label" },+ "href": { "type": "string", "title": "Href" }+ },+ "type": "object",+ "required": ["label", "href"],+ "title": "HomeAction"+ },+ "HomeActiveTask": {+ "properties": {+ "id": { "type": "string", "title": "Id" },+ "title": { "type": "string", "title": "Title" },+ "status": {+ "type": "string",+ "enum": ["running", "queued"],+ "title": "Status"+ },+ "expert": {+ "anyOf": [+ { "$ref": "#/components/schemas/HomeExpert" },+ { "type": "null" }+ ]+ },+ "started_at": {+ "anyOf": [+ { "type": "string", "format": "date-time" },+ { "type": "null" }+ ],+ "title": "Started At"+ },+ "link": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Link"+ }+ },+ "type": "object",+ "required": ["id", "title", "status"],+ "title": "HomeActiveTask"+ },+ "HomeAgentStatus": {+ "properties": {+ "expert": { "$ref": "#/components/schemas/HomeExpert" },+ "status": {+ "type": "string",+ "enum": ["ready", "working", "needs_setup", "paused", "failed"],+ "title": "Status"+ },+ "detail": { "type": "string", "title": "Detail" },+ "next_run_time": {+ "anyOf": [+ { "type": "string", "format": "date-time" },+ { "type": "null" }+ ],+ "title": "Next Run Time"+ }+ },+ "type": "object",+ "required": ["expert", "status", "detail"],+ "title": "HomeAgentStatus"+ },+ "HomeAttentionItem": {+ "properties": {+ "id": { "type": "string", "title": "Id" },+ "kind": {+ "type": "string",+ "enum": ["approval", "setup", "paused", "credits"],+ "title": "Kind"+ },+ "priority": {+ "type": "string",+ "enum": ["high", "normal"],+ "title": "Priority"+ },+ "title": { "type": "string", "title": "Title" },+ "description": { "type": "string", "title": "Description" },+ "why_it_matters": { "type": "string", "title": "Why It Matters" },+ "expert": {+ "anyOf": [+ { "$ref": "#/components/schemas/HomeExpert" },+ { "type": "null" }+ ]+ },+ "agent_name": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Agent Name"+ },+ "created_at": {+ "anyOf": [+ { "type": "string", "format": "date-time" },+ { "type": "null" }+ ],+ "title": "Created At"+ },+ "preview": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Preview"+ },+ "review": {+ "anyOf": [+ { "$ref": "#/components/schemas/PendingHumanReviewModel" },+ { "type": "null" }+ ]+ },+ "primary_action": { "$ref": "#/components/schemas/HomeAction" },+ "secondary_action": {+ "anyOf": [+ { "$ref": "#/components/schemas/HomeAction" },+ { "type": "null" }+ ]+ }+ },+ "type": "object",+ "required": [+ "id",+ "kind",+ "priority",+ "title",+ "description",+ "why_it_matters",+ "primary_action"+ ],+ "title": "HomeAttentionItem"+ },+ "HomeBriefing": {+ "properties": {+ "generated_at": {+ "type": "string",+ "format": "date-time",+ "title": "Generated At"+ },+ "window_started_at": {+ "type": "string",+ "format": "date-time",+ "title": "Window Started At"+ },+ "completed_count": { "type": "integer", "title": "Completed Count" },+ "failed_count": { "type": "integer", "title": "Failed Count" },+ "routine_count": { "type": "integer", "title": "Routine Count" },+ "outcomes": {+ "items": { "$ref": "#/components/schemas/HomeBriefingOutcome" },+ "type": "array",+ "title": "Outcomes"+ }+ },+ "type": "object",+ "required": [+ "generated_at",+ "window_started_at",+ "completed_count",+ "failed_count",+ "routine_count",+ "outcomes"+ ],+ "title": "HomeBriefing"+ },+ "HomeBriefingOutcome": {+ "properties": {+ "id": { "type": "string", "title": "Id" },+ "status": {+ "type": "string",+ "enum": ["completed", "failed"],+ "title": "Status"+ },+ "title": { "type": "string", "title": "Title" },+ "summary": { "type": "string", "title": "Summary" },+ "expert": {+ "anyOf": [+ { "$ref": "#/components/schemas/HomeExpert" },+ { "type": "null" }+ ]+ },+ "agent_name": { "type": "string", "title": "Agent Name" },+ "occurred_at": {+ "anyOf": [+ { "type": "string", "format": "date-time" },+ { "type": "null" }+ ],+ "title": "Occurred At"+ },+ "duration_seconds": {+ "type": "number",+ "title": "Duration Seconds",+ "default": 0+ },+ "cost_cents": {+ "type": "integer",+ "title": "Cost Cents",+ "default": 0+ },+ "link": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Link"+ }+ },+ "type": "object",+ "required": ["id", "status", "title", "summary", "agent_name"],+ "title": "HomeBriefingOutcome"+ },+ "HomeDailyActivity": {+ "properties": {+ "date": { "type": "string", "format": "date", "title": "Date" },+ "completed_count": { "type": "integer", "title": "Completed Count" },+ "review_count": { "type": "integer", "title": "Review Count" },+ "failed_count": { "type": "integer", "title": "Failed Count" }+ },+ "type": "object",+ "required": ["date", "completed_count", "review_count", "failed_count"],+ "title": "HomeDailyActivity"+ },+ "HomeDashboardResponse": {+ "properties": {+ "generated_at": {+ "type": "string",+ "format": "date-time",+ "title": "Generated At"+ },+ "timezone": { "type": "string", "title": "Timezone" },+ "attention": {+ "items": { "$ref": "#/components/schemas/HomeAttentionItem" },+ "type": "array",+ "title": "Attention"+ },+ "briefing": { "$ref": "#/components/schemas/HomeBriefing" },+ "active_tasks": {+ "items": { "$ref": "#/components/schemas/HomeActiveTask" },+ "type": "array",+ "title": "Active Tasks"+ },+ "upcoming_tasks": {+ "items": { "$ref": "#/components/schemas/HomeUpcomingTask" },+ "type": "array",+ "title": "Upcoming Tasks"+ },+ "team": { "$ref": "#/components/schemas/HomeTeamSummary" },+ "agents": {+ "items": { "$ref": "#/components/schemas/HomeAgentStatus" },+ "type": "array",+ "title": "Agents"+ },+ "week": { "$ref": "#/components/schemas/HomeWeekSummary" }+ },+ "type": "object",+ "required": [+ "generated_at",+ "timezone",+ "attention",+ "briefing",+ "active_tasks",+ "upcoming_tasks",+ "team",+ "agents",+ "week"+ ],+ "title": "HomeDashboardResponse"+ },+ "HomeExpert": {+ "properties": {+ "id": { "type": "string", "title": "Id" },+ "name": { "type": "string", "title": "Name" },+ "role": { "type": "string", "title": "Role" },+ "avatar_url": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Avatar Url"+ }+ },+ "type": "object",+ "required": ["id", "name", "role", "avatar_url"],+ "title": "HomeExpert"+ },+ "HomeTeamSummary": {+ "properties": {+ "total": { "type": "integer", "title": "Total" },+ "ready": { "type": "integer", "title": "Ready" },+ "working": { "type": "integer", "title": "Working" },+ "needs_attention": { "type": "integer", "title": "Needs Attention" }+ },+ "type": "object",+ "required": ["total", "ready", "working", "needs_attention"],+ "title": "HomeTeamSummary"+ },+ "HomeUpcomingTask": {+ "properties": {+ "id": { "type": "string", "title": "Id" },+ "title": { "type": "string", "title": "Title" },+ "kind": {+ "type": "string",+ "enum": ["agent", "followup"],+ "title": "Kind"+ },+ "expert": {+ "anyOf": [+ { "$ref": "#/components/schemas/HomeExpert" },+ { "type": "null" }+ ]+ },+ "next_run_time": {+ "type": "string",+ "format": "date-time",+ "title": "Next Run Time"+ }+ },+ "type": "object",+ "required": ["id", "title", "kind", "next_run_time"],+ "title": "HomeUpcomingTask"+ },+ "HomeWeekSummary": {+ "properties": {+ "run_count": { "type": "integer", "title": "Run Count" },+ "completed_count": { "type": "integer", "title": "Completed Count" },+ "review_count": { "type": "integer", "title": "Review Count" },+ "failed_count": { "type": "integer", "title": "Failed Count" },+ "total_runtime_seconds": {+ "type": "number",+ "title": "Total Runtime Seconds"+ },+ "timed_run_count": { "type": "integer", "title": "Timed Run Count" },+ "total_cost_cents": {+ "type": "integer",+ "title": "Total Cost Cents"+ },+ "credits_balance": {+ "anyOf": [{ "type": "integer" }, { "type": "null" }],+ "title": "Credits Balance"+ },+ "daily": {+ "items": { "$ref": "#/components/schemas/HomeDailyActivity" },+ "type": "array",+ "title": "Daily"+ }+ },+ "type": "object",+ "required": [+ "run_count",+ "completed_count",+ "review_count",+ "failed_count",+ "total_runtime_seconds",+ "timed_run_count",+ "total_cost_cents",+ "credits_balance",+ "daily"+ ],+ "title": "HomeWeekSummary"+ },"HostScopedCredentials": {"properties": {"id": { "type": "string", "title": "Id" },