@layla-network/sdk
v0.1.23
Published
Layla custom mini-apps SDK
Downloads
3,592
Readme
Layla SDK
Project Links
- Docs - mini-app packaging guidance and the SDK API reference.
- SDK source - the TypeScript source for
@layla-network/sdk. - Examples - sample Layla mini-apps showing chat, chess, tarot, and character generation workflows.
- Agent skill - a packaged skill that helps other coding agents understand how to create Layla mini-apps with this SDK.
Getting Started
Install the SDK from npm:
npm install @layla-network/sdkCreate a client in a Layla mini-app:
import { LaylaSDK } from '@layla-network/sdk';
const layla = new LaylaSDK();The SDK is designed for Layla's WebView runtime. It does not require an API key, base URL, or direct network LLM endpoint; requests are sent through the Layla host bridge.
Using the SDK with Agents
This SDK contains an agent skill that can be imported into other agents to enable Layla mini-app creation. The skill provides tools that wrap the SDK methods, allowing agents to generate mini-apps in response to user requests.
An agent skill bundle is generated on every release: https://github.com/l3utterfly/layla-sdk/releases?q=agent+skill&expanded=true
Download the zip file for the latest skill release and import it into your agent to get started. The skill includes example prompts and tool calls to help your agent learn how to use the SDK.
Example prompt with Claude Code:
Create a Layla mini-app using the layla-sdk skill. In the mini-app, you can play truth or dare with any character of your choosing, there should be a button next to each chat message to generate an image using the contents of the message as the prompt (including the character description)This skill can be imported into any coding agent, such as Codex, Claude Code, or OpenCode etc.
Recommended Project Structure for more complex mini-apps
If you want to create more complex mini-apps with multiple source files, states, and pages. We recommend using a framework like Vite to build a ReactJS or VueJS app. You can then bundle the app into a single index.html file that can be imported into Layla as a mini-app.
Here is a starter project: https://github.com/l3utterfly/layla-miniapp-template
Open the project in any coding agent with the layla-sdk skill imported, and ask it to build out the mini-app with the SDK.
Releases
Each release contains:
- SDK source code as a zip file. The SDK package is also published to npm automatically.
- Example mini-apps as a zip file that can be imported into Layla directly.
- An agent skills zip file that can be imported into other agents so they can create Layla mini-apps for you.
Learn More
- Read the mini-apps overview to understand app packaging, metadata, and the Layla WebView runtime.
- Read the SDK API reference for imports, chat completions, streaming, chat sessions, session history, message saves, scheduled chat messages, memory list/top/save APIs, personas, characters, image generation, file utilities, abort handling, and errors.
- Browse the examples guide to choose a starting mini-app.
Layla App
Visit the official Layla website: https://www.layla-network.ai/
Download the Layla app:
