Quick Start
This guide creates a simple agent that answers questions using Groq.
1. Create the project
npx create-moon-wave-app my-agent# Choose: Groq → None (memory) → None (channel) → Yes (install)cd my-agentOr manually:
mkdir my-agent && cd my-agentnpm init -ynpm install @moon-wave/core @moon-wave/providers wrangler2. Write the agent
import { Agent } from '@moon-wave/core';import { GroqProvider } from '@moon-wave/providers';
interface Env { GROQ_API_KEY: string;}
export default { async fetch(request: Request, env: Env): Promise<Response> { const agent = new Agent({ name: 'my-agent', model: { provider: 'groq', model: 'llama-3.3-70b-versatile' }, systemPrompt: 'You are a helpful assistant.', });
const url = new URL(request.url); const input = url.searchParams.get('q') ?? 'Hello!';
const result = await agent.run(input, { sessionId: 'demo', env, });
return new Response(result.output); },};3. Set your API key
# For local devecho "GROQ_API_KEY=your_key_here" > .dev.vars
# For productionnpx wrangler secret put GROQ_API_KEYGet a free Groq API key at console.groq.com.
4. Run locally
npx wrangler devVisit http://localhost:8787?q=What+is+the+capital+of+France?
5. Deploy
npx wrangler deployYour agent is now live at https://my-agent.your-subdomain.workers.dev.