The TypeScript Framework
for AI Applications
Build production-grade AI apps with a complete toolkit: Runtime Engine, Agent Patterns, Server-Driven UI, and full React integration.
Build production-grade AI apps with a complete toolkit: Runtime Engine, Agent Patterns, Server-Driven UI, and full React integration.
Melony is organized as a monorepo with focused packages that work together seamlessly.
Core types, utilities, event definitions, and protocol specifications.
npm install @melony/coreAction execution engine, async generators, and approval flow management.
npm install @melony/runtimeHigh-level agent abstractions, brain patterns, and HTTP handlers.
npm install @melony/agentsFramework-agnostic client for connecting to Melony runtimes.
npm install @melony/clientReact components, hooks, and Server-Driven UI renderer.
npm install @melony/reactA complete toolkit for building the next generation of AI applications.
Execute actions as async generators with automatic chaining.
High-level agent abstraction with brain pattern and HTTP handlers.
Render UI components directly from server events.
Full TypeScript support with Zod validation for all actions.
Core packages work with any JavaScript framework.
Built-in approval flows for actions requiring confirmation.
Ready-to-use React components and hooks.
npm install @melony/react @melony/runtime @melony/agents @melony/client// lib/actions.ts
import { defineAction } from "@melony/runtime";
import z from "zod";
export const getWeather = defineAction({
name: "getWeather",
paramsSchema: z.object({ city: z.string() }),
execute: async function* (params) {
const weather = await fetch(`/api/weather?city=${params.city}`);
const data = await weather.json();
yield {
type: "text",
data: { content: `Weather in ${params.city}: ${data.temp}°F` },
};
},
});// app/api/chat/route.ts
import { defineAgent, createAgentHandler } from "@melony/agents";
import { getWeather } from "@/lib/actions";
import { agentBrain } from "@/lib/agent-brain";
const agent = defineAgent({
name: "Assistant",
actions: { getWeather },
brain: agentBrain,
});
export const POST = createAgentHandler(agent);// app/page.tsx
"use client";
import { MelonyStoreProvider, Chat } from "@melony/react";
export default function Home() {
return (
<MelonyStoreProvider api="/api/chat">
<Chat />
</MelonyStoreProvider>
);
}Join the community of developers building the next generation of AI applications with Melony.