Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Fix examples

haxzie23846256f5ca
diff --git a/ts/examples/mastra/src/index.ts b/ts/examples/mastra/src/index.ts
index fbc19ed67..425b3af3c 100644
--- a/ts/examples/mastra/src/index.ts
+++ b/ts/examples/mastra/src/index.ts
@@ -27,21 +27,21 @@ const composio = new Composio({
* Attach beforeExecute and afterExecute hooks to the tools for logging
*/
const tools = await composio.tools.get('default', 'HACKERNEWS_GET_USER', {
- modifySchema: (toolSlug, toolkitSlug, schema) => {
+ modifySchema: ({ toolSlug, toolkitSlug, schema }) => {
console.log(
`πŸ”„ Modifying schema for tool ${toolSlug}/${toolkitSlug} with schema ${JSON.stringify(schema)}`
);
return schema;
},
- beforeExecute: (toolSlug, toolkitSlug, input) => {
- console.log(`πŸ”„ Executing tool ${toolSlug}/${toolkitSlug} with input ${JSON.stringify(input)}`);
- return input;
+ beforeExecute: ({ toolSlug, toolkitSlug, params }) => {
+ console.log(`πŸ”„ Executing tool ${toolSlug}/${toolkitSlug} with input ${JSON.stringify(params)}`);
+ return params;
},
- afterExecute: (toolSlug, toolkitSlug, output) => {
+ afterExecute: ({ toolSlug, toolkitSlug, result }) => {
console.log(
- `βœ… Tool ${toolSlug}/${toolkitSlug} executed successfully with output ${JSON.stringify(output)}`
+ `βœ… Tool ${toolSlug}/${toolkitSlug} executed successfully with output ${JSON.stringify(result)}`
);
- return output;
+ return result;
},
});
diff --git a/ts/examples/modifiers/src/index.ts b/ts/examples/modifiers/src/index.ts
index 0190043c2..24f64f204 100644
--- a/ts/examples/modifiers/src/index.ts
+++ b/ts/examples/modifiers/src/index.ts
@@ -10,14 +10,14 @@ const composio = new Composio({
const tools = await composio.tools.get('default', 'HACKERNEWS_GET_USER', {
// toolkit slug too
- modifySchema: (toolSlug, toolkitSlug, toolSchema) => {
+ modifySchema: ({ toolSlug, toolkitSlug, schema }) => {
if (toolSlug === 'HACKERNEWS_GET_USER') {
- toolSchema = {
- ...toolSchema,
+ schema = {
+ ...schema,
inputParameters: {
type: 'object',
properties: {
- ...toolSchema.inputParameters?.properties,
+ ...schema.inputParameters?.properties,
userId: {
type: 'string',
description: 'The user ID to get the user for',
@@ -27,7 +27,7 @@ const tools = await composio.tools.get('default', 'HACKERNEWS_GET_USER', {
};
}
- return toolSchema;
+ return schema;
},
});
@@ -47,17 +47,17 @@ const agenticTools = await vercel.tools.get(
// what is the type error i am getting here?
{ tools: ['HACKERNEWS_GET_USER'] },
{
- afterExecute: (toolSlug, toolkitSlug, result) => {
+ afterExecute: ({ toolSlug, toolkitSlug, result }) => {
// modify the result
return result;
},
- beforeExecute: (toolSlug, toolkitSlug, params) => {
+ beforeExecute: ({ toolSlug, toolkitSlug, params }) => {
// modify the params
return params;
},
- modifySchema: (toolSlug, toolkitSlug, toolSchema) => {
+ modifySchema: ({ toolSlug, toolkitSlug, schema }) => {
// modify the tool schema
- return toolSchema;
+ return schema;
},
}
);
diff --git a/ts/examples/openai/src/agents-api/index.ts b/ts/examples/openai/src/agents-api/index.ts
index 4ce303324..522d1ec7f 100644
--- a/ts/examples/openai/src/agents-api/index.ts
+++ b/ts/examples/openai/src/agents-api/index.ts
@@ -10,11 +10,11 @@ const composio = new Composio({
console.log(`πŸ”„ Fetching tools from composio...`);
const tools = await composio.tools.get('default', 'HACKERNEWS_GET_USER', {
- beforeExecute: async (toolSlug, toolkitSlug, params) => {
+ beforeExecute: async ({ toolSlug, toolkitSlug, params }) => {
console.log(`πŸ”„ Executing tool ${toolSlug} from toolkit ${toolkitSlug}...`);
return params;
},
- afterExecute: async (toolSlug, toolkitSlug, result) => {
+ afterExecute: async ({ toolSlug, toolkitSlug, result }) => {
console.log(`βœ… Tool ${toolSlug} executed`);
return result;
},
diff --git a/ts/examples/openai/src/agents.ts b/ts/examples/openai/src/agents.ts
deleted file mode 100644
index 5772a0122..000000000
--- a/ts/examples/openai/src/agents.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { Composio } from '@composio/core';
-import { Agent, webSearchTool, fileSearchTool } from '@openai/agents';
-
-const composio = new Composio();
-
-const tools = await composio.tools.get('default', 'HACKERNEWS_GET_USER');
-
-const agent = new Agent({
- name: 'Travel assistant',
- tools: tools,
-});
diff --git a/ts/examples/openai/src/reponses-api/index.ts b/ts/examples/openai/src/reponses-api/index.ts
index 7c5ffe6ae..89bc03e4e 100644
--- a/ts/examples/openai/src/reponses-api/index.ts
+++ b/ts/examples/openai/src/reponses-api/index.ts
@@ -26,11 +26,11 @@ const modelInputs = await composio.provider.handleResponse(
initialResponse,
{},
{
- beforeExecute: async (toolSlug, toolkitSlug, params) => {
+ beforeExecute: async ({ toolSlug, toolkitSlug, params }) => {
console.log(`πŸ”„ Executing tool ${toolSlug} from toolkit ${toolkitSlug}...`);
return params;
},
- afterExecute: async (toolSlug, toolkitSlug, result) => {
+ afterExecute: async ({ toolSlug, toolkitSlug, result }) => {
console.log(`βœ… Tool ${toolSlug} executed`);
return result;
},
diff --git a/ts/examples/telemetry/.env.example b/ts/examples/telemetry/.env.example
deleted file mode 100644
index ad0f7ed62..000000000
--- a/ts/examples/telemetry/.env.example
+++ /dev/null
@@ -1,2 +0,0 @@
-COMPOSIO_API_KEY=
-OPENAI_API_KEY=
\ No newline at end of file
diff --git a/ts/examples/telemetry/README.md b/ts/examples/telemetry/README.md
deleted file mode 100644
index 08e1ab65a..000000000
--- a/ts/examples/telemetry/README.md
+++ /dev/null
@@ -1,75 +0,0 @@
-# Vercel Example with Composio SDK
-
-This example demonstrates how to use the Composio SDK with Vercel's AI SDK to create an AI-powered application that can interact with HackerNews data.
-
-## Features
-
-- Integration with Composio SDK and Vercel AI SDK
-- HackerNews front page summarization using GPT-4
-- Streaming AI responses
-- TypeScript support
-
-## Prerequisites
-
-- [Node.js](https://nodejs.org/) (Latest LTS version recommended)
-- [pnpm](https://pnpm.io/) (v10.8.0 or later)
-- Composio API Key
-- OpenAI API Key
-
-## Getting Started
-
-1. Clone the repository and navigate to the example directory:
-
-```bash
-cd examples/vercel
-```
-
-2. Install dependencies:
-
-```bash
-pnpm install
-```
-
-3. Copy the `.env.example` file to `.env` and fill in your API keys:
-
-```bash
-cp .env.example .env
-```
-
-4. Update the `.env` file with your credentials:
-
-```env
-COMPOSIO_API_KEY=your_composio_api_key
-OPENAI_API_KEY=your_openai_api_key
-```
-
-5. Start the development server:
-
-```bash
-pnpm start
-```
-
-## How It Works
-
-This example showcases how to:
-
-1. Initialize the Composio SDK with the Vercel provider
-2. Use the HackerNews tool to fetch front page data
-3. Generate AI responses using OpenAI's GPT-4
-4. Handle tool calls and results in a chat-like interface
-
-## Dependencies
-
-- `@composio/core`: Core Composio SDK
-- `@composio/vercel`: Vercel integration for Composio
-- `@ai-sdk/openai`: OpenAI integration
-- `ai`: Vercel's AI SDK
-- TypeScript for type safety
-
-## License
-
-ISC
-
-## Support
-
-For questions and support, please refer to the [Composio documentation](https://docs.composio.dev) or open an issue in the repository.
diff --git a/ts/examples/telemetry/package.json b/ts/examples/telemetry/package.json
deleted file mode 100644
index acb489a70..000000000
--- a/ts/examples/telemetry/package.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name": "telemetry-example",
- "private": true,
- "version": "0.1.10-alpha.0",
- "description": "",
- "main": "src/index.ts",
- "scripts": {
- "start": "COMPOSIO_LOG_LEVEL=debug NODE_ENV=test bun src/index.ts",
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "keywords": [],
- "author": "",
- "license": "ISC",
- "packageManager": "[email protected]",
- "dependencies": {
- "@ai-sdk/openai": "^1.3.16",
- "@composio/core": "workspace:*",
- "@composio/vercel": "workspace:*",
- "ai": "^4.3.8"
- },
- "devDependencies": {
- "@types/bun": "^1.2.9",
- "typescript": "^5.8.3"
- }
-}
diff --git a/ts/examples/telemetry/src/index.ts b/ts/examples/telemetry/src/index.ts
deleted file mode 100644
index 6ced3874a..000000000
--- a/ts/examples/telemetry/src/index.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { Composio, ConsoleTelemetryTransport } from '@composio/core';
-
-/**
- * Non agentic provider
- */
-const composio = new Composio({
- apiKey: process.env.COMPOSIO_API_KEY,
-});
-
-const tools = await composio.tools.get('default', 'HACKERNEWS_GET_USER');
-
-console.log(tools);
diff --git a/ts/examples/telemetry/tsconfig.json b/ts/examples/telemetry/tsconfig.json
deleted file mode 100644
index ad82940d5..000000000
--- a/ts/examples/telemetry/tsconfig.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "compilerOptions": {
- "target": "ESNext",
- "module": "ESNext",
- "declaration": true,
- "declarationDir": "./dist",
- "outDir": "./dist",
- "rootDir": "./src",
- "strict": true,
- "esModuleInterop": true,
- "moduleResolution": "node",
- "skipLibCheck": true
- },
- "include": ["src"]
-}