Build and execute your first AI prompt with Agentsmith in 5 minutes.
This guide will walk you through creating, syncing, and executing your first prompt with Agentsmith. By the end, you'll have a simple "Hello, World!" prompt running in your local development environment.
Create a file named index.ts and add the following code. This script will initialize the SDK, fetch the prompt from your local filesystem, and execute it.
import { AgentsmithClient } from '@agentsmith-app/sdk';import { Agency } from './agentsmith/agentsmith.types';// Get these from your Agentsmith project page in the Studioconst sdkApiKey = process.env.AGENTSMITH_API_KEY!;const projectId = process.env.AGENTSMITH_PROJECT_ID!;async function main() { const client = new AgentsmithClient<Agency>(sdkApiKey, projectId); console.log("Fetching prompt 'hello-world'..."); const helloWorldPrompt = await client.getPrompt('hello-world'); console.log("Executing prompt with name: 'World'"); const { content } = await helloWorldPrompt.execute({ name: 'World', }); console.log('✅ AI Response:', content); await client.shutdown();}main().catch(console.error);