Created
November 17, 2025 10:25
-
-
Save intellectronica/b22b805ab82f37295f983a16ccd60483 to your computer and use it in GitHub Desktop.
Script for running the Claude Agent SDK from within Windmill
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as wmill from "windmill-client" | |
| import { query } from '@anthropic-ai/claude-agent-sdk'; | |
| Bun.spawnSync(['bun', 'add', '-g', '@anthropic-ai/claude-code'], { | |
| cwd: '/tmp', | |
| env: { ...process.env, BUN_INSTALL: '/tmp/.bun' } | |
| }); | |
| process.env.PATH = `/tmp/.bun/bin:${process.env.PATH}`; | |
| process.env.ANTHROPIC_API_KEY = (await wmill.getResource('u/intellectronica/anthropic')).apiKey; | |
| export async function main() { | |
| const messages = []; | |
| for await (const message of query({ | |
| prompt: "Hi There! You are running in Windmill. Awesome, right?", | |
| options: { 'model': 'haiku' }, | |
| })) { | |
| messages.push(message); | |
| } | |
| return { 'messages': messages }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment