docs/marketplace/ts-sdks/genkit.mdx
pnpm add genkit @agentic/genkit @agentic/platform-tool-client
bun add genkit @agentic/genkit @agentic/platform-tool-client
yarn add genkit @agentic/genkit @agentic/platform-tool-client
This example uses the @agentic/search tool.
import 'dotenv/config'
import { createGenkitTools } from '@agentic/genkit'
import { AgenticToolClient } from '@agentic/platform-tool-client'
import { genkit } from 'genkit'
import { gpt4oMini, openAI } from 'genkitx-openai'
async function main() {
const searchTool = await AgenticToolClient.fromIdentifier('@agentic/search')
const ai = genkit({
plugins: [openAI()]
})
const result = await ai.generate({
model: gpt4oMini,
tools: createGenkitTools(ai, searchTool),
system: 'You are a helpful assistant. Be as concise as possible.',
prompt: 'What is the weather in San Francisco?'
})
console.log(result)
}
await main()
Note that OpenAI is not necessary to use Agentic; this is just an example.
<CodeGroup> ```bash npm npm install genkitx-openai dotenv ```pnpm add genkitx-openai dotenv
bun add genkitx-openai dotenv
yarn add genkitx-openai dotenv
You can view the full source for this example here: https://github.com/transitive-bullshit/agentic/tree/main/examples/ts-sdks/genkit
<Info> You'll need an [OpenAI API key](https://platform.openai.com/docs/quickstart) to run this example. Store it in a local `.env` file as `OPENAI_API_KEY`. </Info> <Info> The [`@agentic/search`](https://agentic.so/marketplace/projects/@agentic/search) tool comes with a generous free tier, but once that runs out, you'll need to sign up for a paid plan and add an `AGENTIC_API_KEY` to your `.env` file. </Info>git clone [email protected]:transitive-bullshit/agentic.git
cd agentic
pnpm install
pnpm build
echo 'OPENAI_API_KEY=your-key' >> .env
npx tsx examples/ts-sdks/genkit/bin/weather.ts