Skip to content

Quick Start

  1. Import Viber

    import { Agent, Space, streamText } from 'viber';
  2. Define an Agent

    const agent = new Agent({
    name: 'Assistant',
    model: 'openai:gpt-4o',
    systemPrompt: 'You are a helpful assistant.',
    });
  3. Stream a Response

    const result = await agent.streamText({
    messages: [{ role: 'user', content: 'Hello!' }],
    });
    for await (const chunk of result.textStream) {
    process.stdout.write(chunk);
    }
import { useAgent } from 'viber/react';
function Chat() {
const { messages, sendMessage } = useAgent({
model: 'openai:gpt-4o',
});
return (
<div>
{messages.map((m) => (
<p key={m.id}>{m.content}</p>
))}
</div>
);
}
  • Learn about Agents and how to configure them
  • Explore the Tool Framework for extending agent capabilities
  • Understand Spaces for organizing workspaces