Skip to content

feat: add DigitalOcean Gradient AI components#3896

Merged
forestileao merged 32 commits intomainfrom
feature/knowledgebase-management
Apr 7, 2026
Merged

feat: add DigitalOcean Gradient AI components#3896
forestileao merged 32 commits intomainfrom
feature/knowledgebase-management

Conversation

@gaga1307
Copy link
Copy Markdown
Collaborator

@gaga1307 gaga1307 commented Apr 1, 2026

Summary

Adds five new DigitalOcean Gradient AI components for managing knowledge bases and running agent evaluations.

New Components

Create Knowledge Base (digitalocean.createKnowledgeBase)

Creates a new knowledge base on the Gradient AI Platform for use with AI agents via retrieval-augmented generation (RAG). A knowledge base converts data sources into vector embeddings using the selected embedding model, stored in an OpenSearch database.

  • Data sources — supports multiple sources per knowledge base: Spaces bucket/folder (indexes all supported files) and web/sitemap URL (crawls a public website or sitemap)
  • Chunking strategies — each data source has independent chunking: section-based (default, splits on headings/paragraphs), semantic (groups by meaning), hierarchical (parent/child chunk pairs), and fixed-length (strict token count)
  • OpenSearch database — provisions a new database automatically or connects to an existing one
  • Polling — creates the KB, waits for database provisioning, triggers an indexing job, and polls every 30s until indexing completes

Attach Knowledge Base (digitalocean.attachKnowledgeBase)

Connects a knowledge base to a Gradient AI agent, enabling RAG. Useful for wiring up a newly created KB, blue/green KB deployments, or adding additional knowledge bases to an agent. The KB selector dynamically filters to only show knowledge bases not already attached to the selected agent.

Detach Knowledge Base (digitalocean.detachKnowledgeBase)

Removes a knowledge base from a Gradient AI agent. Useful for rollbacks, cleanup before attaching a fresh KB, or rotation as part of a blue/green pipeline. The KB selector dynamically filters to only show knowledge bases currently attached to the selected agent.

Delete Knowledge Base (digitalocean.deleteKnowledgeBase)

Deletes a knowledge base and optionally its associated OpenSearch database. Fetches the database ID before deletion so it can clean up both resources in one step. Deletion is idempotent — already-removed resources are handled gracefully. Output includes confirmation of what was deleted (KB only, or KB + database).

Run Evaluation (digitalocean.runEvaluation)

Runs a pre-configured evaluation test case against an agent, polls every 30s until completion (typically 1–5 minutes), and routes to Passed or Failed output channels based on the result.

  • Configuration — run name (user-provided, max 64 chars), test case (defines prompts, metrics, thresholds), and agent to evaluate
  • Output — star metric score, all run-level metrics, per-prompt results (input, agent output, ground truth, individual metric scores), timing, and error descriptions on failure
  • Use cases — blue/green deployments (evaluate before promoting), regression testing (verify quality after KB changes), continuous validation (detect quality drift)

UI

  • Workflow node mappers for all five components with metadata display, execution details, and state management
  • Run Evaluation shows Passed/Failed badges with rounded star metric percentage
  • Integration resource listing for evaluation_test_case, agent, embedding_model, project, opensearch_database, knowledge_base, spaces_bucket, agent_knowledge_base, and agent_available_knowledge_base

Tests

Unit tests covering Setup validation, Execute, and HandleAction for all components.

Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
@superplanehq-integration
Copy link
Copy Markdown

👋 Commands for maintainers:

  • /sp start - Start an ephemeral machine (takes ~30s)
  • /sp stop - Stop a running machine (auto-executed on pr close)

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Autofix Details

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: Unused ListKnowledgeBases function is dead code
    • Removed the unused exported ListKnowledgeBases method from the DigitalOcean client.
  • ✅ Fixed: Unused CreateKnowledgeBaseOutput type is dead code
    • Removed the unused exported CreateKnowledgeBaseOutput interface from the DigitalOcean workflow mapper types.

Create PR

Or push these changes by commenting:

@cursor push f4ce97b40e
Preview (f4ce97b40e)
diff --git a/pkg/integrations/digitalocean/client.go b/pkg/integrations/digitalocean/client.go
--- a/pkg/integrations/digitalocean/client.go
+++ b/pkg/integrations/digitalocean/client.go
@@ -2453,25 +2453,6 @@
 	return &response.KnowledgeBase, nil
 }
 
-// ListKnowledgeBases retrieves all knowledge bases in the account
-func (c *Client) ListKnowledgeBases() ([]KnowledgeBase, error) {
-	url := fmt.Sprintf("%s/gen-ai/knowledge_bases?per_page=200", c.BaseURL)
-	responseBody, err := c.execRequest(http.MethodGet, url, nil)
-	if err != nil {
-		return nil, err
-	}
-
-	var response struct {
-		KnowledgeBases []KnowledgeBase `json:"knowledge_bases"`
-	}
-
-	if err := json.Unmarshal(responseBody, &response); err != nil {
-		return nil, fmt.Errorf("error parsing response: %v", err)
-	}
-
-	return response.KnowledgeBases, nil
-}
-
 // AppNodeMetadata stores metadata about an app for display in the UI
 type AppNodeMetadata struct {
 	AppID   string `json:"appId" mapstructure:"appId"`

diff --git a/web_src/src/pages/workflowv2/mappers/digitalocean/types.ts b/web_src/src/pages/workflowv2/mappers/digitalocean/types.ts
--- a/web_src/src/pages/workflowv2/mappers/digitalocean/types.ts
+++ b/web_src/src/pages/workflowv2/mappers/digitalocean/types.ts
@@ -255,14 +255,3 @@
   parentChunkSize?: number;
   childChunkSize?: number;
 }
-
-export interface CreateKnowledgeBaseOutput {
-  uuid?: string;
-  name?: string;
-  region?: string;
-  embeddingModelUUID?: string;
-  projectId?: string;
-  databaseId?: string;
-  tags?: string[];
-  createdAt?: string;
-}

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Comment thread pkg/integrations/digitalocean/client.go
Comment thread web_src/src/pages/workflowv2/mappers/digitalocean/types.ts Outdated
gaga1307 added 2 commits April 2, 2026 09:18
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
@gaga1307 gaga1307 marked this pull request as draft April 2, 2026 07:49
gaga1307 added 6 commits April 2, 2026 10:55
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
…tput

Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
@gaga1307 gaga1307 changed the title feat: add DigitalOcean Create Knowledge Base component feat: add DigitalOcean GradientAI components Apr 3, 2026
@gaga1307 gaga1307 changed the title feat: add DigitalOcean GradientAI components feat: add DigitalOcean Gradient AI components Apr 3, 2026
gaga1307 added 4 commits April 3, 2026 12:29
…e knowledge base

Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
…etachKnowledgeBase components

Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
@gaga1307 gaga1307 marked this pull request as ready for review April 3, 2026 15:37
Comment thread pkg/integrations/digitalocean/attach_knowledge_base.go
Comment thread pkg/integrations/digitalocean/client.go Outdated
gaga1307 added 3 commits April 3, 2026 18:49
…ata resolution

Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Comment thread pkg/integrations/digitalocean/delete_knowledge_base.go
Comment thread pkg/integrations/digitalocean/create_knowledge_base.go
gaga1307 added 2 commits April 3, 2026 19:57
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
@superplanehq-integration
Copy link
Copy Markdown

✅ Ephemeral machine has been terminated.

@AleksandarCole
Copy link
Copy Markdown
Collaborator

/sp start

@superplanehq-integration
Copy link
Copy Markdown

✅ Ready.

Web: https://pr-3896-ephemeral.superplane.com
SSH: ssh -o StrictHostKeyChecking=no app@178.104.15.210
Logs: ssh -o StrictHostKeyChecking=no app@178.104.15.210 'cd superplane && make dev.logs.app'

@AleksandarCole
Copy link
Copy Markdown
Collaborator

/sp stop

@AleksandarCole AleksandarCole added the pr:stage-3/3 Ready for full, in-depth, review label Apr 6, 2026
@superplanehq-integration
Copy link
Copy Markdown

✅ Ephemeral machine has been terminated.

@gaga1307
Copy link
Copy Markdown
Collaborator Author

gaga1307 commented Apr 6, 2026

@forestileao, I have a few more changes to make — will let you know when it's ready for review!

Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
@gaga1307
Copy link
Copy Markdown
Collaborator Author

gaga1307 commented Apr 6, 2026

@forestileao changes are done, ready for review!

@forestileao
Copy link
Copy Markdown
Collaborator

@gaga1307 please fix eslint and formatting issues

Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Godoc comment attached to wrong function
    • Moved the resolveDisplayNames godoc comment to sit directly above its function so it no longer incorrectly documents mergeCreateKBOutputFromFetchedKB.

Create PR

Or push these changes by commenting:

@cursor push 89fbf1a3d8
Preview (89fbf1a3d8)
diff --git a/pkg/integrations/digitalocean/create_knowledge_base.go b/pkg/integrations/digitalocean/create_knowledge_base.go
--- a/pkg/integrations/digitalocean/create_knowledge_base.go
+++ b/pkg/integrations/digitalocean/create_knowledge_base.go
@@ -344,9 +344,6 @@
 	return ctx.Requests.ScheduleActionCall("poll", map[string]any{}, kbPollInterval)
 }
 
-// resolveDisplayNames enriches the output map with human-readable names for
-// the embedding model, project, and OpenSearch database. Failures are ignored
-// so a lookup error never blocks the execution result.
 // mergeCreateKBOutputFromFetchedKB updates the Execute-time output map with fields that the create
 // response may omit until async provisioning finishes (e.g. databaseId for a newly created OpenSearch cluster).
 func mergeCreateKBOutputFromFetchedKB(output map[string]any, kb *KnowledgeBase) {
@@ -358,6 +355,9 @@
 	}
 }
 
+// resolveDisplayNames enriches the output map with human-readable names for
+// the embedding model, project, and OpenSearch database. Failures are ignored
+// so a lookup error never blocks the execution result.
 func resolveDisplayNames(client *Client, spec CreateKnowledgeBaseSpec, output map[string]any) {
 	if models, err := client.ListEmbeddingModels(); err == nil {
 		for _, m := range models {

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Comment thread pkg/integrations/digitalocean/create_knowledge_base.go
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Comment thread pkg/integrations/digitalocean/run_evaluation.go
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Comment thread pkg/integrations/digitalocean/run_evaluation.go
@gaga1307
Copy link
Copy Markdown
Collaborator Author

gaga1307 commented Apr 6, 2026

@forestileao fixed lint and formatting issues. CI is now passing.

Copy link
Copy Markdown
Collaborator

@forestileao forestileao left a comment

Choose a reason for hiding this comment

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

Requested changes related more to code consistency.

Please also add frontent tests for the mappers using vitest. It should test if there are no undefined TypeError that might happen. WE have examples in the code base.

Comment thread pkg/integrations/digitalocean/attach_knowledge_base.go Outdated
Comment thread pkg/integrations/digitalocean/attach_knowledge_base.go
Comment thread pkg/integrations/digitalocean/create_knowledge_base.go
Comment thread pkg/integrations/digitalocean/create_knowledge_base.go Outdated
Comment thread pkg/integrations/digitalocean/create_knowledge_base.go Outdated
Comment thread pkg/integrations/digitalocean/create_knowledge_base.go
Comment thread pkg/integrations/digitalocean/create_knowledge_base.go
Comment thread pkg/integrations/digitalocean/delete_knowledge_base.go Outdated
Comment thread pkg/integrations/digitalocean/run_evaluation.go
gaga1307 added 3 commits April 7, 2026 11:22
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
…Base

Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Comment thread pkg/integrations/digitalocean/delete_knowledge_base.go Outdated
Signed-off-by: Dragica Draskic <dragica.draskic@gmail.com>
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 252bfd8. Configure here.

Comment thread pkg/integrations/digitalocean/create_knowledge_base.go
@gaga1307
Copy link
Copy Markdown
Collaborator Author

gaga1307 commented Apr 7, 2026

@forestileao I’ve addressed the requested changes regarding code consistency, naming, response structure, and reduced nesting. I also added frontend tests for the mappers using Vitest.

@forestileao forestileao merged commit beb5f4a into main Apr 7, 2026
5 checks passed
@forestileao forestileao deleted the feature/knowledgebase-management branch April 7, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:stage-3/3 Ready for full, in-depth, review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants