-
Notifications
You must be signed in to change notification settings - Fork 45.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rnd): Introduce Sub-Graph on Agent Server (#7693)
### Background This change brings the capability to decompose a graph into sub-graphs. The objective of this feature is to allow a user to build a visually modular, and easier-to-understand graph. Also, allowing you to import a graph into your existing graph, without decluttering your existing graph. This feature will require more implementation on the UI side, to allow the grouping of subgraph to be represented as a node in the builder. ### Changes 🏗️ Introduced a subgraph functionality with the following property: * Sub-graph is simply a set of nodes that are grouped together, making it representable as a node. * Sub-graph input & output pins/schema are the `InputBlock` / `OutputBlock` nodes present in the subgraph. * The previous point implies that connecting two nodes from different sub-graphs, other than input/output nodes, is not allowed. * Graph can be nested, but defined flatly, e.g.: graph is now only represented by three components: nodes, links, and subgraphs (a set of list of nodes). A nested subgraph is simply connecting a node inside a subgraph into another `InputBlock` node of another subgraph.
- Loading branch information
Showing
9 changed files
with
253 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
rnd/autogpt_server/migrations/20240804040756_add_subgraph/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-- RedefineTables | ||
PRAGMA foreign_keys=OFF; | ||
CREATE TABLE "new_AgentGraph" ( | ||
"id" TEXT NOT NULL, | ||
"version" INTEGER NOT NULL DEFAULT 1, | ||
"name" TEXT, | ||
"description" TEXT, | ||
"isActive" BOOLEAN NOT NULL DEFAULT true, | ||
"isTemplate" BOOLEAN NOT NULL DEFAULT false, | ||
"agentGraphParentId" TEXT, | ||
|
||
PRIMARY KEY ("id", "version"), | ||
CONSTRAINT "AgentGraph_agentGraphParentId_version_fkey" FOREIGN KEY ("agentGraphParentId", "version") REFERENCES "AgentGraph" ("id", "version") ON DELETE RESTRICT ON UPDATE CASCADE | ||
); | ||
INSERT INTO "new_AgentGraph" ("description", "id", "isActive", "isTemplate", "name", "version") SELECT "description", "id", "isActive", "isTemplate", "name", "version" FROM "AgentGraph"; | ||
DROP TABLE "AgentGraph"; | ||
ALTER TABLE "new_AgentGraph" RENAME TO "AgentGraph"; | ||
PRAGMA foreign_key_check; | ||
PRAGMA foreign_keys=ON; |
5 changes: 5 additions & 0 deletions
5
rnd/autogpt_server/postgres/migrations/20240804040801_add_subgraph/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- AlterTable | ||
ALTER TABLE "AgentGraph" ADD COLUMN "agentGraphParentId" TEXT; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "AgentGraph" ADD CONSTRAINT "AgentGraph_agentGraphParentId_version_fkey" FOREIGN KEY ("agentGraphParentId", "version") REFERENCES "AgentGraph"("id", "version") ON DELETE RESTRICT ON UPDATE CASCADE; |
Oops, something went wrong.