Skip to content
YourGPT AI Copilot Builder SDK

YourGPT AI Copilot transforms your chatbot into a powerful AI agent capable of performing complex tasks and making intelligent decisions. Here are the key tools available in the AI Copilot:

AI Actions allow your copilot to perform specific tasks in your application through custom-defined functions. These actions can be triggered based on user intent and can include user confirmations for critical operations.

The Code Execution tool enables your AI Copilot to safely execute code within your application environment. This feature is perfect for:

  • Running data analysis scripts
  • Performing calculations
  • Generating dynamic content
  • Testing code snippets

The API Integration tool allows your AI Copilot to interact with external services and APIs. Key capabilities include:

  • Making HTTP requests to external services
  • Handling API authentication
  • Processing API responses
  • Error handling and retries

The Web Search tool empowers your AI Copilot to gather real-time information from the internet. Features include:

  • Real-time web searches
  • Content summarization
  • Source verification
  • Safe search filtering
import { YourGPT } from "@yourgpt/widget-web-sdk";
// Initialize the SDK
await YourGPT.init({
widgetId: "your-widget-id",
});
import { YourGPT, useYourGPTChatbot, useAIActions } from "@yourgpt/widget-web-sdk/react";
// Initialize in your main app file (main.tsx or App.tsx)
YourGPT.init({
widgetId: "your-widget-id",
});
import { YourGPT } from "@yourgpt/widget-web-sdk";
// Initialize the SDK
await YourGPT.init({
widgetId: "your-widget-id",
});
// Register an AI Action
const copilot = YourGPT.getInstance();
copilot.registerAIAction("create_user_account", async (data, helpers) => {
const confirmed = await helpers.confirm({
title: "Create Account",
description: "Would you like to create an account with the provided details?"
});
if (confirmed) {
// Execute account creation logic
const result = await createAccount(data.userDetails);
helpers.respond(`Account created successfully for ${result.name}!`);
}
});
import { useAIActions } from "@yourgpt/widget-web-sdk/react";
function AIActionsComponent() {
const aiActions = useAIActions();
useEffect(() => {
// Register multiple actions at once
aiActions.registerActions({
get_time: async (data, helpers) => {
helpers.respond(`Current time: ${new Date().toLocaleString()}`);
},
get_page_url: async (data, helpers) => {
helpers.respond(`Current URL: ${window.location.href}`);
},
take_screenshot: async (data, helpers) => {
const confirmed = await helpers.confirm({
title: "Screenshot",
description: "Take a screenshot of the current page?",
});
if (confirmed) {
// Screenshot logic using html2canvas or similar
helpers.respond("Screenshot taken successfully");
}
},
});
// Cleanup on unmount
return () => {
aiActions.unregisterAction("get_time");
aiActions.unregisterAction("get_page_url");
aiActions.unregisterAction("take_screenshot");
};
}, [aiActions]);
return (
<div>
<h3>Registered AI Actions</h3>
<p>Count: {aiActions.registeredActions.length}</p>
<ul>
{aiActions.registeredActions.map((action) => (
<li key={action}>{action}</li>
))}
</ul>
</div>
);
}

For more examples and detailed documentation, check out our resources: