Hashbrown
AI chat and agents for your React or Angular app.
Hashbrown is a headless TypeScript framework. The model renders your
components and calls your tools, in the browser, with any provider.
@hashbrownai/react gives you Hashbrown's hooks and components for React: chat and UI chat hooks, tools, UI kits, and Magic Text rendering.
Getting Started
npm install @hashbrownai/{core,react,openai}
Point Hashbrown at your server:
export function Providers({ children }: { children: React.ReactNode }) {
return <HashbrownProvider url="/run">{children}</HashbrownProvider>;
}
HashbrownProvider accepts:
url(required): Base URL of your Hashbrown API endpoint.middleware(optional): Functions to transform requests before they are sent.transport(optional): Custom AG-UI transport for descendant hooks.
Expose your components and give the model tools. The model only renders components you register, and Skillet validates their props. Tools run in the browser, with your app's state and services.
export function FlightChat({ api }: { api: AircraftApi }) {
const getAircraft = useTool({
name: 'getAircraft',
description: 'List the aircraft on the map',
handler: () => api.list(),
deps: [api],
});
const chat = useUiChat({
system: 'Help users understand the air traffic on the map.',
components: [
exposeComponent(FlightCard, {
description: 'Show one aircraft',
props: { hex: s.string('Aircraft hex code') },
}),
],
tools: [getAircraft],
});
// Components render while the response streams in.
return chat.messages.map((message) =>
message.role === 'assistant' ? message.ui : message.content,
);
}
Docs
Read the React quick start and the React docs.
Connect a Model
Your server keeps the API key and streams from a Hashbrown adapter:
- OpenAI:
@hashbrownai/openai - Anthropic:
@hashbrownai/anthropic - Google Gemini:
@hashbrownai/google - Amazon Bedrock:
@hashbrownai/bedrock - Azure OpenAI:
@hashbrownai/azure - Ollama:
@hashbrownai/ollama - Your own backend
Need a Complete Chat UI?
Hashbrown is headless. threadplane is the full agent UI for React and Angular, built on Hashbrown: threads, approvals, and tool progress. Free and MIT, with enterprise support from the team behind Hashbrown.
Stuck? Ask Brian at https://hashbrown.dev/unstuck.