diff --git a/apps/docs/content/docs/tools/meta.json b/apps/docs/content/docs/tools/meta.json index f331ca1a84..cbfb47d4e2 100644 --- a/apps/docs/content/docs/tools/meta.json +++ b/apps/docs/content/docs/tools/meta.json @@ -28,6 +28,7 @@ "perplexity", "pinecone", "reddit", + "rightbrain", "s3", "serper", "slack", diff --git a/apps/docs/content/docs/tools/rightbrain.mdx b/apps/docs/content/docs/tools/rightbrain.mdx new file mode 100644 index 0000000000..62f8aff0a5 --- /dev/null +++ b/apps/docs/content/docs/tools/rightbrain.mdx @@ -0,0 +1,541 @@ +--- +title: Rightbrain +description: Run a Rightbrain AI task +--- + +import { BlockInfoCard } from '@/components/ui/block-info-card' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `} +/> + +{/* MANUAL-CONTENT-START:intro */} +[Rightbrain](https://rightbrain.ai) is an AI deployment platform that transforms your natural language instructions into production-ready APIs within minutes. With Rightbrain + Sim Studio, you can seamlessly integrate powerful AI capabilities into your workflows without writing a single line of code. + +### Why use Rightbrain? + +- **Zero-Code Deployment**: Turn natural language instructions into production-ready APIs in minutes - no coding required. +- **Instant Model Access**: Utilize the latest LLMs and AI models without any setup, API keys, or infrastructure management. +- **No BYOK Required**: Eliminate the complexity of managing your own LLM accounts, tokens, or infrastructure. +- **Enterprise-Ready Scalability**: Deploy AI features across any application or workflow with automatic scaling to handle varying loads. +- **Comprehensive Management Hub**: Control all your AI features from one central dashboard with powerful tools for testing, monitoring, analytics, and version management. +- **Continuous Optimisation**: Improve your AI tasks over time without requiring code changes in your applications. +- **Cost-Effective**: Pay only for what you use with a free credits on sign up, transparent pricing, and no minimum commitments. + {/* MANUAL-CONTENT-END */} + +## Usage Instructions + +{/* MANUAL-CONTENT-START:usage */} + +### Step 1: Set Up Your Rightbrain Task + +1. **Create a Rightbrain Account**: Sign up at [Rightbrain.ai](https://rightbrain.ai) if you don't already have an account. Accounts are free and include a 30-day trial with free credits to get started. +2. **Create Your Task**: Build your AI task using natural language instructions in the Rightbrain platform. +3. **Test and Refine**: Use Rightbrain's testing tools to validate your task performs as expected. + +### Step 2: Get Your Task Details for Sim Studio + +1. **Access Task Integration**: + - Open the specific Rightbrain Task you want to run + - Click the **Integrate** button from the Task Run view + - From here you can: + - Create or choose an existing API key and copy it + - Copy the **Task Run URL** from the Quick Copy section + - Copy the example **Task Input JSON** structure + +### Step 3: Configure in Sim Studio + +1. **Add the Rightbrain Tool**: Drag the Rightbrain tool onto your Sim Studio canvas +2. **Configure the Tool**: + - Paste the **Task Run URL** into the "Task URL" field + - Paste your **Task Inputs JSON** object into the "Task Inputs" code field + - Paste your **Rightbrain API Key** into the "API Key" field +3. **Link with Other Tools**: Connect the Rightbrain block to other tools in your workflow + - Use variables from previous blocks as dynamic inputs + - Pass Rightbrain outputs to subsequent blocks in your workflow + {/* MANUAL-CONTENT-END */} + +Your Rightbrain task will execute as part of your Sim Studio workflow, with results available via the `response` object. + +## Tools + +### `rightbrain_run_task` + +Run a Rightbrain AI task. Tasks are created in the Rightbrain app and can be chained together or connected to other apps with Sim Studio to dynamically process inputs, outputs or a combination of both. A task response can be found in the `response.response` object. + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ------ | -------- | -------------------------- | +| `url` | string | Yes | Rightbrain task URL | +| `inputs` | object | Yes | The task_input JSON object | +| `apiKey` | string | Yes | Your Rightbrain API key | + +#### Output + +| Parameter | Type | +| ------------------------ | ------ | +| `charged_credits` | string | +| `created` | string | +| `id` | string | +| `input_processor_timing` | string | +| `input_tokens` | string | +| `llm_call_timing` | string | +| `output_tokens` | string | +| `response` | string | +| `run_data` | string | +| `task_id` | string | +| `task_revision_id` | string | +| `total_tokens` | string | +| `is_error` | string | + +## Block Configuration + +### Input + +| Parameter | Type | Required | Description | +| --------- | ------ | -------- | ------------------------------ | +| `url` | string | Yes | Task URL - Rightbrain task URL | + +### Outputs + +| Output | Type | Description | +| -------------------------- | ------ | -------------------------------------- | +| `response` | object | Output from response | +| ↳ `charged_credits` | any | charged_credits of the response | +| ↳ `created` | string | created of the response | +| ↳ `id` | string | id of the response | +| ↳ `input_processor_timing` | any | input_processor_timing of the response | +| ↳ `input_tokens` | number | input_tokens of the response | +| ↳ `llm_call_timing` | any | llm_call_timing of the response | +| ↳ `output_tokens` | number | output_tokens of the response | +| ↳ `response` | json | response of the response | +| ↳ `run_data` | json | run_data of the response | +| ↳ `task_id` | string | task_id of the response | +| ↳ `task_revision_id` | string | task_revision_id of the response | +| ↳ `total_tokens` | number | total_tokens of the response | +| ↳ `is_error` | any | is_error of the response | + +## Notes + +- Category: `tools` +- Type: `rightbrain` diff --git a/apps/sim/blocks/blocks/rightbrain.ts b/apps/sim/blocks/blocks/rightbrain.ts new file mode 100644 index 0000000000..d3fb9337ea --- /dev/null +++ b/apps/sim/blocks/blocks/rightbrain.ts @@ -0,0 +1,66 @@ +import { RightBrainIcon } from '@/components/icons' +import { RightBrainRunTaskResponse } from '@/tools/rightbrain/types' +import { BlockConfig } from '../types' + +export const RightBrainBlock: BlockConfig = { + type: 'rightbrain', + name: 'Rightbrain', + description: 'Run a Rightbrain AI task', + longDescription: + 'Your Rightbrain task will execute as part of your Sim Studio workflow, with results available via the `response` object.', + docsLink: 'https://docs.rightbrain.ai/intro', + category: 'tools', + bgColor: '#E0E0E0', + icon: RightBrainIcon, + subBlocks: [ + { + id: 'url', + title: 'Task URL', + type: 'short-input', + layout: 'full', + placeholder: 'Rightbrain task URL', + }, + { + id: 'inputs', + title: 'Task inputs', + type: 'code', + layout: 'full', + placeholder: 'The task_input JSON object', + }, + { + id: 'apiKey', + title: 'API Key', + type: 'short-input', + layout: 'full', + placeholder: 'Your Rightbrain API key', + password: true, + }, + ], + tools: { + access: ['rightbrain_run_task'], + }, + inputs: { + url: { type: 'string', required: true }, + inputs: { type: 'json', required: true }, + apiKey: { type: 'string', required: true }, + }, + outputs: { + response: { + type: { + charged_credits: 'any', + created: 'string', + id: 'string', + input_processor_timing: 'any', + input_tokens: 'number', + llm_call_timing: 'any', + output_tokens: 'number', + response: 'json', + run_data: 'json', + task_id: 'string', + task_revision_id: 'string', + total_tokens: 'number', + is_error: 'any', + }, + }, + }, +} diff --git a/apps/sim/blocks/registry.ts b/apps/sim/blocks/registry.ts index 4a44fdaa4a..7d26d4309e 100644 --- a/apps/sim/blocks/registry.ts +++ b/apps/sim/blocks/registry.ts @@ -36,6 +36,7 @@ import { OpenAIBlock } from './blocks/openai' import { PerplexityBlock } from './blocks/perplexity' import { PineconeBlock } from './blocks/pinecone' import { RedditBlock } from './blocks/reddit' +import { RightBrainBlock } from './blocks/rightbrain' import { RouterBlock } from './blocks/router' import { S3Block } from './blocks/s3' import { SerperBlock } from './blocks/serper' @@ -91,6 +92,7 @@ export const registry: Record = { perplexity: PerplexityBlock, pinecone: PineconeBlock, reddit: RedditBlock, + rightbrain: RightBrainBlock, router: RouterBlock, s3: S3Block, serper: SerperBlock, diff --git a/apps/sim/components/icons.tsx b/apps/sim/components/icons.tsx index cb09565439..4772ac0e77 100644 --- a/apps/sim/components/icons.tsx +++ b/apps/sim/components/icons.tsx @@ -1359,13 +1359,24 @@ export function GoogleIcon(props: SVGProps) { export function DiscordIcon(props: SVGProps) { return ( - - - - - - - + + + + + ) } @@ -2452,3 +2463,425 @@ export function ClayIcon(props: SVGProps) { ) } + +export function RightBrainIcon(props: SVGProps) { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ) +} diff --git a/apps/sim/package.json b/apps/sim/package.json index 6af6cc3868..ccd838b13a 100644 --- a/apps/sim/package.json +++ b/apps/sim/package.json @@ -65,6 +65,7 @@ "@radix-ui/react-toggle": "^1.1.2", "@radix-ui/react-tooltip": "^1.1.6", "@react-email/components": "^0.0.34", + "@rightbrain/sdk": "^0.1.2", "@sentry/nextjs": "^9.15.0", "@vercel/og": "^0.6.5", "@vercel/speed-insights": "^1.2.0", diff --git a/apps/sim/tools/registry.ts b/apps/sim/tools/registry.ts index a4dc45b82a..acbbb7ba1b 100644 --- a/apps/sim/tools/registry.ts +++ b/apps/sim/tools/registry.ts @@ -8,6 +8,12 @@ import { autoblocksPromptManagerTool } from './autoblocks' import { browserUseRunTaskTool } from './browser_use' import { clayPopulateTool } from './clay' import { confluenceRetrieveTool, confluenceUpdateTool } from './confluence' +import { + discordGetMessagesTool, + discordGetServerTool, + discordGetUserTool, + discordSendMessageTool, +} from './discord' import { elevenLabsTtsTool } from './elevenlabs' import { exaAnswerTool, exaFindSimilarLinksTool, exaGetContentsTool, exaSearchTool } from './exa' import { fileParseTool } from './file' @@ -48,6 +54,7 @@ import { pineconeUpsertTextTool, } from './pinecone' import { redditGetCommentsTool, redditGetPostsTool, redditHotPostsTool } from './reddit' +import { runTaskTool } from './rightbrain' import { s3GetObjectTool } from './s3' import { opportunitiesTool as salesforceOpportunities } from './salesforce/opportunities' import { searchTool as serperSearch } from './serper' @@ -64,7 +71,6 @@ import { visionTool } from './vision' import { whatsappSendMessageTool } from './whatsapp' import { xReadTool, xSearchTool, xUserTool, xWriteTool } from './x' import { youtubeSearchTool } from './youtube' -import { discordGetMessagesTool, discordGetServerTool, discordGetUserTool, discordSendMessageTool } from './discord' // Registry of all available tools export const tools: Record = { @@ -121,6 +127,7 @@ export const tools: Record = { reddit_hot_posts: redditHotPostsTool, reddit_get_posts: redditGetPostsTool, reddit_get_comments: redditGetCommentsTool, + rightbrain_run_task: runTaskTool, google_drive_download: driveDownloadTool, google_drive_list: driveListTool, google_drive_upload: driveUploadTool, @@ -157,4 +164,4 @@ export const tools: Record = { discord_get_messages: discordGetMessagesTool, discord_get_server: discordGetServerTool, discord_get_user: discordGetUserTool, -} +} diff --git a/apps/sim/tools/rightbrain/index.ts b/apps/sim/tools/rightbrain/index.ts new file mode 100644 index 0000000000..2b004d79e4 --- /dev/null +++ b/apps/sim/tools/rightbrain/index.ts @@ -0,0 +1,3 @@ +import { runTaskTool } from './run_task' + +export { runTaskTool } diff --git a/apps/sim/tools/rightbrain/run_task.ts b/apps/sim/tools/rightbrain/run_task.ts new file mode 100644 index 0000000000..b0bfc9a272 --- /dev/null +++ b/apps/sim/tools/rightbrain/run_task.ts @@ -0,0 +1,91 @@ +import { ToolConfig } from '../types' +import { RightBrainRunTaskParams, RightBrainRunTaskResponse } from './types' + +const isValidUUID = (uuid: string) => + /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i.test(uuid) + +const processUrl = (url: string) => { + const urlInstance = new URL(url) + + const baseUrl = urlInstance.pathname.split('/') + const orgId = baseUrl[4] + const projectId = baseUrl[6] + const taskId = baseUrl[8] + + if (!isValidUUID(orgId) || !isValidUUID(projectId) || !isValidUUID(taskId)) { + throw new Error('Invalid URL format') + } + + return { baseUrl: urlInstance.origin, orgId, projectId, taskId } +} + +export const runTaskTool: ToolConfig = { + id: 'rightbrain_run_task', + name: 'Rightbrain Run Task', + description: + 'Run a Rightbrain AI task. Tasks are created in the Rightbrain app and can be chained together or connected to other apps with Sim Studio to dynamically process inputs, outputs or a combination of both. A task response can be found in the `response.response` object.', + version: '1.0.0', + params: { + url: { + type: 'string', + required: true, + requiredForToolCall: true, + description: 'Rightbrain task URL', + }, + inputs: { + type: 'object', + required: true, + description: 'The task_input JSON object', + }, + apiKey: { + type: 'string', + required: true, + requiredForToolCall: true, + description: 'Your Rightbrain API key', + }, + }, + request: { + url: (params) => { + processUrl(params.url) + return params.url + }, + method: 'POST', + headers: (params) => ({ + Authorization: `Bearer ${params.apiKey}`, + 'Content-Type': 'application/json', + }), + body: (params) => params.inputs, + }, + transformError: (error) => { + const message = + error.response?.detail?.message || error.message || error.error || 'Failed to run task' + + return message + }, + transformResponse: async (response) => { + const data = await response.json() + + if (data?.is_error) { + throw new Error(data.response?.detail?.message || 'Failed to run task') + } + + return { + success: true, + output: { + charged_credits: data.charged_credits, + created: data.created, + id: data.id, + input_processor_timing: data.input_processor_timing, + input_tokens: data.input_tokens, + llm_call_timing: data.llm_call_timing, + output_tokens: data.output_tokens, + response: data.response, + run_data: data.run_data, + task_id: data.task_id, + task_revision_id: data.task_revision_id, + total_tokens: data.total_tokens, + is_error: data.is_error, + }, + } + }, +} diff --git a/apps/sim/tools/rightbrain/types.ts b/apps/sim/tools/rightbrain/types.ts new file mode 100644 index 0000000000..cc91b0c3bf --- /dev/null +++ b/apps/sim/tools/rightbrain/types.ts @@ -0,0 +1,12 @@ +import { type TaskRun } from '@rightbrain/sdk' +import { ToolResponse } from '../types' + +export interface RightBrainRunTaskParams { + url: string + inputs: object + apiKey: string +} + +export interface RightBrainRunTaskResponse extends ToolResponse { + output: TaskRun +} diff --git a/package-lock.json b/package-lock.json index 52f924c63d..fd4b6a3a06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -91,6 +91,7 @@ "@radix-ui/react-toggle": "^1.1.2", "@radix-ui/react-tooltip": "^1.1.6", "@react-email/components": "^0.0.34", + "@rightbrain/sdk": "^0.1.2", "@sentry/nextjs": "^9.15.0", "@vercel/og": "^0.6.5", "@vercel/speed-insights": "^1.2.0", @@ -8210,6 +8211,11 @@ "node": ">= 10" } }, + "node_modules/@rightbrain/sdk": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@rightbrain/sdk/-/sdk-0.1.2.tgz", + "integrity": "sha512-kBcfVMMvB6xCGEdnH8CsRkbq7xAlV2GC2zyhkJaeOWIJnLNzelyC8vFnuDIP4UFi4mPYYFjFdjpCBJ5M6KONeA==" + }, "node_modules/@rollup/plugin-commonjs": { "version": "28.0.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-28.0.1.tgz",