Skip to content

fix(backend): Reduce GET /api/graphs expense + latency - #11986

Merged
Pwuts merged 16 commits into
devfrom
pwuts/secrt-1896-fix-crazy-get-graphs-latency
Feb 6, 2026
Merged

fix(backend): Reduce GET /api/graphs expense + latency#11986
Pwuts merged 16 commits into
devfrom
pwuts/secrt-1896-fix-crazy-get-graphs-latency

Conversation

@Pwuts

@Pwuts Pwuts commented Feb 5, 2026

Copy link
Copy Markdown
Member

SECRT-1896: Fix crazy GET /api/graphs latency (P95 = 107s)

These changes should decrease latency of this endpoint by 60-65% a lot.

Changes 🏗️

  • Make Graph.credentials_input_schema cheaper by avoiding constructing a new BlockSchema subclass
  • Strip down GraphMeta - drop all computed fields
    • Replace with either GraphModel or GraphModelWithoutNodes wherever those computed fields are used
    • Simplify usage in list_graphs_paginated and fetch_graph_from_store_slug
  • Refactor and clarify relationships between the different graph models
    • Split BaseGraph into GraphBaseMeta + BaseGraph
    • Strip down Graph - move credentials_input_schema and aggregate_credentials_inputs to GraphModel
      • Refactor to eliminate double aggregate_credentials_inputs() call in credentials_input_schema call tree
    • Add GraphModelWithoutNodes (similar to current GraphMeta)

Checklist 📋

For code changes:

  • I have clearly listed my changes in the PR description
  • I have made a test plan
  • I have tested my changes according to the test plan:
    • GET /api/graphs works as it should
    • Running a graph succeeds
    • Adding a sub-agent in the Builder works as it should

@Pwuts
Pwuts requested a review from a team as a code owner February 5, 2026 21:53
@Pwuts
Pwuts requested review from Otto-AGPT and majdyz and removed request for a team February 5, 2026 21:53
@github-project-automation github-project-automation Bot moved this to 🆕 Needs initial review in AutoGPT development kanban Feb 5, 2026
@github-actions github-actions Bot added platform/backend AutoGPT Platform - Back end size/l labels Feb 5, 2026
@coderabbitai

coderabbitai Bot commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Refactors graph models into lightweight metadata (GraphMeta/GraphBaseMeta) and full models (GraphModel/GraphModelWithoutNodes); moves credentials/schema construction to on-demand dict building and per-field is_required; updates call sites, DB store APIs, and frontend types; paginated listings return lightweight metadata to reduce per-item computation.

Changes

Cohort / File(s) Summary
Graph data models & serialization
autogpt_platform/backend/backend/data/graph.py
Introduce GraphBaseMeta/BaseGraph, GraphMeta, GraphModel, GraphModelWithoutNodes, GraphsPaginated; split metadata vs full graph; add from_db/hide_nodes flows; control serialization (omit nodes/links/sub_graphs when requested).
Credentials aggregation & schema
autogpt_platform/backend/backend/data/graph.py, autogpt_platform/backend/snapshots/*
Build credentials_input_schema as a plain dict instead of BlockSchema; aggregate credentials now include per-field is_required; snapshots updated (removed title and some schema/sub_graph fields).
Credentials validation callsite
autogpt_platform/backend/backend/data/block.py
BlockSchema init now calls CredentialsMetaInput.validate_credentials_field_schema(cls.get_field_schema(field_name), field_name) (passes explicit field schema and name).
Credentials validation impl
autogpt_platform/backend/backend/data/model.py
CredentialsMetaInput.validate_credentials_field_schema changed to a staticmethod accepting (field_schema: dict, field_name: str) and validates via CredentialsFieldInfo derived from the schema.
Store API, routes & image gen
autogpt_platform/backend/backend/api/features/store/db.py, .../routes.py, .../image_gen.py, .../library/db.py
get_available_graph gains hide_nodes overloads and conditional returns (GraphModel vs GraphModelWithoutNodes); many type hints updated to GraphBaseMeta/GraphModel variants; use AGENT_GRAPH_INCLUDE for DB include.
Callers & unpacking adjustments
autogpt_platform/backend/backend/api/features/chat/tools/utils.py, autogpt_platform/backend/backend/executor/utils.py
Call sites updated to unpack aggregated credential entries as 3-tuples (field_info, compatible_node_fields, is_required); extra element ignored where unused.
Frontend types & consumers
autogpt_platform/frontend/src/... (multiple files)
Frontend types and props switched between GraphMeta / GraphMetaLike and GraphModel / Graph / GraphLike where full schemas are required; hooks/components updated to fetch or consume full graph shapes.
Builder / UI lazy fetch
autogpt_platform/frontend/src/app/(platform)/build/components/...
Agent block/node creation now fetches full graph on-demand to populate input/output schemas before adding AGENT nodes; falls back to schema-less add if fetch fails.
OpenAPI / generated schemas
autogpt_platform/frontend/src/app/api/openapi.json
Add GraphModelWithoutNodes schema; update GraphMeta, GraphModel, and base graph schemas; add credentials_input_schema, created_at, and adjust required fields and descriptions.

Sequence Diagram(s)

sequenceDiagram
  participant Client as Client
  participant API as API Server
  participant DB as Database
  participant GM as GraphModel
  participant GMeta as GraphMeta

  Note over API,GM: OLD flow (expensive per-graph computation)
  Client->>API: GET /api/graphs?page=N
  API->>DB: fetch graphs page
  DB-->>API: list of graph rows
  loop per graph (old)
    API->>GM: GM.from_db(row)              rgba(66,133,244,0.5)
    GM-->>API: GraphModel instance
    API->>GM: .meta()                     rgba(219,68,55,0.5)
    GM->>GM: compute credentials_input_schema (expensive)
    GM-->>API: meta dict
  end
  API-->>Client: paginated response

  Note over API,GMeta: NEW flow (lighter metadata)
  Client->>API: GET /api/graphs?page=N
  API->>DB: fetch graphs page
  DB-->>API: list of graph rows
  loop per graph (new)
    API->>GM: GM.from_db(row)              rgba(15,157,88,0.5)
    GM-->>API: GraphModel instance
    API->>GMeta: GMeta.from_db(GM)        rgba(15,157,88,0.5)
    GMeta-->>API: lightweight meta (deferred credentials)
  end
  API-->>Client: paginated response
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

Review effort 5/5

Suggested reviewers

  • majdyz
  • Swiftyos
  • ntindle

Poem

🐰 I hopped through nodes and trimmed their weight,
hid bulky lists so listings skate.
Schemas wait till someone asks,
now queries run like nimble masks.
A carrot-quick graph — that's my plate.

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: reducing latency of the GET /api/graphs endpoint by optimizing expensive operations.
Description check ✅ Passed The description clearly relates to the changeset and explains the objectives, changes made, and testing performed for the latency reduction.
Linked Issues check ✅ Passed The PR successfully addresses SECRT-1896's requirement to reduce GET /api/graphs latency by eliminating redundant credentials_input_schema computations through GraphModel/GraphMeta refactoring and avoiding BlockSchema construction.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the latency reduction objective: graph model refactoring, schema optimization, type updates in consuming code, and supporting changes maintain focus on the single goal.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pwuts/secrt-1896-fix-crazy-get-graphs-latency

🧹 Recent nitpick comments
autogpt_platform/backend/backend/data/graph.py (2)

889-920: from_db correctly uses cls for top-level but hardcodes GraphModel for sub-graphs.

Line 917 uses GraphModel.from_db(sub_graph, for_export) instead of cls.from_db(...). This means subclasses (like GraphModelWithoutNodes) won't propagate their type to sub-graphs. Since sub-graphs are typed as list[BaseGraph] and don't need the subclass behavior, this is reasonable — but worth documenting with a brief comment if intentional.


559-566: node_required_map is populated for all nodes but only consumed for nodes with credential fields.

This is fine — the overhead of tracking non-credential nodes is negligible — but the variable name could be slightly misleading since it maps all nodes, not just credential-bearing ones. Very minor nit.

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 991d9f1 and 501b4ce.

📒 Files selected for processing (1)
  • autogpt_platform/backend/backend/data/graph.py
🧰 Additional context used
📓 Path-based instructions (6)
autogpt_platform/backend/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/backend/**/*.py: Use Python 3.11 (required; managed by Poetry via pyproject.toml) for backend development
Always run 'poetry run format' (Black + isort) before linting in backend development
Always run 'poetry run lint' (ruff) after formatting in backend development

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/backend/backend/data/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

All data access in backend requires user ID checks; verify this for any 'data/*.py' changes

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/backend/**/*.{py,txt}

📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Use poetry run prefix for all Python commands, including testing, linting, formatting, and migrations

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/backend/backend/**/*.py

📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Use Prisma ORM for database operations in PostgreSQL with pgvector for embeddings

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Format Python code with poetry run format

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/**/data/*.py

📄 CodeRabbit inference engine (AGENTS.md)

For changes touching data/*.py, validate user ID checks or explain why not needed

Files:

  • autogpt_platform/backend/backend/data/graph.py
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.494Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`
📚 Learning: 2026-02-04T16:50:20.494Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.494Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
📚 Learning: 2026-01-19T07:20:23.494Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11795
File: autogpt_platform/backend/backend/api/features/chat/tools/utils.py:92-111
Timestamp: 2026-01-19T07:20:23.494Z
Learning: In autogpt_platform/backend/backend/api/features/chat/tools/utils.py, the _serialize_missing_credential function uses next(iter(field_info.provider)) for provider selection. The PR author confirmed this non-deterministic provider selection is acceptable because the function returns both "type" (single, for backward compatibility) and "types" (full array), which achieves the primary goal of deterministic credential type presentation.

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
📚 Learning: 2026-02-04T16:49:42.476Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.476Z
Learning: Applies to autogpt_platform/backend/backend/blocks/**/*.py : Inherit from 'Block' base class with input/output schemas when adding new blocks in backend

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
📚 Learning: 2026-02-04T16:50:20.494Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.494Z
Learning: Applies to autogpt_platform/backend/backend/blocks/*.py : When creating new blocks, inherit from the `Block` base class and define input/output schemas using `BlockSchema`

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
🧬 Code graph analysis (1)
autogpt_platform/backend/backend/data/graph.py (1)
autogpt_platform/backend/backend/data/model.py (4)
  • CredentialsMetaInput (496-554)
  • validate_credentials_field_schema (511-535)
  • CredentialsFieldInfo (566-687)
  • combine (576-666)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: e2e_test
  • GitHub Check: types
  • GitHub Check: Seer Code Review
  • GitHub Check: test (3.11)
  • GitHub Check: test (3.13)
  • GitHub Check: test (3.12)
  • GitHub Check: Check PR Status
🔇 Additional comments (9)
autogpt_platform/backend/backend/data/graph.py (9)

224-249: LGTM on the GraphBaseMeta / BaseGraph split.

Clean separation of concerns: GraphBaseMeta holds core metadata fields shared by GraphMeta (lightweight listings) and BaseGraph (full structure with computed fields). The docstrings accurately reflect the hierarchy.


384-412: Well-designed lightweight metadata model for listings.

GraphMeta.from_db avoids constructing nodes, links, and all computed fields — this is the core optimization that achieves the ~400x speedup on GET /api/graphs.


545-605: Clean extension with is_required flag.

The aggregation logic correctly determines a credential field as required when any contributing node has credentials_optional=False. The conservative default of True in node_required_map.get(node_id, True) is safe.


922-943: Elegant approach using exclude=True to hide structure while preserving computed fields.

GraphModelWithoutNodes keeps nodes/links in memory for computed fields like credentials_input_schema and input_schema to work correctly, while excluding them from serialization. Smart pattern.


981-1018: Key optimization: lightweight query without node/link joins for listings.

The paginated listing query correctly omits AGENT_GRAPH_INCLUDE, avoiding expensive joins. Combined with GraphMeta.from_db (no computed fields), this eliminates the dominant cost identified in SECRT-1896.

User ID check is present at Line 999. As per coding guidelines, data access requires user ID checks for data/*.py changes.


447-449: Moving credentials_input_schema from BaseGraph to GraphModel prevents it from being computed on sub-graphs and lightweight models.

This ensures the expensive schema construction only runs when explicitly needed on a full GraphModel, not on every BaseGraph instance. Good scoping.


1010-1018: The listing query intentionally excludes nodes/links for performance.

The find_many call on line 1010 correctly omits include=AGENT_GRAPH_INCLUDE, which would load the Nodes relationship. Since GraphMeta.from_db() only requires scalar columns, loading the full node graph would be unnecessary overhead. The user ID filter is properly enforced in the where clause.


393-394: Remove the # type: ignore comments or add a clarifying comment explaining the intentional re-declaration.

GraphMeta intentionally re-declares id and version without defaults, making them required fields (overriding the parent's optional defaults from BaseDbModel and GraphBaseMeta). This works correctly in Pydantic v2—the from_db() method successfully creates instances by explicitly providing these values. However, the # type: ignore suppresses a legitimate type checker warning about the field re-declaration without explaining the intent. Either remove the suppression (as the behavior is intentional) or add a comment clarifying why these fields must be required in GraphMeta (e.g., "Required in database records to ensure valid graph metadata").


415-445: No issues found with the diamond inheritance pattern in GraphModel. The class successfully inherits from both Graph and GraphMeta through their common base GraphBaseMeta. Pydantic v2 handles this correctly, with proper field resolution (including the intentional type narrowing of nodes to list[NodeModel] and the redefinition of id and version in GraphMeta). The code is actively used in tests and production without validation errors or field ordering issues.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread autogpt_platform/backend/backend/data/graph.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
autogpt_platform/backend/backend/data/graph.py (1)

432-492: ⚠️ Potential issue | 🔴 Critical

Three callers of aggregate_credentials_inputs() unpack a 2-tuple but the method now returns a 3-tuple.

The method now returns dict[str, tuple[field_info, node_pairs, is_required]], but the following callers still unpack only 2 values and will fail with ValueError: too many values to unpack:

  • autogpt_platform/backend/backend/api/features/chat/tools/utils.py:131 — dictionary comprehension unpacking (field_info, _node_fields)
  • autogpt_platform/backend/backend/api/features/chat/tools/utils.py:270-273 — for loop unpacking (credential_requirements, _node_fields)
  • autogpt_platform/backend/backend/executor/utils.py:376 — for loop unpacking (_, compatible_node_fields)

Update all three to unpack the new third element (is_required) or use indexing if the value is not needed.

🧹 Nitpick comments (1)
autogpt_platform/backend/backend/data/graph.py (1)

839-887: Prefer default_factory for mutable schema defaults.

Using {} as a default for schema fields risks shared mutable state. Field(default_factory=dict) is safer and aligns with Pydantic guidance.

♻️ Proposed refactor
-    input_schema: dict[str, Any] = {}
-    output_schema: dict[str, Any] = {}
-    credentials_input_schema: dict[str, Any] = {}
+    input_schema: dict[str, Any] = Field(default_factory=dict)
+    output_schema: dict[str, Any] = Field(default_factory=dict)
+    credentials_input_schema: dict[str, Any] = Field(default_factory=dict)
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bfa942e and bb0bc45.

📒 Files selected for processing (1)
  • autogpt_platform/backend/backend/data/graph.py
🧰 Additional context used
📓 Path-based instructions (6)
autogpt_platform/backend/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/backend/**/*.py: Use Python 3.11 (required; managed by Poetry via pyproject.toml) for backend development
Always run 'poetry run format' (Black + isort) before linting in backend development
Always run 'poetry run lint' (ruff) after formatting in backend development

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/backend/backend/data/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

All data access in backend requires user ID checks; verify this for any 'data/*.py' changes

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/backend/**/*.{py,txt}

📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Use poetry run prefix for all Python commands, including testing, linting, formatting, and migrations

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/backend/backend/**/*.py

📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Use Prisma ORM for database operations in PostgreSQL with pgvector for embeddings

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Format Python code with poetry run format

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/**/data/*.py

📄 CodeRabbit inference engine (AGENTS.md)

For changes touching data/*.py, validate user ID checks or explain why not needed

Files:

  • autogpt_platform/backend/backend/data/graph.py
🧠 Learnings (1)
📚 Learning: 2026-02-04T16:50:20.494Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.494Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: types
  • GitHub Check: Seer Code Review
  • GitHub Check: test (3.11)
  • GitHub Check: test (3.13)
  • GitHub Check: Check PR Status
  • GitHub Check: test (3.12)
🔇 Additional comments (2)
autogpt_platform/backend/backend/data/graph.py (2)

965-968: Nice clarification about meta() validation side effects.

The added note makes it clear why exceptions can be raised here and why the try/except is warranted.


368-430: Optional credentials fields still appear as required in the JSON schema.

When is_required=False, fields use (CMI | None, CredentialsField(...)), but CredentialsField() returns Field(...) without setting default=None. In Pydantic v2, a field without an explicit default value is required in the schema regardless of its type annotation. This means optional credentials fields will still appear in the schema's required list, defeating the is_required=False logic.

Fix: Pass default=None to the Field returned by CredentialsField() for optional credentials, or add conditional logic to set the default when the field should be optional.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread autogpt_platform/backend/backend/data/graph.py
@github-actions github-actions Bot added the platform/frontend AutoGPT Platform - Front end label Feb 6, 2026
Comment thread autogpt_platform/backend/backend/data/graph.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
autogpt_platform/backend/backend/data/graph.py (1)

993-1002: ⚠️ Potential issue | 🟡 Minor

Per-graph error handling in list_graphs_paginated is a good improvement.

Catching exceptions per-graph and continuing prevents a single malformed graph from breaking the entire paginated response.

One thing to consider: total_count (from prisma().count()) may not match len(graph_models) if some graphs fail processing. The pagination metadata will claim more items exist than are actually returned. This could confuse clients paginating through results (e.g., requesting page 2 when the effective count is lower). This is a minor UX concern and probably acceptable given the alternative (500 errors), but worth documenting or logging the discrepancy.

🧹 Nitpick comments (2)
autogpt_platform/backend/backend/data/graph.py (2)

393-460: Credentials input schema: hand-built JSON schema is correct and well-validated.

The direct JSON schema construction avoids the create_model overhead nicely. The validate_credentials_field_schema call at line 448 is a good safeguard to catch malformed schemas at build time.

One minor defensive concern: if field_info.provider or field_info.supported_types is an empty frozenset, providers[0] / cred_types[0] on lines 422/431 would raise an IndexError. In practice these should never be empty, but if you want to be defensive:

🛡️ Optional defensive guard
             providers = list(field_info.provider)
             cred_types = list(field_info.supported_types)
 
+            if not providers or not cred_types:
+                logger.error(
+                    f"Empty provider or cred_types for field {agg_field_key} "
+                    f"on graph #{self.id}"
+                )
+                continue
+
             field_schema: dict[str, Any] = {

438-445: Nit: ** unpacking in dict.update() is redundant.

field_schema.update(**some_dict) is equivalent to field_schema.update(some_dict) here. The latter is more idiomatic and avoids the unnecessary unpacking step.

✏️ Suggested simplification
-            field_schema.update(
-                **field_info.model_dump(
-                    by_alias=True,
-                    exclude_defaults=True,
-                    exclude={"provider", "supported_types"},  # already included above
-                )
+            field_schema.update(
+                field_info.model_dump(
+                    by_alias=True,
+                    exclude_defaults=True,
+                    exclude={"provider", "supported_types"},  # already included above
+                )
             )
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 43f736b and df66178.

📒 Files selected for processing (2)
  • autogpt_platform/backend/backend/data/graph.py
  • autogpt_platform/frontend/src/app/api/openapi.json
🧰 Additional context used
📓 Path-based instructions (6)
autogpt_platform/backend/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/backend/**/*.py: Use Python 3.11 (required; managed by Poetry via pyproject.toml) for backend development
Always run 'poetry run format' (Black + isort) before linting in backend development
Always run 'poetry run lint' (ruff) after formatting in backend development

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/backend/backend/data/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

All data access in backend requires user ID checks; verify this for any 'data/*.py' changes

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/backend/**/*.{py,txt}

📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Use poetry run prefix for all Python commands, including testing, linting, formatting, and migrations

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/backend/backend/**/*.py

📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Use Prisma ORM for database operations in PostgreSQL with pgvector for embeddings

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Format Python code with poetry run format

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/**/data/*.py

📄 CodeRabbit inference engine (AGENTS.md)

For changes touching data/*.py, validate user ID checks or explain why not needed

Files:

  • autogpt_platform/backend/backend/data/graph.py
🧠 Learnings (5)
📚 Learning: 2026-02-04T16:50:20.494Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.494Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
  • autogpt_platform/frontend/src/app/api/openapi.json
📚 Learning: 2026-01-19T07:20:23.494Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11795
File: autogpt_platform/backend/backend/api/features/chat/tools/utils.py:92-111
Timestamp: 2026-01-19T07:20:23.494Z
Learning: In autogpt_platform/backend/backend/api/features/chat/tools/utils.py, the _serialize_missing_credential function uses next(iter(field_info.provider)) for provider selection. The PR author confirmed this non-deterministic provider selection is acceptable because the function returns both "type" (single, for backward compatibility) and "types" (full array), which achieves the primary goal of deterministic credential type presentation.

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
📚 Learning: 2026-02-04T16:49:42.476Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.476Z
Learning: Applies to autogpt_platform/backend/backend/blocks/**/*.py : Inherit from 'Block' base class with input/output schemas when adding new blocks in backend

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
📚 Learning: 2026-02-04T16:50:20.494Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.494Z
Learning: Applies to autogpt_platform/backend/backend/blocks/*.py : When creating new blocks, inherit from the `Block` base class and define input/output schemas using `BlockSchema`

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
📚 Learning: 2026-02-04T16:49:56.176Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:49:56.176Z
Learning: Applies to autogpt_platform/**/*agent*graph*.json : Agent Graphs are workflow definitions stored as JSON and executed by the backend

Applied to files:

  • autogpt_platform/frontend/src/app/api/openapi.json
🧬 Code graph analysis (1)
autogpt_platform/backend/backend/data/graph.py (1)
autogpt_platform/backend/backend/data/model.py (4)
  • CredentialsMetaInput (496-554)
  • validate_credentials_field_schema (511-535)
  • CredentialsFieldInfo (566-687)
  • combine (576-666)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: types
  • GitHub Check: e2e_test
  • GitHub Check: test (3.11)
  • GitHub Check: test (3.12)
  • GitHub Check: test (3.13)
  • GitHub Check: Check PR Status
🔇 Additional comments (3)
autogpt_platform/backend/backend/data/graph.py (2)

869-917: GraphMeta refactoring to a lightweight BaseModel looks solid.

The separation from Graph into a flat BaseModel is a clean approach to avoid recomputing expensive computed fields on serialization. All relevant fields from GraphModel are properly mapped in from_graph().

Note: this is a breaking API change (removes nodes, links, sub_graphs from the GraphMeta response shape). The AI summary confirms the OpenAPI spec was updated accordingly.


462-522: is_required aggregation logic is correct.

The approach of defaulting node_required_map.get(node_id, True) (line 517) is a safe conservative choice — if a node ID is somehow missing from the map, it defaults to "required". In practice every node is iterated at lines 480–483 so the default shouldn't be hit.

autogpt_platform/frontend/src/app/api/openapi.json (1)

7809-7858: LGTM — GraphMeta schema updates align with the backend refactor.

The new required fields and credentials_input_schema addition look consistent for list endpoints.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@autogpt_platform/backend/backend/data/graph.py`:
- Around line 402-432: The code currently assumes field_info.provider and
field_info.supported_types are non-empty and directly uses providers[0] and
cred_types[0]; add a defensive guard before building field_schema: check if
providers or cred_types are empty and either (a) raise a clear ValueError
referencing field_info (e.g., "CredentialsFieldInfo must provide at least one
provider and one supported type") or (b) avoid indexing by only using {"enum":
providers} / {"enum": cred_types} when lists are present and omit the {"const":
...} branch when empty; update the construction around providers/cred_types in
the field_schema block to use these guarded branches so no IndexError can occur.
🧹 Nitpick comments (1)
autogpt_platform/backend/backend/data/graph.py (1)

438-445: dict.update() could silently overwrite schema keys if CredentialsFieldInfo gains new fields.

The field_schema.update(field_info.model_dump(...)) call merges arbitrary keys into the hand-built JSON schema. If CredentialsFieldInfo ever gains a field that serializes to "type", "properties", or "required", the schema would be silently corrupted. Consider either using a namespaced key or explicitly picking the fields you want to merge.

♻️ Safer alternative: explicitly merge known extra keys
-            # Add other (optional) field info items
-            field_schema.update(
-                field_info.model_dump(
-                    by_alias=True,
-                    exclude_defaults=True,
-                    exclude={"provider", "supported_types"},  # already included above
-                )
-            )
+            # Add other (optional) field info items, avoiding collision with schema keys
+            _SCHEMA_RESERVED = {"type", "properties", "required"}
+            for k, v in field_info.model_dump(
+                by_alias=True,
+                exclude_defaults=True,
+                exclude={"provider", "supported_types"},
+            ).items():
+                if k in _SCHEMA_RESERVED:
+                    logger.warning(
+                        f"Skipping reserved key '{k}' from CredentialsFieldInfo "
+                        f"for field '{agg_field_key}'"
+                    )
+                    continue
+                field_schema[k] = v
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5f9b03e and fe754da.

📒 Files selected for processing (2)
  • autogpt_platform/backend/backend/data/graph.py
  • autogpt_platform/frontend/src/app/api/openapi.json
🧰 Additional context used
📓 Path-based instructions (6)
autogpt_platform/backend/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/backend/**/*.py: Use Python 3.11 (required; managed by Poetry via pyproject.toml) for backend development
Always run 'poetry run format' (Black + isort) before linting in backend development
Always run 'poetry run lint' (ruff) after formatting in backend development

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/backend/backend/data/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

All data access in backend requires user ID checks; verify this for any 'data/*.py' changes

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/backend/**/*.{py,txt}

📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Use poetry run prefix for all Python commands, including testing, linting, formatting, and migrations

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/backend/backend/**/*.py

📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Use Prisma ORM for database operations in PostgreSQL with pgvector for embeddings

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Format Python code with poetry run format

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/**/data/*.py

📄 CodeRabbit inference engine (AGENTS.md)

For changes touching data/*.py, validate user ID checks or explain why not needed

Files:

  • autogpt_platform/backend/backend/data/graph.py
🧠 Learnings (5)
📚 Learning: 2026-02-04T16:50:20.494Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.494Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
  • autogpt_platform/frontend/src/app/api/openapi.json
📚 Learning: 2026-01-19T07:20:23.494Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11795
File: autogpt_platform/backend/backend/api/features/chat/tools/utils.py:92-111
Timestamp: 2026-01-19T07:20:23.494Z
Learning: In autogpt_platform/backend/backend/api/features/chat/tools/utils.py, the _serialize_missing_credential function uses next(iter(field_info.provider)) for provider selection. The PR author confirmed this non-deterministic provider selection is acceptable because the function returns both "type" (single, for backward compatibility) and "types" (full array), which achieves the primary goal of deterministic credential type presentation.

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
📚 Learning: 2026-02-04T16:49:42.476Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.476Z
Learning: Applies to autogpt_platform/backend/backend/blocks/**/*.py : Inherit from 'Block' base class with input/output schemas when adding new blocks in backend

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
📚 Learning: 2026-02-04T16:50:20.494Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.494Z
Learning: Applies to autogpt_platform/backend/backend/blocks/*.py : When creating new blocks, inherit from the `Block` base class and define input/output schemas using `BlockSchema`

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
📚 Learning: 2026-02-04T16:49:56.176Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:49:56.176Z
Learning: Applies to autogpt_platform/**/*agent*graph*.json : Agent Graphs are workflow definitions stored as JSON and executed by the backend

Applied to files:

  • autogpt_platform/frontend/src/app/api/openapi.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: chromatic
  • GitHub Check: e2e_test
  • GitHub Check: types
  • GitHub Check: Seer Code Review
  • GitHub Check: test (3.13)
  • GitHub Check: test (3.11)
  • GitHub Check: test (3.12)
  • GitHub Check: Check PR Status
🔇 Additional comments (5)
autogpt_platform/frontend/src/app/api/openapi.json (1)

7807-7858: Schema update looks good.

GraphMeta now includes credentials_input_schema and requires id, which matches the lightweight metadata intent for list endpoints.

autogpt_platform/backend/backend/data/graph.py (4)

376-377: LGTM!

Tuple unpacking correctly adapted to the new 3-tuple structure, and is_required is appropriately ignored in the same-provider warning logic.


462-522: LGTM!

The is_required flag logic is sound: it correctly derives per-node requirement from credentials_optional, and the any() aggregation ensures that if any contributing node requires the credential, the aggregated field is marked required. The defensive default=True in node_required_map.get() is a reasonable fallback.


993-1002: LGTM!

The updated flow correctly materializes GraphMeta once per graph item. The try/except error handling is preserved, and the user ID filter is properly applied in the query (Line 973). This achieves the PR's goal of eliminating redundant schema computation during serialization.


869-917: The GraphMeta design is sound and field exclusions are intentional.

The removal of sub_graphs and created_at is appropriate for a lightweight metadata model used by list endpoints. Verification confirms:

  • No frontend code references these fields from graph meta/list responses
  • sub_graphs is only used internally where full GraphModel is fetched separately
  • created_at is not exposed in any API endpoint returning GraphMeta
  • The store endpoint explicitly declares GraphMeta as its return type, indicating intentional lightweight response design

No action needed.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread autogpt_platform/backend/backend/data/graph.py
@Pwuts
Pwuts enabled auto-merge February 6, 2026 01:22
@Pwuts

Pwuts commented Feb 6, 2026

Copy link
Copy Markdown
Member Author

Before:

Page Size    Mean     Median    Std Dev    Min      Max
----------------------------------------------------------
25           0.434s   0.415s    0.060s     0.404s   0.603s
50           0.886s   0.848s    0.093s     0.807s   1.027s
100          1.726s   1.707s    0.145s     1.565s   1.982s
250          4.400s   4.364s    0.190s     4.170s   4.854s

After:

Page Size    Mean     Median    Std Dev    Min      Max
----------------------------------------------------------
25           0.164s   0.163s    0.007s     0.154s   0.174s
50           0.345s   0.305s    0.082s     0.294s   0.509s
100          0.664s   0.617s    0.086s     0.595s   0.793s
250          1.730s   1.781s    0.114s     1.542s   1.835s

Looks like 60-63% less latency so far, 2.5 times faster

Update:

Page Size    Mean     Median    StdDev    Min      Max     
---------------------------------------------------------
25           0.007s   0.007s    0.001s    0.006s   0.008s
50           0.008s   0.007s    0.000s    0.007s   0.008s
100          0.009s   0.009s    0.000s    0.008s   0.009s
250          0.011s   0.011s    0.000s    0.010s   0.012s

400x faster 😎

@Otto-AGPT
Otto-AGPT requested review from ntindle and removed request for Otto-AGPT February 6, 2026 17:20
Comment thread autogpt_platform/backend/backend/api/features/store/db.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
autogpt_platform/backend/backend/api/features/store/routes.py (1)

279-286: ⚠️ Potential issue | 🔴 Critical

Update frontend client types: endpoint now returns GraphModelWithoutNodes, not GraphMeta.

The backend endpoint returns GraphModelWithoutNodes (which includes computed fields like credentials_input_schema, input_schema, output_schema inherited from GraphModel, but excludes nodes, links, sub_graphs). However, the frontend client at autogpt_platform/frontend/src/lib/autogpt-server-api/client.ts:458 still explicitly types the response as Promise<GraphMeta>, and the frontend type definition for GraphMeta only includes basic metadata fields, not the computed fields now being returned.

This creates a type mismatch:

  • Backend: GraphModelWithoutNodes (has computed fields)
  • Frontend expectation: GraphMeta (lacks computed fields)

The frontend client type must be updated to match the actual response shape. Additionally, no tests were added for this endpoint change in routes_test.py.

autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx (1)

329-341: ⚠️ Potential issue | 🟠 Major

Dragging agent blocks into the canvas will result in empty input/output schemas; add on-demand schema fetching to the drop handler.

The onDragStart handler (Lines 329–339) serializes hardcodedValues without schemas, and the drop handler in Flow.tsx (Lines 922–970) populates the new node using only the empty schemas from availableBlocks (Lines 120–127). Unlike the click path (handleAddBlock, which fetches input_schema/output_schema on-demand via getV1GetSpecificGraph), the drag path never fetches these schemas. The drop handler must fetch and inject schemas for agent blocks, similar to how handleAddBlock does.

Additionally, handleAddBlock (Line 190) uses useCallback in violation of the guideline: do not use useCallback or useMemo unless asked to optimize a given function.

autogpt_platform/backend/backend/api/features/store/db.py (1)

366-378: ⚠️ Potential issue | 🟡 Minor

Pre-existing: HTTPException is swallowed by the broad except Exception.

The fastapi.HTTPException(status_code=404, ...) raised on line 367 is caught by the blanket except Exception on line 376 and re-wrapped as a generic DatabaseError. This strips the 404 status code, so callers (and ultimately the API consumer) will get a 500-level error instead.

Not introduced by this PR, but since the function was refactored this is a good opportunity to fix it.

Proposed fix
+    except fastapi.HTTPException:
+        raise
     except Exception as e:
         logger.error(f"Error getting agent: {e}")
         raise DatabaseError("Failed to fetch agent") from e
🤖 Fix all issues with AI agents
In `@autogpt_platform/backend/backend/api/features/store/db.py`:
- Around line 372-374: The ternary dispatch using (GraphModelWithoutNodes if
hide_nodes else GraphModel).from_db(...) is incorrect because from_db is a
staticmethod that always constructs a GraphModel; instead call
GraphModel.from_db(store_listing_version.AgentGraph) and then conditionally call
.hide_nodes() when hide_nodes is true (i.e., assign model =
GraphModel.from_db(...); if hide_nodes: model = model.hide_nodes()); this
ensures you return a GraphModelWithoutNodes-like result when requested while
still using the existing from_db implementation.

In `@autogpt_platform/backend/backend/api/features/store/image_gen.py`:
- Around line 105-111: Docstring for function generate_agent_image_v1
incorrectly references `_GraphBaseMeta`; update the type annotation text to
`GraphBaseMeta` so the docstring matches the actual type name (GraphBaseMeta |
AgentGraph) used in the function signature and comments.
🧹 Nitpick comments (5)
autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx (1)

189-218: useCallback usage on new handler.

Coding guidelines state: "Do not use useCallback or useMemo unless asked to optimize a given function." Since handleAddBlock is only passed to inline onClick, useCallback isn't necessary here.

Proposed change: plain async function
-  // Handler to add a block, fetching graph data on-demand for agent blocks
-  const handleAddBlock = useCallback(
-    async (block: _Block & { notAvailable: string | null }) => {
+  // Handler to add a block, fetching graph data on-demand for agent blocks
+  async function handleAddBlock(block: _Block & { notAvailable: string | null }) {
       if (block.notAvailable) return;
 
       // For agent blocks, fetch the full graph to get schemas
       if (block.uiType === BlockUIType.AGENT && block.hardcodedValues) {
         const graphID = block.hardcodedValues.graph_id as string;
         const graphVersion = block.hardcodedValues.graph_version as number;
         const graphData = okData(
           await getV1GetSpecificGraph(graphID, { version: graphVersion }),
         );
 
         if (graphData) {
           addBlock(block.id, block.name, {
             ...block.hardcodedValues,
             input_schema: graphData.input_schema,
             output_schema: graphData.output_schema,
           });
         } else {
           // Fallback: add without schemas (will be incomplete)
           console.error("Failed to fetch graph data for agent block");
           addBlock(block.id, block.name, block.hardcodedValues || {});
         }
       } else {
         addBlock(block.id, block.name, block.hardcodedValues || {});
       }
-    },
-    [addBlock],
-  );
+  }

As per coding guidelines: "Do not use useCallback or useMemo unless asked to optimize a given function."

autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts (2)

20-28: Explicit return type on hook.

The coding guidelines for this path state "Do not type hook returns, let TypeScript infer as much as possible." The explicit : SubAgentUpdateInfo<GraphModel> can be removed — the return object on Lines 170–177 already satisfies the generic, so TypeScript will infer it correctly.

Proposed change
 export function useSubAgentUpdate(
   nodeID: string,
   graphID: string | undefined,
   graphVersion: number | undefined,
   currentInputSchema: GraphInputSchema | undefined,
   currentOutputSchema: GraphOutputSchema | undefined,
   connections: EdgeLike[],
   availableGraphs: GraphMetaLike[],
-): SubAgentUpdateInfo<GraphModel> {
+) {

As per coding guidelines: "Do not type hook returns, let TypeScript infer as much as possible."


36-39: Non-null assertion on version may hide type issues.

latestGraphInfo.version! uses a non-null assertion. If GeneratedGraphMeta makes version optional (common for fields with backend defaults), this suppresses the type checker. While safe at runtime (undefined > numberfalse), an explicit guard would be more robust.

Suggested fix
   const hasUpdate = useMemo(() => {
-    if (!latestGraphInfo || graphVersion === undefined) return false;
-    return latestGraphInfo.version! > graphVersion;
-  }, [latestGraphInfo, graphVersion]);
+    if (!latestGraphInfo?.version || graphVersion === undefined) return false;
+    return latestGraphInfo.version > graphVersion;
+  }, [latestGraphInfo, graphVersion]);
autogpt_platform/backend/backend/data/graph.py (2)

415-445: Diamond inheritance works but warrants a brief note for future maintainers.

GraphModel(Graph, GraphMeta) forms a diamond via GraphBaseMeta. Python's C3 linearization handles this correctly, and Pydantic will resolve field overrides (e.g., GraphMeta.id: str over BaseDbModel.id: Optional[str]) in the expected order. The design is sound for the performance goal.

One thing to keep in mind: if either branch ever adds conflicting field definitions or validators, the MRO resolution could produce surprises. A brief inline comment noting the intentional diamond might help future readers.


459-460: Minor: destructured _ shadows the is_required flag — consider naming for clarity.

In the warning loop (Lines 459-460), the is_required flag from the 3-tuple is discarded as _. This is fine since it's unused here, but naming it _is_required would signal intentional discard more clearly in a tuple with multiple ignored positions.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between fe754da and befcaae.

📒 Files selected for processing (20)
  • autogpt_platform/backend/backend/api/features/chat/tools/utils.py
  • autogpt_platform/backend/backend/api/features/library/db.py
  • autogpt_platform/backend/backend/api/features/store/db.py
  • autogpt_platform/backend/backend/api/features/store/image_gen.py
  • autogpt_platform/backend/backend/api/features/store/routes.py
  • autogpt_platform/backend/backend/data/graph.py
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/AgentOnboardingCredentials.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/helpers.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
  • autogpt_platform/frontend/src/app/(platform)/build/stores/graphStore.ts
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
  • autogpt_platform/frontend/src/app/api/openapi.json
  • autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts
✅ Files skipped from review due to trivial changes (1)
  • autogpt_platform/frontend/src/app/(platform)/build/stores/graphStore.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • autogpt_platform/backend/backend/api/features/chat/tools/utils.py
🧰 Additional context used
📓 Path-based instructions (20)
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Use Node.js 21+ with pnpm package manager for frontend development
Always run 'pnpm format' for formatting and linting code in frontend development

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/AgentOnboardingCredentials.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/helpers.ts
  • autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts
autogpt_platform/frontend/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{tsx,ts}: Use function declarations for components and handlers (not arrow functions) in React components
Only use arrow functions for small inline lambdas (map, filter, etc.) in React components
Use PascalCase for component names and camelCase with 'use' prefix for hook names in React
Use Tailwind CSS utilities only for styling in frontend components
Use design system components from 'src/components/' (atoms, molecules, organisms) in frontend development
Never use 'src/components/legacy/' in frontend code
Only use Phosphor Icons (@phosphor-icons/react) for icons in frontend components
Use generated API hooks from '@/app/api/generated/endpoints/' instead of deprecated 'BackendAPI' or 'src/lib/autogpt-server-api/
'
Use React Query for server state (via generated hooks) in frontend development
Default to client components ('use client') in Next.js; only use server components for SEO or extreme TTFB needs
Use '' component for rendering errors in frontend UI; use toast notifications for mutation errors; use 'Sentry.captureException()' for manual exceptions
Separate render logic from data/behavior in React components; keep comments minimal (code should be self-documenting)

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/AgentOnboardingCredentials.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/helpers.ts
  • autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts
autogpt_platform/frontend/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{ts,tsx}: No barrel files or 'index.ts' re-exports in frontend code
Regenerate API hooks with 'pnpm generate:api' after backend OpenAPI spec changes in frontend development

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/AgentOnboardingCredentials.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/helpers.ts
  • autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts
autogpt_platform/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)

autogpt_platform/frontend/src/**/*.{ts,tsx}: Fully capitalize acronyms in symbols, e.g. graphID, useBackendAPI
Use function declarations (not arrow functions) for components and handlers
Separate render logic (.tsx) from business logic (use*.ts hooks)
Use shadcn/ui (Radix UI primitives) with Tailwind CSS styling for UI components
Use Phosphor Icons only for icons
Use ErrorCard for render errors, toast for mutations, and Sentry for exceptions
Use design system components from src/components/ (atoms, molecules, organisms)
Never use src/components/__legacy__/* components
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName}
Use Tailwind CSS only for styling, with design tokens
Do not use useCallback or useMemo unless asked to optimize a given function
Never type with any unless a variable/attribute can ACTUALLY be of any type

autogpt_platform/frontend/src/**/*.{ts,tsx}: Structure components as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts and use design system components from src/components/ (atoms, molecules, organisms)
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName} and regenerate with pnpm generate:api
Use function declarations (not arrow functions) for components and handlers
Separate render logic from business logic with component.tsx + useComponent.ts + helpers.ts structure
Colocate state when possible, avoid creating large components, use sub-components in local /components folder
Avoid large hooks, abstract logic into helpers.ts files when sensible
Use arrow functions only for callbacks, not for component declarations
Avoid comments at all times unless the code is very complex
Do not use useCallback or useMemo unless asked to optimize a given function

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/AgentOnboardingCredentials.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/helpers.ts
  • autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts
autogpt_platform/frontend/**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

autogpt_platform/frontend/**/*.{js,jsx,ts,tsx}: Format frontend code using pnpm format
Never use components from src/components/__legacy__/*

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/AgentOnboardingCredentials.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/helpers.ts
  • autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts
autogpt_platform/frontend/**/*.{js,jsx,ts,tsx,css}

📄 CodeRabbit inference engine (AGENTS.md)

Use Tailwind CSS only for styling, use design tokens, and use Phosphor Icons only

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/AgentOnboardingCredentials.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/helpers.ts
  • autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts
autogpt_platform/frontend/src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Do not type hook returns, let Typescript infer as much as possible

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/helpers.ts
  • autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts
autogpt_platform/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never type with any, if no types available use unknown

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/AgentOnboardingCredentials.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/helpers.ts
  • autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts
autogpt_platform/frontend/src/app/(platform)/**/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)

Put sub-components in local components/ folder within feature directories

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
autogpt_platform/frontend/src/**/*.tsx

📄 CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)

Component props should be type Props = { ... } (not exported) unless it needs to be used outside the component

Component props should be interface Props { ... } (not exported) unless the interface needs to be used outside the component

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/AgentOnboardingCredentials.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
autogpt_platform/frontend/src/app/(platform)/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

If adding protected frontend routes, update frontend/lib/supabase/middleware.ts

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
autogpt_platform/backend/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/backend/**/*.py: Use Python 3.11 (required; managed by Poetry via pyproject.toml) for backend development
Always run 'poetry run format' (Black + isort) before linting in backend development
Always run 'poetry run lint' (ruff) after formatting in backend development

Files:

  • autogpt_platform/backend/backend/api/features/library/db.py
  • autogpt_platform/backend/backend/api/features/store/image_gen.py
  • autogpt_platform/backend/backend/api/features/store/routes.py
  • autogpt_platform/backend/backend/data/graph.py
  • autogpt_platform/backend/backend/api/features/store/db.py
autogpt_platform/backend/backend/api/features/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Update routes in '/backend/backend/api/features/' and add/update Pydantic models in the same directory for API development

When modifying API routes, update corresponding Pydantic models in the same directory and write tests alongside the route file

Files:

  • autogpt_platform/backend/backend/api/features/library/db.py
  • autogpt_platform/backend/backend/api/features/store/image_gen.py
  • autogpt_platform/backend/backend/api/features/store/routes.py
  • autogpt_platform/backend/backend/api/features/store/db.py
autogpt_platform/backend/**/*.{py,txt}

📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Use poetry run prefix for all Python commands, including testing, linting, formatting, and migrations

Files:

  • autogpt_platform/backend/backend/api/features/library/db.py
  • autogpt_platform/backend/backend/api/features/store/image_gen.py
  • autogpt_platform/backend/backend/api/features/store/routes.py
  • autogpt_platform/backend/backend/data/graph.py
  • autogpt_platform/backend/backend/api/features/store/db.py
autogpt_platform/backend/backend/api/**/*.py

📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

autogpt_platform/backend/backend/api/**/*.py: Use FastAPI for building REST and WebSocket endpoints
Use JWT-based authentication with Supabase integration

Files:

  • autogpt_platform/backend/backend/api/features/library/db.py
  • autogpt_platform/backend/backend/api/features/store/image_gen.py
  • autogpt_platform/backend/backend/api/features/store/routes.py
  • autogpt_platform/backend/backend/api/features/store/db.py
autogpt_platform/backend/backend/**/*.py

📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Use Prisma ORM for database operations in PostgreSQL with pgvector for embeddings

Files:

  • autogpt_platform/backend/backend/api/features/library/db.py
  • autogpt_platform/backend/backend/api/features/store/image_gen.py
  • autogpt_platform/backend/backend/api/features/store/routes.py
  • autogpt_platform/backend/backend/data/graph.py
  • autogpt_platform/backend/backend/api/features/store/db.py
autogpt_platform/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Format Python code with poetry run format

Files:

  • autogpt_platform/backend/backend/api/features/library/db.py
  • autogpt_platform/backend/backend/api/features/store/image_gen.py
  • autogpt_platform/backend/backend/api/features/store/routes.py
  • autogpt_platform/backend/backend/data/graph.py
  • autogpt_platform/backend/backend/api/features/store/db.py
autogpt_platform/frontend/src/**/*use*.ts

📄 CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)

Do not type hook returns, let TypeScript infer as much as possible

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
autogpt_platform/backend/backend/data/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

All data access in backend requires user ID checks; verify this for any 'data/*.py' changes

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/**/data/*.py

📄 CodeRabbit inference engine (AGENTS.md)

For changes touching data/*.py, validate user ID checks or explain why not needed

Files:

  • autogpt_platform/backend/backend/data/graph.py
🧠 Learnings (30)
📚 Learning: 2026-02-04T16:49:42.476Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.476Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Use generated API hooks from '@/app/api/__generated__/endpoints/' instead of deprecated 'BackendAPI' or 'src/lib/autogpt-server-api/*'

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/AgentOnboardingCredentials.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/helpers.ts
  • autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts
📚 Learning: 2026-02-04T16:50:33.593Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:33.593Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Fully capitalize acronyms in symbols, e.g. `graphID`, `useBackendAPI`

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/AgentOnboardingCredentials.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/helpers.ts
  • autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts
📚 Learning: 2026-02-04T16:50:20.494Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.494Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/helpers.ts
  • autogpt_platform/backend/backend/api/features/library/db.py
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/AgentOnboardingCredentials.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/helpers.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/helpers.ts
  • autogpt_platform/backend/backend/data/graph.py
  • autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts
  • autogpt_platform/frontend/src/app/api/openapi.json
📚 Learning: 2026-02-04T16:50:33.593Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:33.593Z
Learning: Applies to autogpt_platform/frontend/src/**/*.tsx : Component props should be `type Props = { ... }` (not exported) unless it needs to be used outside the component

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/AgentOnboardingCredentials.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/helpers.ts
📚 Learning: 2026-02-04T16:50:51.303Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.303Z
Learning: Applies to autogpt_platform/frontend/src/**/*.tsx : Component props should be `interface Props { ... }` (not exported) unless the interface needs to be used outside the component

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/AgentOnboardingCredentials.tsx
📚 Learning: 2026-02-04T16:49:42.476Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.476Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Never use 'src/components/__legacy__/*' in frontend code

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
📚 Learning: 2026-02-04T16:49:42.476Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.476Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Use PascalCase for component names and camelCase with 'use' prefix for hook names in React

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
📚 Learning: 2026-02-04T16:49:42.476Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.476Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : No barrel files or 'index.ts' re-exports in frontend code

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
📚 Learning: 2026-02-04T16:50:33.593Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:33.593Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Never use `src/components/__legacy__/*` components

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
📚 Learning: 2026-02-04T16:50:33.593Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:33.593Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Use shadcn/ui (Radix UI primitives) with Tailwind CSS styling for UI components

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
📚 Learning: 2026-02-04T16:50:33.593Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:33.593Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Separate render logic (`.tsx`) from business logic (`use*.ts` hooks)

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
📚 Learning: 2026-02-04T16:50:51.303Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.303Z
Learning: Applies to autogpt_platform/frontend/**/*.{js,jsx,ts,tsx} : Never use components from `src/components/__legacy__/*`

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx
📚 Learning: 2026-02-04T16:49:56.176Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:49:56.176Z
Learning: Applies to autogpt_platform/**/*agent*graph*.json : Agent Graphs are workflow definitions stored as JSON and executed by the backend

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
  • autogpt_platform/backend/backend/data/graph.py
  • autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts
  • autogpt_platform/frontend/src/app/api/openapi.json
📚 Learning: 2026-02-04T16:50:33.593Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:33.593Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Use function declarations (not arrow functions) for components and handlers

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx
📚 Learning: 2026-02-04T16:50:20.494Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.494Z
Learning: Applies to autogpt_platform/backend/backend/blocks/*.py : When adding new blocks, analyze block interfaces to ensure inputs and outputs tie well together for productive graph-based editor connections

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx
📚 Learning: 2026-02-04T16:49:42.476Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.476Z
Learning: Applies to autogpt_platform/backend/backend/blocks/**/*.py : Inherit from 'Block' base class with input/output schemas when adding new blocks in backend

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx
  • autogpt_platform/backend/backend/data/graph.py
📚 Learning: 2026-02-04T16:50:20.494Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.494Z
Learning: Applies to autogpt_platform/backend/backend/blocks/*.py : When creating new blocks, inherit from the `Block` base class and define input/output schemas using `BlockSchema`

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx
  • autogpt_platform/backend/backend/data/graph.py
📚 Learning: 2026-02-04T16:50:51.303Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.303Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Use generated API hooks from `@/app/api/__generated__/endpoints/` with pattern `use{Method}{Version}{OperationName}` and regenerate with `pnpm generate:api`

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
📚 Learning: 2026-02-04T16:50:33.593Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:33.593Z
Learning: Applies to autogpt_platform/frontend/src/**/*use*.ts : Do not type hook returns, let TypeScript infer as much as possible

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
📚 Learning: 2026-02-04T16:50:51.303Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.303Z
Learning: Applies to autogpt_platform/frontend/src/**/*.ts : Do not type hook returns, let Typescript infer as much as possible

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
📚 Learning: 2026-02-04T16:50:33.593Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:33.593Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Use generated API hooks from `@/app/api/__generated__/endpoints/` with pattern `use{Method}{Version}{OperationName}`

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
📚 Learning: 2026-02-04T16:50:51.303Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.303Z
Learning: Applies to autogpt_platform/**/*.{ts,tsx} : Never type with `any`, if no types available use `unknown`

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts
📚 Learning: 2026-02-04T16:50:51.303Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.303Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Do not use `useCallback` or `useMemo` unless asked to optimize a given function

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
📚 Learning: 2026-02-04T16:49:42.476Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.476Z
Learning: Applies to autogpt_platform/frontend/**/*.{tsx,ts} : Use React Query for server state (via generated hooks) in frontend development

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
📚 Learning: 2026-02-04T16:50:33.593Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:33.593Z
Learning: Use xyflow/react for visual graph editor in Workflow Builder

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx
📚 Learning: 2026-02-04T16:49:42.476Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.476Z
Learning: Applies to autogpt_platform/backend/backend/api/features/**/*.py : Update routes in '/backend/backend/api/features/' and add/update Pydantic models in the same directory for API development

Applied to files:

  • autogpt_platform/backend/backend/api/features/store/routes.py
📚 Learning: 2026-02-04T16:50:20.494Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.494Z
Learning: Applies to autogpt_platform/backend/backend/api/features/**/*.py : When modifying API routes, update corresponding Pydantic models in the same directory and write tests alongside the route file

Applied to files:

  • autogpt_platform/backend/backend/api/features/store/routes.py
📚 Learning: 2026-02-04T16:49:42.476Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.476Z
Learning: Applies to autogpt_platform/frontend/**/*.{ts,tsx} : Regenerate API hooks with 'pnpm generate:api' after backend OpenAPI spec changes in frontend development

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
📚 Learning: 2026-02-04T16:50:51.303Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.303Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Avoid large hooks, abstract logic into `helpers.ts` files when sensible

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts
📚 Learning: 2026-01-19T07:20:23.494Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11795
File: autogpt_platform/backend/backend/api/features/chat/tools/utils.py:92-111
Timestamp: 2026-01-19T07:20:23.494Z
Learning: In autogpt_platform/backend/backend/api/features/chat/tools/utils.py, the _serialize_missing_credential function uses next(iter(field_info.provider)) for provider selection. The PR author confirmed this non-deterministic provider selection is acceptable because the function returns both "type" (single, for backward compatibility) and "types" (full array), which achieves the primary goal of deterministic credential type presentation.

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
🧬 Code graph analysis (16)
autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/helpers.ts (1)
autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts (1)
  • GraphLike (18-18)
autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerInputUI.tsx (2)
autogpt_platform/backend/backend/data/graph.py (1)
  • Graph (378-381)
autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts (1)
  • Graph (438-454)
autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/RunnerUIWrapper.tsx (2)
autogpt_platform/backend/backend/data/graph.py (1)
  • Graph (378-381)
autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts (1)
  • Graph (438-454)
autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-run-draft-view.tsx (2)
autogpt_platform/backend/backend/data/graph.py (1)
  • Graph (378-381)
autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts (1)
  • Graph (438-454)
autogpt_platform/backend/backend/api/features/library/db.py (1)
autogpt_platform/backend/backend/data/graph.py (1)
  • GraphBaseMeta (224-236)
autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/BlocksControl.tsx (3)
autogpt_platform/backend/backend/data/graph.py (1)
  • block (131-140)
autogpt_platform/frontend/src/app/api/helpers.ts (1)
  • okData (23-37)
autogpt_platform/frontend/src/tests/pages/build.page.ts (1)
  • addBlock (104-131)
autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/AgentOnboardingCredentials.tsx (1)
autogpt_platform/backend/backend/data/graph.py (1)
  • GraphModel (415-927)
autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/components/agent-schedule-details-view.tsx (2)
autogpt_platform/backend/backend/data/graph.py (1)
  • Graph (378-381)
autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts (1)
  • Graph (438-454)
autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/components/AgentOnboardingCredentials/helpers.ts (1)
autogpt_platform/backend/backend/data/graph.py (1)
  • GraphModel (415-927)
autogpt_platform/backend/backend/api/features/store/image_gen.py (1)
autogpt_platform/backend/backend/data/graph.py (2)
  • GraphBaseMeta (224-236)
  • name (1681-1682)
autogpt_platform/backend/backend/api/features/store/routes.py (1)
autogpt_platform/backend/backend/data/graph.py (1)
  • GraphModelWithoutNodes (930-942)
autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/useSubAgentUpdate.ts (4)
autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts (2)
  • GraphInputSchema (377-381)
  • GraphOutputSchema (411-415)
autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/helpers.ts (1)
  • EdgeLike (52-58)
autogpt_platform/frontend/src/app/(platform)/build/hooks/useSubAgentUpdate/types.ts (2)
  • GraphMetaLike (21-21)
  • SubAgentUpdateInfo (8-15)
autogpt_platform/frontend/src/app/api/helpers.ts (1)
  • okData (23-37)
autogpt_platform/frontend/src/app/(no-navbar)/onboarding/5-run/helpers.ts (1)
autogpt_platform/backend/backend/data/graph.py (1)
  • GraphModel (415-927)
autogpt_platform/backend/backend/data/graph.py (1)
autogpt_platform/backend/backend/data/model.py (4)
  • CredentialsMetaInput (496-554)
  • validate_credentials_field_schema (511-535)
  • CredentialsFieldInfo (566-687)
  • combine (576-666)
autogpt_platform/backend/backend/api/features/store/db.py (1)
autogpt_platform/backend/backend/data/graph.py (3)
  • GraphModelWithoutNodes (930-942)
  • hide_nodes (921-927)
  • GraphModel (415-927)
autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts (1)
autogpt_platform/backend/backend/data/graph.py (1)
  • GraphTriggerInfo (370-375)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: types
  • GitHub Check: e2e_test
  • GitHub Check: Seer Code Review
  • GitHub Check: test (3.12)
  • GitHub Check: test (3.11)
  • GitHub Check: test (3.13)
  • GitHub Check: Check PR Status
  • GitHub Check: Analyze (python)

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread autogpt_platform/backend/backend/api/features/store/db.py
Comment thread autogpt_platform/backend/backend/api/features/store/image_gen.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@autogpt_platform/frontend/src/app/`(platform)/build/components/legacy-builder/Flow/Flow.tsx:
- Around line 713-731: The code calls getV1GetSpecificGraph even when
hardcodedValues may lack graph_id/graph_version; update the conditional that
currently checks (blockID === SpecialBlockID.AGENT && hardcodedValues) to
additionally verify graph_id and graph_version are present and valid (e.g.,
const graphID = hardcodedValues.graph_id; const graphVersion =
hardcodedValues.graph_version; only proceed if graphID is a non-empty string and
graphVersion is a number), so getV1GetSpecificGraph(graphID, { version:
graphVersion }) is only invoked when both values exist; ensure inputSchema,
outputSchema and finalHardcodedValues are only set inside that guarded branch
and otherwise handle the missing-values path (log or skip) to avoid requests to
/graphs/undefined.
🧹 Nitpick comments (1)
autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx (1)

733-755: nodeId stale-closure risk on rapid node additions.

Line 734 reads nodeId from the closure while Line 755 increments via a functional updater. Because the function is now async, the window during which nodeId is stale is wider — two rapid calls (e.g. quick successive drops) could produce nodes with the same id.

A useRef-based counter (or using getNextNodeId() which already returns a UUID) would eliminate this entirely.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between befcaae and 14c70c4.

📒 Files selected for processing (1)
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
🧰 Additional context used
📓 Path-based instructions (10)
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Use Node.js 21+ with pnpm package manager for frontend development
Always run 'pnpm format' for formatting and linting code in frontend development

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/frontend/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{tsx,ts}: Use function declarations for components and handlers (not arrow functions) in React components
Only use arrow functions for small inline lambdas (map, filter, etc.) in React components
Use PascalCase for component names and camelCase with 'use' prefix for hook names in React
Use Tailwind CSS utilities only for styling in frontend components
Use design system components from 'src/components/' (atoms, molecules, organisms) in frontend development
Never use 'src/components/legacy/' in frontend code
Only use Phosphor Icons (@phosphor-icons/react) for icons in frontend components
Use generated API hooks from '@/app/api/generated/endpoints/' instead of deprecated 'BackendAPI' or 'src/lib/autogpt-server-api/
'
Use React Query for server state (via generated hooks) in frontend development
Default to client components ('use client') in Next.js; only use server components for SEO or extreme TTFB needs
Use '' component for rendering errors in frontend UI; use toast notifications for mutation errors; use 'Sentry.captureException()' for manual exceptions
Separate render logic from data/behavior in React components; keep comments minimal (code should be self-documenting)

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/frontend/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{ts,tsx}: No barrel files or 'index.ts' re-exports in frontend code
Regenerate API hooks with 'pnpm generate:api' after backend OpenAPI spec changes in frontend development

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)

autogpt_platform/frontend/src/**/*.{ts,tsx}: Fully capitalize acronyms in symbols, e.g. graphID, useBackendAPI
Use function declarations (not arrow functions) for components and handlers
Separate render logic (.tsx) from business logic (use*.ts hooks)
Use shadcn/ui (Radix UI primitives) with Tailwind CSS styling for UI components
Use Phosphor Icons only for icons
Use ErrorCard for render errors, toast for mutations, and Sentry for exceptions
Use design system components from src/components/ (atoms, molecules, organisms)
Never use src/components/__legacy__/* components
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName}
Use Tailwind CSS only for styling, with design tokens
Do not use useCallback or useMemo unless asked to optimize a given function
Never type with any unless a variable/attribute can ACTUALLY be of any type

autogpt_platform/frontend/src/**/*.{ts,tsx}: Structure components as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts and use design system components from src/components/ (atoms, molecules, organisms)
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName} and regenerate with pnpm generate:api
Use function declarations (not arrow functions) for components and handlers
Separate render logic from business logic with component.tsx + useComponent.ts + helpers.ts structure
Colocate state when possible, avoid creating large components, use sub-components in local /components folder
Avoid large hooks, abstract logic into helpers.ts files when sensible
Use arrow functions only for callbacks, not for component declarations
Avoid comments at all times unless the code is very complex
Do not use useCallback or useMemo unless asked to optimize a given function

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/frontend/src/app/(platform)/**/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)

Put sub-components in local components/ folder within feature directories

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/frontend/src/**/*.tsx

📄 CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)

Component props should be type Props = { ... } (not exported) unless it needs to be used outside the component

Component props should be interface Props { ... } (not exported) unless the interface needs to be used outside the component

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/frontend/**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

autogpt_platform/frontend/**/*.{js,jsx,ts,tsx}: Format frontend code using pnpm format
Never use components from src/components/__legacy__/*

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/frontend/**/*.{js,jsx,ts,tsx,css}

📄 CodeRabbit inference engine (AGENTS.md)

Use Tailwind CSS only for styling, use design tokens, and use Phosphor Icons only

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never type with any, if no types available use unknown

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/frontend/src/app/(platform)/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

If adding protected frontend routes, update frontend/lib/supabase/middleware.ts

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
🧠 Learnings (1)
📚 Learning: 2026-02-04T16:50:33.593Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:33.593Z
Learning: Use xyflow/react for visual graph editor in Workflow Builder

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
🧬 Code graph analysis (1)
autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx (3)
autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts (1)
  • BlockIORootSchema (43-48)
autogpt_platform/frontend/src/app/api/helpers.ts (1)
  • okData (23-37)
autogpt_platform/frontend/src/lib/utils.ts (1)
  • findNewlyAddedBlockCoordinates (352-408)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: e2e_test
  • GitHub Check: types
  • GitHub Check: Seer Code Review
  • GitHub Check: test (3.13)
  • GitHub Check: test (3.12)
  • GitHub Check: test (3.11)
  • GitHub Check: Check PR Status
🔇 Additional comments (3)
autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx (3)

31-42: Imports align with coding guidelines.

Using getV1GetSpecificGraph from the generated endpoints and okData helper is consistent with the project's API access patterns. As per coding guidelines: "Use generated API hooks from @/app/api/__generated__/endpoints/".


776-837: Clean delegation to createAndAddNode.

addNode is now much simpler with node creation logic properly centralized. The null-return check on Line 819 correctly handles the case where the block schema isn't found.


981-1008: onDrop simplification looks correct.

Properly delegates to createAndAddNode, and the existing try/catch covers both JSON.parse failures and any errors from the async helper.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@autogpt_platform/backend/backend/data/graph.py`:
- Around line 224-228: Docstring of GraphBaseMeta incorrectly references
GraphModelMeta which doesn't exist; update the docstring to reference the actual
class name GraphMeta (and keep mention of BaseGraph) so it correctly describes
the relationship; locate the GraphBaseMeta class definition and change the text
"Shared base for `GraphModelMeta` and `BaseGraph`" to "Shared base for
`GraphMeta` and `BaseGraph`".
🧹 Nitpick comments (2)
autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx (2)

694-774: Good centralization of node-creation logic.

The createAndAddNode helper properly consolidates what was previously duplicated across addNode and onDrop. The history tracking, schema resolution for agent blocks, and state updates are correctly wired.

One minor note: availableBlocks.find((node) => node.id === blockID) on Line 702 is also performed by the caller addNode on Line 782 (to determine uiType for coordinate calculation). This means two lookups for the same block on every addNode call. Consider passing the found nodeSchema into the helper or extracting the UI-type check.

Sketch: avoid double lookup
   const addNode = useCallback(
     async (
       blockId: string,
       nodeType: string,
       hardcodedValues: Record<string, any> = {},
     ) => {
       const nodeSchema = availableBlocks.find((node) => node.id === blockId);
       if (!nodeSchema) {
         console.error(`Schema not found for block ID: ${blockId}`);
         return;
       }

       // ... position calculation using nodeSchema.uiType ...

-      const newNode = await createAndAddNode(
-        blockId,
-        nodeType,
-        hardcodedValues,
-        position,
-      );
+      const newNode = await createAndAddNode(
+        nodeSchema,
+        nodeType,
+        hardcodedValues,
+        position,
+      );

Then update createAndAddNode to accept the already-resolved schema instead of looking it up again by blockID.


821-828: - 0.0 on Line 823 is a no-op.

(window.innerWidth - 0.0) is identical to window.innerWidth. If this was meant to be an offset (like the - 400 on Line 824 for height), it should be corrected; otherwise, just remove it for clarity.

Proposed cleanup
-          x: -position.x * 0.8 + (window.innerWidth - 0.0) / 2,
+          x: -position.x * 0.8 + window.innerWidth / 2,
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 14c70c4 and 88d1e62.

📒 Files selected for processing (4)
  • autogpt_platform/backend/backend/api/features/store/image_gen.py
  • autogpt_platform/backend/backend/data/graph.py
  • autogpt_platform/backend/snapshots/grphs_all
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
🧰 Additional context used
📓 Path-based instructions (18)
autogpt_platform/backend/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/backend/**/*.py: Use Python 3.11 (required; managed by Poetry via pyproject.toml) for backend development
Always run 'poetry run format' (Black + isort) before linting in backend development
Always run 'poetry run lint' (ruff) after formatting in backend development

Files:

  • autogpt_platform/backend/backend/api/features/store/image_gen.py
  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/backend/backend/api/features/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Update routes in '/backend/backend/api/features/' and add/update Pydantic models in the same directory for API development

When modifying API routes, update corresponding Pydantic models in the same directory and write tests alongside the route file

Files:

  • autogpt_platform/backend/backend/api/features/store/image_gen.py
autogpt_platform/backend/**/*.{py,txt}

📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Use poetry run prefix for all Python commands, including testing, linting, formatting, and migrations

Files:

  • autogpt_platform/backend/backend/api/features/store/image_gen.py
  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/backend/backend/api/**/*.py

📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

autogpt_platform/backend/backend/api/**/*.py: Use FastAPI for building REST and WebSocket endpoints
Use JWT-based authentication with Supabase integration

Files:

  • autogpt_platform/backend/backend/api/features/store/image_gen.py
autogpt_platform/backend/backend/**/*.py

📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)

Use Prisma ORM for database operations in PostgreSQL with pgvector for embeddings

Files:

  • autogpt_platform/backend/backend/api/features/store/image_gen.py
  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Format Python code with poetry run format

Files:

  • autogpt_platform/backend/backend/api/features/store/image_gen.py
  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/backend/backend/data/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

All data access in backend requires user ID checks; verify this for any 'data/*.py' changes

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/**/data/*.py

📄 CodeRabbit inference engine (AGENTS.md)

For changes touching data/*.py, validate user ID checks or explain why not needed

Files:

  • autogpt_platform/backend/backend/data/graph.py
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Use Node.js 21+ with pnpm package manager for frontend development
Always run 'pnpm format' for formatting and linting code in frontend development

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/frontend/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{tsx,ts}: Use function declarations for components and handlers (not arrow functions) in React components
Only use arrow functions for small inline lambdas (map, filter, etc.) in React components
Use PascalCase for component names and camelCase with 'use' prefix for hook names in React
Use Tailwind CSS utilities only for styling in frontend components
Use design system components from 'src/components/' (atoms, molecules, organisms) in frontend development
Never use 'src/components/legacy/' in frontend code
Only use Phosphor Icons (@phosphor-icons/react) for icons in frontend components
Use generated API hooks from '@/app/api/generated/endpoints/' instead of deprecated 'BackendAPI' or 'src/lib/autogpt-server-api/
'
Use React Query for server state (via generated hooks) in frontend development
Default to client components ('use client') in Next.js; only use server components for SEO or extreme TTFB needs
Use '' component for rendering errors in frontend UI; use toast notifications for mutation errors; use 'Sentry.captureException()' for manual exceptions
Separate render logic from data/behavior in React components; keep comments minimal (code should be self-documenting)

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/frontend/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{ts,tsx}: No barrel files or 'index.ts' re-exports in frontend code
Regenerate API hooks with 'pnpm generate:api' after backend OpenAPI spec changes in frontend development

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)

autogpt_platform/frontend/src/**/*.{ts,tsx}: Fully capitalize acronyms in symbols, e.g. graphID, useBackendAPI
Use function declarations (not arrow functions) for components and handlers
Separate render logic (.tsx) from business logic (use*.ts hooks)
Use shadcn/ui (Radix UI primitives) with Tailwind CSS styling for UI components
Use Phosphor Icons only for icons
Use ErrorCard for render errors, toast for mutations, and Sentry for exceptions
Use design system components from src/components/ (atoms, molecules, organisms)
Never use src/components/__legacy__/* components
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName}
Use Tailwind CSS only for styling, with design tokens
Do not use useCallback or useMemo unless asked to optimize a given function
Never type with any unless a variable/attribute can ACTUALLY be of any type

autogpt_platform/frontend/src/**/*.{ts,tsx}: Structure components as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts and use design system components from src/components/ (atoms, molecules, organisms)
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName} and regenerate with pnpm generate:api
Use function declarations (not arrow functions) for components and handlers
Separate render logic from business logic with component.tsx + useComponent.ts + helpers.ts structure
Colocate state when possible, avoid creating large components, use sub-components in local /components folder
Avoid large hooks, abstract logic into helpers.ts files when sensible
Use arrow functions only for callbacks, not for component declarations
Avoid comments at all times unless the code is very complex
Do not use useCallback or useMemo unless asked to optimize a given function

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/frontend/src/app/(platform)/**/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)

Put sub-components in local components/ folder within feature directories

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/frontend/src/**/*.tsx

📄 CodeRabbit inference engine (autogpt_platform/frontend/CLAUDE.md)

Component props should be type Props = { ... } (not exported) unless it needs to be used outside the component

Component props should be interface Props { ... } (not exported) unless the interface needs to be used outside the component

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/frontend/**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

autogpt_platform/frontend/**/*.{js,jsx,ts,tsx}: Format frontend code using pnpm format
Never use components from src/components/__legacy__/*

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/frontend/**/*.{js,jsx,ts,tsx,css}

📄 CodeRabbit inference engine (AGENTS.md)

Use Tailwind CSS only for styling, use design tokens, and use Phosphor Icons only

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never type with any, if no types available use unknown

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
autogpt_platform/frontend/src/app/(platform)/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

If adding protected frontend routes, update frontend/lib/supabase/middleware.ts

Files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
🧠 Learnings (11)
📚 Learning: 2026-02-04T16:49:42.476Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.476Z
Learning: Applies to autogpt_platform/backend/backend/api/features/**/*.py : Update routes in '/backend/backend/api/features/' and add/update Pydantic models in the same directory for API development

Applied to files:

  • autogpt_platform/backend/backend/api/features/store/image_gen.py
📚 Learning: 2026-02-04T16:49:56.176Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:49:56.176Z
Learning: Applies to autogpt_platform/**/*agent*graph*.json : Agent Graphs are workflow definitions stored as JSON and executed by the backend

Applied to files:

  • autogpt_platform/backend/snapshots/grphs_all
  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
📚 Learning: 2026-02-04T16:50:20.494Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.494Z
Learning: Applies to autogpt_platform/backend/**/*_test.py : Always review snapshot changes with `git diff` before committing when updating snapshots with `poetry run pytest --snapshot-update`

Applied to files:

  • autogpt_platform/backend/snapshots/grphs_all
📚 Learning: 2026-02-04T16:49:42.476Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.476Z
Learning: Applies to autogpt_platform/backend/**/test/**/*.py : Use snapshot testing with '--snapshot-update' flag in backend tests when output changes; always review with 'git diff'

Applied to files:

  • autogpt_platform/backend/snapshots/grphs_all
📚 Learning: 2026-02-04T16:50:20.494Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.494Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
📚 Learning: 2026-01-19T07:20:23.494Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11795
File: autogpt_platform/backend/backend/api/features/chat/tools/utils.py:92-111
Timestamp: 2026-01-19T07:20:23.494Z
Learning: In autogpt_platform/backend/backend/api/features/chat/tools/utils.py, the _serialize_missing_credential function uses next(iter(field_info.provider)) for provider selection. The PR author confirmed this non-deterministic provider selection is acceptable because the function returns both "type" (single, for backward compatibility) and "types" (full array), which achieves the primary goal of deterministic credential type presentation.

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
📚 Learning: 2026-02-04T16:49:42.476Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.476Z
Learning: Applies to autogpt_platform/backend/backend/blocks/**/*.py : Inherit from 'Block' base class with input/output schemas when adding new blocks in backend

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
📚 Learning: 2026-02-04T16:50:20.494Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.494Z
Learning: Applies to autogpt_platform/backend/backend/blocks/*.py : When creating new blocks, inherit from the `Block` base class and define input/output schemas using `BlockSchema`

Applied to files:

  • autogpt_platform/backend/backend/data/graph.py
📚 Learning: 2026-02-04T16:50:33.593Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:33.593Z
Learning: Use xyflow/react for visual graph editor in Workflow Builder

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
📚 Learning: 2026-02-04T16:50:33.593Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:33.593Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Fully capitalize acronyms in symbols, e.g. `graphID`, `useBackendAPI`

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
📚 Learning: 2026-02-04T16:50:51.303Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-04T16:50:51.303Z
Learning: Applies to autogpt_platform/frontend/src/**/*.{ts,tsx} : Structure components as `ComponentName/ComponentName.tsx` + `useComponentName.ts` + `helpers.ts` and use design system components from `src/components/` (atoms, molecules, organisms)

Applied to files:

  • autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx
🧬 Code graph analysis (3)
autogpt_platform/backend/backend/api/features/store/image_gen.py (1)
autogpt_platform/backend/backend/data/graph.py (2)
  • GraphBaseMeta (224-236)
  • name (1682-1683)
autogpt_platform/backend/backend/data/graph.py (2)
autogpt_platform/backend/backend/data/block.py (2)
  • name (569-570)
  • BlockType (66-76)
autogpt_platform/backend/backend/data/model.py (4)
  • CredentialsMetaInput (496-554)
  • validate_credentials_field_schema (511-535)
  • CredentialsFieldInfo (566-687)
  • combine (576-666)
autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx (6)
autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/CustomNode/CustomNode.tsx (2)
  • CustomNode (110-110)
  • CustomNode (112-1270)
autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/CustomNode.tsx (2)
  • CustomNode (46-46)
  • CustomNode (48-130)
autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts (1)
  • BlockIORootSchema (43-48)
autogpt_platform/frontend/src/app/api/helpers.ts (1)
  • okData (23-37)
autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/history.ts (1)
  • history (95-95)
autogpt_platform/frontend/src/lib/utils.ts (1)
  • findNewlyAddedBlockCoordinates (352-408)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: e2e_test
  • GitHub Check: types
  • GitHub Check: test (3.11)
  • GitHub Check: test (3.12)
  • GitHub Check: test (3.13)
  • GitHub Check: Check PR Status
🔇 Additional comments (14)
autogpt_platform/frontend/src/app/(platform)/build/components/legacy-builder/Flow/Flow.tsx (2)

32-42: LGTM on new imports.

The imports correctly use the generated API endpoint (getV1GetSpecificGraph from @/app/api/__generated__/endpoints/) and the shared okData helper, which aligns with the coding guidelines for using generated API hooks.


981-1008: LGTM on the refactored onDrop.

Clean delegation to createAndAddNode with proper async/await, fallback for missing hardcodedValues, and a correct dependency array.

autogpt_platform/backend/backend/data/graph.py (10)

114-119: Good use of Field(default_factory=...) for mutable defaults.

Switching from bare mutable defaults to Field(default_factory=...) is the correct pattern in Pydantic to avoid shared-state bugs across instances.


224-249: Clean separation of metadata and structure.

Splitting GraphBaseMeta (core fields) from BaseGraph (nodes, links, computed fields) is a solid design choice that enables the lightweight GraphMeta path for listings.


384-412: Lightweight GraphMeta is the key to the latency reduction.

By stripping out nodes, links, and all expensive computed fields (especially credentials_input_schema), this model sidesteps the dominant cost identified in profiling. The from_db mapping is clean and complete.


415-445: MRO diamond through GraphBaseMeta is valid.

The C3 linearization resolves correctly: GraphModel → Graph → BaseGraph → GraphMeta → GraphBaseMeta → BaseDbModel. Since GraphMeta redeclares id and version without defaults, GraphModel construction always requires them — which all current call sites (from_db, make_graph_model) satisfy.


476-543: Excellent optimization: dict-based schema avoids create_model overhead.

Building the JSON schema dict directly instead of constructing a dynamic BlockSchema subclass per credential field is the right approach. The model_dump on Line 523 correctly uses Python field names in exclude (not aliases), and the merged keys don't collide with the hand-built field_schema properties.


545-605: Correct is_required propagation with safe default.

The any(...) semantics (Lines 599–602) — treating the aggregated field as required if any contributing node demands credentials — is the right policy. The fallback node_required_map.get(node_id, True) defaults to required, which is the safe/conservative choice.


889-920: Hardcoded GraphModel.from_db for sub-graphs is fine given the exclusion.

Line 917 uses GraphModel.from_db rather than cls.from_db for sub-graphs. This is harmless because sub_graphs is excluded from serialization in GraphModelWithoutNodes, and BaseGraph-typed sub-graphs don't need the same treatment as the parent.


922-944: Smart serialization-only exclusion preserves computed fields.

Field(exclude=True) hides nodes/links/sub-graphs from JSON output while keeping them accessible internally, so credentials_input_schema, input_schema, etc. continue to work correctly on the GraphModelWithoutNodes instance.


1018-1018: This is the primary latency win — matching the lightweight query with the lightweight model.

The find_many query omits AGENT_GRAPH_INCLUDE (no node/link joins), and GraphMeta.from_db skips all expensive computed fields. This matches the PR objective to eliminate per-item credentials_input_schema computation in listings.


946-951: LGTM.

GraphsPaginated correctly types graphs as list[GraphMeta], aligning with the lightweight listing path.

autogpt_platform/backend/snapshots/grphs_all (1)

1-15: Snapshot correctly reflects the new GraphMeta shape.

The snapshot aligns with GraphMeta's fields: all expensive computed properties (credentials_input_schema, input_schema, output_schema, etc.) and structural data (sub_graphs) are removed, and created_at is added. Consistent with the listing endpoint now returning GraphMeta instead of full graph models.

autogpt_platform/backend/backend/api/features/store/image_gen.py (1)

19-19: Type narrowing from BaseGraph to GraphBaseMeta is correct.

These functions only access .name and .description, both of which live on GraphBaseMeta. Using the narrower type avoids requiring the heavier BaseGraph (which carries nodes, links, and computed fields) when it's unnecessary.

The docstring typo flagged in a previous review (_GraphBaseMeta) appears to be fixed — Line 110 now reads GraphBaseMeta | AgentGraph.

Also applies to: 37-37, 44-44, 105-110

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread autogpt_platform/backend/backend/data/graph.py
ntindle
ntindle previously approved these changes Feb 6, 2026
@github-project-automation github-project-automation Bot moved this from 🆕 Needs initial review to 👍🏼 Mergeable in AutoGPT development kanban Feb 6, 2026
@ntindle

ntindle commented Feb 6, 2026

Copy link
Copy Markdown
Member

Tested as an AI agent on local dev environment:

Test Results

  • Backend starts cleanly, health endpoint returns healthy
  • GET /api/graphs returning 200 with multiple fast calls observed
  • GET /api/blocks working correctly
  • Frontend compiles and loads without errors
  • Library page loads with search/filter functional
  • Build page loads with React Flow canvas working
  • Blocks list populates correctly across categories

No critical errors in backend logs. The latency optimization appears to be working well — API calls are completing quickly.

Looks good to me! 🤠

— Claude (AI agent testing on behalf of @ntindle)

@Pwuts
Pwuts added this pull request to the merge queue Feb 6, 2026
Merged via the queue into dev with commit 8fddc9d Feb 6, 2026
29 of 31 checks passed
@Pwuts
Pwuts deleted the pwuts/secrt-1896-fix-crazy-get-graphs-latency branch February 6, 2026 19:35
@github-project-automation github-project-automation Bot moved this from 👍🏼 Mergeable to ✅ Done in AutoGPT development kanban Feb 6, 2026
@github-project-automation github-project-automation Bot moved this to Done in Frontend Feb 6, 2026
ntindle added a commit that referenced this pull request Feb 6, 2026
Adapt auto-credentials filtering to dev's refactored graph model:
- aggregate_credentials_inputs() now returns 3-tuples (field_info, node_pairs, is_required)
- credentials_input_schema moved to GraphModel, builds JSON schema directly
- Update regular/auto_credentials_inputs properties for 3-tuple format
- Update test mocks and assertions for new tuple format and class hierarchy

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai coderabbitai Bot mentioned this pull request Apr 3, 2026
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform/backend AutoGPT Platform - Back end platform/frontend AutoGPT Platform - Front end size/l size/xl

Projects

Status: ✅ Done
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants