lansonai-agent-sveltekit Svelte Themes

Lansonai Agent Sveltekit

LansonAI Agent - SvelteKit

AI Agent application built with SvelteKit and Mastra framework.

Overview

This project demonstrates how to build AI-powered applications using:

  • SvelteKit - Modern full-stack framework
  • Mastra - AI agent framework for building intelligent applications
  • TypeScript - Type-safe development

Getting Started

Prerequisites

  • Node.js 18+ or Bun
  • npm, yarn, pnpm, or bun package manager

Installation

# Install dependencies
npm install
# or
bun install

Environment Setup

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)

Development

# 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.

Building

# Build for production
npm run build

# Build Mastra (if using Mastra CLI)
npm run build:mastra

# Preview production build
npm run preview

Project Structure

src/
  mastra/
    agents/          # Agent definitions
    index.ts         # Mastra instance configuration
  routes/            # SvelteKit routes
  lib/               # Shared utilities
static/              # Static assets

Features

  • ✅ SvelteKit integration
  • ✅ Mastra agent framework
  • ✅ TypeScript support
  • ✅ Environment variable configuration
  • ✅ LibSQLStore for observability and storage

Configuration

Mastra Agents

Agents are defined in src/mastra/agents/. The main Mastra instance is configured in src/mastra/index.ts.

Storage

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
}),

License

Private project

Top categories

Loading Svelte Themes