AI Agent application built with SvelteKit and Mastra framework.
This project demonstrates how to build AI-powered applications using:
# Install dependencies
npm install
# or
bun install
Copy .env.example to .env and configure your environment variables:
cp .env.example .env
Required environment variables:
VITE_OPENAI_API_KEY - OpenAI API key (for direct OpenAI usage)OPENAI_BASE_URL - LiteLLM base URL (optional, for using LiteLLM proxy)AGENT_MODEL or VITE_AGENT_MODEL - Model identifier (default: bedrock/claude-sonnet-4-5)# Start development server
npm run dev
# Start Mastra dev server (if using Mastra CLI)
npm run dev:mastra
Visit http://localhost:5173 to see the application.
# Build for production
npm run build
# Build Mastra (if using Mastra CLI)
npm run build:mastra
# Preview production build
npm run preview
src/
mastra/
agents/ # Agent definitions
index.ts # Mastra instance configuration
routes/ # SvelteKit routes
lib/ # Shared utilities
static/ # Static assets
Agents are defined in src/mastra/agents/. The main Mastra instance is configured in src/mastra/index.ts.
By default, the project uses in-memory LibSQLStore. To persist data, update the storage configuration in src/mastra/index.ts:
storage: new LibSQLStore({
url: "file:./mastra.db", // Change from ":memory:" to file path
}),
Private project