Skip to content

Commit d97ecea

Browse files
authored
feat(tools): added thinking tool, hiddenFromSidebar param (#230)
* add thinking tool and block * add hiddenFromSidebar for blocks that we want to be accessible to agents but hidden as standalone blocks
1 parent 47ad2ba commit d97ecea

File tree

9 files changed

+134
-48
lines changed

9 files changed

+134
-48
lines changed

sim/app/w/[id]/components/toolbar/toolbar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ export function Toolbar() {
1919
const filteredBlocks = !searchQuery.trim() ? getBlocksByCategory(activeTab) : getAllBlocks()
2020

2121
return filteredBlocks.filter((block) => {
22-
if (block.type === 'starter') return false
22+
if (block.type === 'starter' || block.hiddenFromSidebar) return false
23+
2324
return (
2425
!searchQuery.trim() ||
2526
block.name.toLowerCase().includes(searchQuery.toLowerCase()) ||

sim/blocks/blocks/thinking.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { BrainIcon } from '@/components/icons'
2+
import { ToolResponse } from '@/tools/types'
3+
import { BlockConfig } from '../types'
4+
5+
interface ThinkingToolResponse extends ToolResponse {
6+
output: {
7+
acknowledgedThought: string
8+
}
9+
}
10+
11+
export const ThinkingBlock: BlockConfig<ThinkingToolResponse> = {
12+
type: 'thinking',
13+
name: 'Thinking',
14+
description: 'Forces model to outline its thought process.',
15+
longDescription:
16+
'Adds a step where the model explicitly outlines its thought process before proceeding. This can improve reasoning quality by encouraging step-by-step analysis.',
17+
category: 'tools',
18+
bgColor: '#181C1E',
19+
icon: BrainIcon,
20+
hiddenFromSidebar: true,
21+
22+
subBlocks: [
23+
{
24+
id: 'thought',
25+
title: 'Thought Process / Instruction',
26+
type: 'long-input',
27+
layout: 'full',
28+
placeholder: 'Describe the step-by-step thinking process here...',
29+
hidden: true,
30+
},
31+
],
32+
33+
inputs: {
34+
thought: {
35+
type: 'string',
36+
required: true,
37+
description: 'The detailed thought process or instruction for the model.',
38+
},
39+
},
40+
41+
outputs: {
42+
response: {
43+
type: {
44+
acknowledgedThought: 'string',
45+
},
46+
},
47+
},
48+
49+
tools: {
50+
access: ['thinking_tool'],
51+
},
52+
}

sim/blocks/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { GoogleDocsBlock } from './blocks/docs'
88
import { GoogleDriveBlock } from './blocks/drive'
99
import { EvaluatorBlock } from './blocks/evaluator'
1010
import { ExaBlock } from './blocks/exa'
11-
import { MistralParseBlock } from './blocks/mistral-parse'
1211
import { FileBlock } from './blocks/file'
1312
import { FirecrawlBlock } from './blocks/firecrawl'
1413
import { FunctionBlock } from './blocks/function'
@@ -17,6 +16,7 @@ import { GmailBlock } from './blocks/gmail'
1716
// import { GuestyBlock } from './blocks/guesty'
1817
import { ImageGeneratorBlock } from './blocks/image-generator'
1918
import { JinaBlock } from './blocks/jina'
19+
import { MistralParseBlock } from './blocks/mistral-parse'
2020
import { NotionBlock } from './blocks/notion'
2121
import { OpenAIBlock } from './blocks/openai'
2222
import { PerplexityBlock } from './blocks/perplexity'
@@ -29,6 +29,7 @@ import { SlackBlock } from './blocks/slack'
2929
import { StarterBlock } from './blocks/starter'
3030
import { SupabaseBlock } from './blocks/supabase'
3131
import { TavilyBlock } from './blocks/tavily'
32+
import { ThinkingBlock } from './blocks/thinking'
3233
import { TranslateBlock } from './blocks/translate'
3334
import { TwilioSMSBlock } from './blocks/twilio'
3435
import { TypeformBlock } from './blocks/typeform'
@@ -77,6 +78,7 @@ export {
7778
TwilioSMSBlock,
7879
ImageGeneratorBlock,
7980
TypeformBlock,
81+
ThinkingBlock,
8082
}
8183

8284
// Registry of all block configurations, alphabetically sorted
@@ -88,7 +90,6 @@ const blocks: Record<string, BlockConfig> = {
8890
confluence: ConfluenceBlock,
8991
evaluator: EvaluatorBlock,
9092
exa: ExaBlock,
91-
mistral_parse: MistralParseBlock,
9293
firecrawl: FirecrawlBlock,
9394
file: FileBlock,
9495
function: FunctionBlock,
@@ -100,6 +101,7 @@ const blocks: Record<string, BlockConfig> = {
100101
// guesty: GuestyBlock,
101102
image_generator: ImageGeneratorBlock,
102103
jina: JinaBlock,
104+
mistral_parse: MistralParseBlock,
103105
notion: NotionBlock,
104106
openai: OpenAIBlock,
105107
perplexity: PerplexityBlock,
@@ -111,6 +113,7 @@ const blocks: Record<string, BlockConfig> = {
111113
starter: StarterBlock,
112114
supabase: SupabaseBlock,
113115
tavily: TavilyBlock,
116+
thinking: ThinkingBlock,
114117
translate: TranslateBlock,
115118
twilio_sms: TwilioSMSBlock,
116119
typeform: TypeformBlock,

sim/blocks/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export interface BlockConfig<T extends ToolResponse = ToolResponse> {
152152
}
153153
}
154154
}
155+
hiddenFromSidebar?: boolean
155156
}
156157

157158
// Output configuration rules

sim/components/icons.tsx

Lines changed: 16 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,48 +1359,6 @@ export const CrunchbaseIcon = (props: SVGProps<SVGSVGElement>) => (
13591359
</svg>
13601360
)
13611361

1362-
export function BrainIcon(props: SVGProps<SVGSVGElement>) {
1363-
return (
1364-
<svg
1365-
{...props}
1366-
width="30"
1367-
height="30"
1368-
viewBox="0 0 30 30"
1369-
fill="none"
1370-
xmlns="http://www.w3.org/2000/svg"
1371-
>
1372-
<path
1373-
d="M20.0553 16.4443C18.7145 16.4443 17.4286 16.977 16.4805 17.9251C15.5324 18.8732 14.9998 20.1591 14.9998 21.4999M14.9998 21.4999V22.9443M14.9998 21.4999C14.9998 20.1591 14.4671 18.8732 13.519 17.9251C12.5709 16.977 11.285 16.4443 9.94423 16.4443M14.9998 22.9443C14.9998 24.2852 15.5324 25.5711 16.4805 26.5192C17.4286 27.4673 18.7145 27.9999 20.0553 27.9999C21.3962 27.9999 22.6821 27.4673 23.6302 26.5192C24.5783 25.5711 25.1109 24.2852 25.1109 22.9443V20.3443M14.9998 22.9443C14.9998 24.2852 14.4671 25.5711 13.519 26.5192C12.5709 27.4673 11.285 27.9999 9.94423 27.9999C8.60341 27.9999 7.31751 27.4673 6.36941 26.5192C5.42131 25.5711 4.88867 24.2852 4.88867 22.9443V20.3443"
1374-
stroke="currentColor"
1375-
strokeWidth="2.5"
1376-
strokeLinecap="round"
1377-
strokeLinejoin="round"
1378-
/>
1379-
<path
1380-
d="M22.9449 20.7779C24.2857 20.7779 25.5716 20.2452 26.5197 19.2971C27.4678 18.349 28.0004 17.0631 28.0004 15.7223C28.0004 14.3815 27.4678 13.0956 26.5197 12.1475C25.5716 11.1994 24.2857 10.6667 22.9449 10.6667H22.2227"
1381-
stroke="currentColor"
1382-
strokeWidth="2.5"
1383-
strokeLinecap="round"
1384-
strokeLinejoin="round"
1385-
/>
1386-
<path
1387-
d="M25.1111 11.1V7.05556C25.1111 5.71474 24.5785 4.42884 23.6304 3.48074C22.6823 2.53264 21.3964 2 20.0556 2C18.7147 2 17.4288 2.53264 16.4807 3.48074C15.5326 4.42884 14.9998 5.71474 14.9998 7.05556V21.5"
1388-
stroke="currentColor"
1389-
strokeWidth="2.5"
1390-
strokeLinecap="round"
1391-
strokeLinejoin="round"
1392-
/>
1393-
<path
1394-
d="M4.88867 11.1V7.05556C4.88867 5.71474 5.42131 4.42884 6.36941 3.48074C7.31751 2.53264 8.60341 2 9.94423 2C11.285 2 12.5709 2.53264 13.519 3.48074C14.4671 4.42884 14.9998 5.71474 14.9998 7.05556V21.5"
1395-
stroke="currentColor"
1396-
strokeWidth="2.5"
1397-
strokeLinecap="round"
1398-
strokeLinejoin="round"
1399-
/>
1400-
</svg>
1401-
)
1402-
}
1403-
14041362
export function InputIcon(props: SVGProps<SVGSVGElement>) {
14051363
return (
14061364
<svg
@@ -1866,3 +1824,19 @@ export function MistralIcon(props: SVGProps<SVGSVGElement>) {
18661824
</svg>
18671825
)
18681826
}
1827+
1828+
export function BrainIcon(props: SVGProps<SVGSVGElement>) {
1829+
return (
1830+
<svg {...props} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" fill="currentColor">
1831+
<title>Brain</title>
1832+
<g id="Brain">
1833+
<path d="M11,5.34c-.12,1,.26.66-1,.66A7,7,0,0,0,4.85,17.75,7,7,0,0,0,2.62,28.48,12.14,12.14,0,0,0,.06,37.22C1,46.59,12.33,51.56,19.31,45A11.66,11.66,0,0,0,23,36.51V6.22C23-1.57,11.86-2.14,11,5.34Zm-.55,40.55a8.89,8.89,0,0,1-4.78-2.18l.42-.42a2.1,2.1,0,0,1,2.42-.4,1,1,0,0,0,.9-1.78c-2-1-1.24.83-2-3.11-.61-3,1.55-4.14,0-4.89-1.79-.9-2.38,3.32-2,5.28.79,4,.85,1.7-1.19,3.94a10,10,0,0,1-.13-12.5c1.51,1,4.86,2,4.86.17a1,1,0,0,0-1-1c-5.79,0-6.94-8.33-1.27-9.82C8,19.87,11,20.73,11,19a1,1,0,0,0-1-1,5,5,0,1,1,1.44-9.77C13,12,18,13,18,11a1,1,0,0,0-1-1,4,4,0,1,1,4-3.78v9.37l-1.16,1.15a3.42,3.42,0,0,1-4.29.43,1,1,0,0,0-1.38.28c-1.12,1.68,3.7,3.68,6.83.92V36.51A9.3,9.3,0,0,1,10.49,45.89Z" />
1834+
<path d="M16.21,23.79a3.14,3.14,0,0,0-4.42,0c-1,1-2-.42-3.08-1.5a1,1,0,0,0-1.42,1.42l.86.85-1.47.49A1,1,0,0,0,7.32,27L10.18,26c2.71.74,3.26-2.15,4.61-.79l2.5,2.5a1,1,0,0,0,1.42-1.42Z" />
1835+
<path d="M17,33H16a3,3,0,0,0-3,3,1,1,0,0,1-1,1H11a1,1,0,0,0,0,2h1a3,3,0,0,0,3-3,1,1,0,0,1,1-1h1A1,1,0,0,0,17,33Z" />
1836+
<path d="M45.36,28.49a7,7,0,0,0-2.21-10.74A7,7,0,0,0,38,6c-1.28,0-.93.35-1-.63A6,6,0,0,0,31,0a6.13,6.13,0,0,0-6,6.22V36.51C25,42.89,30.26,48.4,36.82,48A12,12,0,0,0,45.36,28.49Zm-1.65,13.8A4.92,4.92,0,0,0,42,41c.55-2.79,1.21-4.79-.13-7.47a1,1,0,0,0-1.78.9c1,2.06.45,3.65-.07,6.25-3.33.28-1.92,2.85-.59,2.19s2.33.34,2.88.84A9.28,9.28,0,0,1,27,36.51V18.37c3.12,2.75,8,.76,6.83-.92a1,1,0,0,0-1.38-.28,3.42,3.42,0,0,1-4.29-.43L27,15.59V6.22A4,4,0,1,1,31,10a1,1,0,0,0-1,1c0,2.05,5.07,1,6.57-2.78A5,5,0,1,1,38,18a1,1,0,0,0,0,2,7,7,0,0,0,3.27-.82C47,20.68,45.73,29,40,29a1,1,0,0,0,0,2,6.89,6.89,0,0,0,3.86-1.17C48.62,35.85,44,42.55,43.71,42.29Z" />
1837+
<path d="M41,27a1,1,0,0,0,.32-1.95l-1.47-.49.86-.85a1,1,0,0,0-1.42-1.42c-1.09,1.09-2.07,2.51-3.08,1.5a3.14,3.14,0,0,0-4.42,0l-2.5,2.5A1,1,0,0,0,30,28c.56,0,.54-.13,3.21-2.79,1.38-1.38,1.86,1.54,4.61.79C40.92,27,40.78,27,41,27Z" />
1838+
<path d="M37,37H36a1,1,0,0,1-1-1,3,3,0,0,0-3-3H31a1,1,0,0,0,0,2h1a1,1,0,0,1,1,1,3,3,0,0,0,3,3h1A1,1,0,0,0,37,37Z" />
1839+
</g>
1840+
</svg>
1841+
)
1842+
}

sim/tools/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ import { sheetsReadTool, sheetsUpdateTool, sheetsWriteTool } from './sheets'
4444
import { slackMessageTool } from './slack/message'
4545
import { supabaseInsertTool, supabaseQueryTool } from './supabase'
4646
import { tavilyExtractTool, tavilySearchTool } from './tavily'
47+
import { thinkingTool } from './thinking/thinking'
4748
import { sendSMSTool } from './twilio/send'
4849
import { typeformFilesTool, typeformInsightsTool, typeformResponsesTool } from './typeform'
4950
import { OAuthTokenPayload, ToolConfig, ToolResponse } from './types'
50-
import { formatRequestParams, validateToolRequest, transformTable } from './utils'
51+
import { formatRequestParams, transformTable, validateToolRequest } from './utils'
5152
import { visionTool } from './vision/vision'
5253
import { whatsappSendMessageTool } from './whatsapp'
5354
import { xReadTool, xSearchTool, xUserTool, xWriteTool } from './x'
@@ -122,6 +123,7 @@ export const tools: Record<string, ToolConfig> = {
122123
airtable_list_records: airtableListRecordsTool,
123124
airtable_update_record: airtableUpdateRecordTool,
124125
mistral_parser: mistralParserTool,
126+
thinking_tool: thinkingTool,
125127
}
126128

127129
// Get a tool by its ID
@@ -345,7 +347,7 @@ export async function executeTool(
345347
const endTime = new Date()
346348
const endTimeISO = endTime.toISOString()
347349
const duration = endTime.getTime() - startTime.getTime()
348-
350+
349351
// Apply post-processing if available and not skipped
350352
if (tool.postProcess && directResult.success && !skipPostProcess) {
351353
try {
@@ -370,7 +372,7 @@ export async function executeTool(
370372
}
371373
}
372374
}
373-
375+
374376
return {
375377
...directResult,
376378
timing: {

sim/tools/thinking/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { thinkingTool } from './thinking'
2+
3+
export { thinkingTool }

sim/tools/thinking/thinking.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { ToolConfig } from '../types'
2+
import { ThinkingToolParams, ThinkingToolResponse } from './types'
3+
4+
export const thinkingTool: ToolConfig<ThinkingToolParams, ThinkingToolResponse> = {
5+
id: 'thinking_tool',
6+
name: 'Thinking Tool',
7+
description:
8+
'Processes a provided thought/instruction, making it available for subsequent steps.',
9+
version: '1.0.0',
10+
11+
// Define the input parameter
12+
params: {
13+
thought: {
14+
type: 'string',
15+
required: true,
16+
description:
17+
'The thought process or instruction provided by the user in the Thinking Step block.',
18+
},
19+
},
20+
21+
// Use directExecution as no external HTTP call is needed
22+
directExecution: async (params: ThinkingToolParams): Promise<ThinkingToolResponse> => {
23+
// Simply acknowledge the thought by returning it in the output
24+
return {
25+
success: true,
26+
output: {
27+
acknowledgedThought: params.thought,
28+
},
29+
}
30+
},
31+
32+
// Request configuration is not needed due to directExecution, but the type requires it.
33+
// Provide minimal valid configuration.
34+
request: {
35+
url: '', // Not used
36+
method: 'POST', // Not used
37+
headers: () => ({}), // Not used
38+
},
39+
}

sim/tools/thinking/types.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { ToolResponse } from '../types'
2+
3+
export interface ThinkingToolParams {
4+
thought: string
5+
}
6+
7+
export interface ThinkingToolResponse extends ToolResponse {
8+
output: {
9+
acknowledgedThought: string
10+
}
11+
}

0 commit comments

Comments
 (0)