Documentation Index Fetch the complete documentation index at: https://docs.runflow.ai/llms.txt
Use this file to discover all available pages before exploring further.
Tools are functions that agents can call to perform specific actions. The SDK uses Zod for type-safe validation.
import { createTool } from '@runflow-ai/sdk' ;
import { z } from 'zod' ;
const weatherTool = createTool ({
id: 'get-weather' ,
description: 'Get current weather for a location' ,
inputSchema: z . object ({
location: z . string (). describe ( 'City name' ),
units: z . enum ([ 'celsius' , 'fahrenheit' ]). optional (),
}),
outputSchema: z . object ({
temperature: z . number (),
condition: z . string (),
}),
execute : async ( params ) => {
// Implement logic
const weather = await fetchWeather ( params . location );
return {
temperature: weather . temp ,
condition: weather . condition ,
};
},
});
const searchDocsTool = createTool ({
id: 'search-docs' ,
description: 'Search in documentation' ,
inputSchema: z . object ({
query: z . string (),
}),
execute : async ( params , toolContext ) => {
// Use Runflow API for vector search
const results = await toolContext . runflow . vectorSearch ( params . query , {
vectorStore: 'docs' ,
k: 5 ,
});
return {
results: results . results . map ( r => r . content ),
};
},
});
const createTicketTool = createTool ({
id: 'create-ticket' ,
description: 'Create a support ticket' ,
inputSchema: z . object ({
subject: z . string (),
description: z . string (),
priority: z . enum ([ 'low' , 'medium' , 'high' ]),
}),
execute : async ( params , toolContext ) => {
// Use connector
const ticket = await toolContext . runflow . connector (
'hubspot' ,
'create-ticket' ,
{
subject: params . subject ,
content: params . description ,
priority: params . priority ,
}
);
return { ticketId: ticket . id };
},
});
Tool Execution Context
The execute function receives two arguments:
params: Validated input parameters (parsed from inputSchema via Zod)
toolContext: An object with { projectId, companyId, userId, sessionId, runflow } for accessing platform APIs
const agent = new Agent ({
name: 'Weather Agent' ,
instructions: 'You help users check the weather.' ,
model: openai ( 'gpt-4o' ),
tools: {
weather: weatherTool ,
searchDocs: searchDocsTool ,
createTicket: createTicketTool ,
},
});
const result = await agent . process ({
message: 'What is the weather in São Paulo?' ,
});
The SDK includes ready-to-use tools that you can add to any agent:
import { createWebSearchTool , createScheduleTools } from '@runflow-ai/sdk' ;
const agent = new Agent ({
name: 'My Agent' ,
model: openai ( 'gpt-4o' ),
tools: {
search: createWebSearchTool ({ provider: 'tavily' , apiKey: '...' }),
... createScheduleTools (),
},
});
Web Search — Search the internet with Tavily, Exa, or Serper
Schedule — Create, list, update, and cancel scheduled executions
Next Steps
Web Search Add internet search to your agents
Schedule Create scheduled executions
HTTP Utilities Use HTTP helpers in tools
Connectors Use built-in connectors