Quickstart

Building your own text, voice or video AI is easy. In this example we'll set up your agent, knowledge, skills, sandbox, tool calling and chat UI.

Stream Agents is hosted on edge servers around the world for optimal latency. It's open source so you can also self-host.

Time to get started. If you get stuck at any point hit the "Ask AI" button above. The ask AI feature was actually created using this framework as well.

The quickest path

If you're in a hurry you can skip this tutorial and paste one of the 3 example prompts in Claude.

Example prompts

Build me a Go based voice AI that takes orders for my restaurant. Optimize for Dutch language and give me a phone number in Amsterdam: getstream.io/SKILL-agents.md

1 / 3

Build me a Go based video AI that evaluates which strawberries are ripe and counts them: getstream.io/SKILL-agents.md

2 / 3

Build me a Go based text AI that answers support questions, reads my SDKs source code to help customers: getstream.io/SKILL-agents.md

3 / 3

Stream app setup

Get the beta Stream CLI and pick or create the Stream app your agent runs in. The getstream agents commands are only in beta builds: a stable getstream answers them with "agents unavailable". The installer puts getstream in ~/.local/bin and, if that is not on your PATH, adds it to your shell's rc file (~/.zshrc, ~/.bashrc, ~/.bash_profile or ~/.profile, or fish's config.fish).

curl -fsSL https://getstream.io/cli/beta/install.sh | bash # the agents commands are in the beta CLI
getstream --version # a beta build shows a date and commit, such as 2026-10-14-3178aae

getstream init # pick or create a Stream app

Create an agent

As a first step lets define an agent. Each agent consists of a folder with this structure:

agents/my-agent/
  knowledge/       ← indexed markdown and URLs
    faq.md
    urls.yaml
  skills/          ← skills loaded as needed
    research.md
  agent.yaml       ← config for the agent
  instructions.md  ← system prompt
  guardrail.md     ← prevent abuse

The quickest way to create an agent folder is to use one of the templates offered by the beta CLI from Stream app setup:

getstream agents init my-agent --template text # or --template voice

You'll see the agents/my-agent/ folder appear, with a lot of settings to play with. Start by editing the system prompt in instructions.md to match your use case. When ready, run:

getstream agents sync my-agent

Now your agent is synced to Stream. Lets talk to your agent and see how it does:

getstream agents test my-agent

Ask it about Acme first, such as "How do I get started with Acme?". The template's guardrail turns away questions that are not about Acme Corp.

As a next step lets edit agent.yaml. We'll enable GitHub. This agent doesn't need to run code, so lets leave the sandbox disabled.

agents/my-agent/agent.yaml
name: my-agent
mode: text
# the model to use, can reference a router or a model
llm: llm-fast
# connectors & MCP
connectors:
  - name: github
    connection: company # one GitHub account your app owns
# no sandbox: this agent doesn't run code

connection: company is one GitHub account your app owns, so nobody signs in. Create it first, as in Shared account.

Run the agent and ask: "What are the open issues in GetStream/awesome-ai-news?"

getstream agents test my-agent --sync

These building blocks:

  • Skills
  • Knowledge
  • Tools
  • Guardrail
  • Sandbox

Enable you to build any agent. As a next step lets setup tool calling.

Tool Calling

Tool calling makes it easy to integrate agents with your systems.

If you're building a customer support bot you typically want tool calling for:

  • Creating a ticket
  • Looking up a ticket
  • Replying to a customer etc

If you're building legal AI you might want to expose various legal databases through tool calling.

The example below how to setup a tool for a weather lookup:

import { Client, Dispatch } from "@stream-io/calypso";

const client = new Client();
const agent = client.agent("my-agent");

agent.tools.register<{ location: string }>({
  name: "weather_lookup",
  description: "Look up the current weather for a location",
  parameters: {
    type: "object",
    properties: {
      location: { type: "string", description: "a city or region" },
    },
    required: ["location"],
  },
  run: ({ location }) => {
    const place = location.toLowerCase();
    if (place.includes("colorado")) return "sunny";
    if (place.includes("amsterdam")) return "rainy";
    if (place.includes("san francisco")) return "foggy";
    return `no forecast for ${location}`;
  },
});

await new Dispatch().host(agent).run();

Leave the worker running. The template's guardrail only answers questions about Acme, so let the weather through in agents/my-agent/guardrail.md and sync again:

Answer questions about Acme Corp: its products, plans, pricing, accounts and support,
and questions about the weather.
Greetings, thanks, goodbyes and questions about who the agent is or what it can help with
are permitted too.

Now ask the agent about the weather in Amsterdam, Colorado or San Francisco. The model calls weather_lookup, the worker answers, and the agent replies with it:

getstream agents test my-agent --sync

Approval, interruptions, progress updates and the rest are in Tool calling & Dispatch. For a runnable Go agent with tools, knowledge and memory together, see the caregiving example.

Agent UI

Next you typically want to build your agent UI. On either React, Android or iOS.

  1. Install the SDK
// settings.gradle.kts: the SDK is a snapshot from Stream's snapshot repository,
// and the Stream Chat it uses comes from Stream's Maven repository
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven("https://stream-io-repo.com")
        maven("https://snapshots.stream-io-repo.com")
    }
}

// build.gradle.kts: needs compileSdk 37 and Kotlin 2.3 or newer
implementation("io.getstream:calypso-core:0.1.0-202611041811-SNAPSHOT")
implementation("io.getstream:stream-chat-android-ai-compose:7.18.0")
implementation("androidx.lifecycle:lifecycle-runtime-compose:<version>")
  1. Mint a token

Your users sign in with a Stream user token. Mint one for a test user with the CLI.

getstream token jlahey --ttl 2h

Note: In production you would generate the token in your backend when a user signs up or logs in.

  1. Create a session

Open a session with your agent and ask it something:

val agents = VisionAgents(apiKey = "your_api_key")
agents.setUser(User(id = "jlahey"), token = "paste_the_token_here")

val session = agents.agent("my-agent").chat()
session.responses.create("How do I get started with Acme?")
  1. Add the chat UI

The chat UI components support thinking, tool calling, markdown, table responses, code, and UI the agent writes in A2UI or OpenUI. The session's channel is its transcript: the agent does not answer a message sent to the channel, so the composer sends with session.responses.create, and the router writes your message into the channel itself. This holds for voice sessions too. Each thing the caller says is written as a message, the agent's reply streams into its message while it is generated and settles once it is spoken, and a reply the caller cut off is marked interrupted, with its text usually cleared. So render the channel for the transcript and live captions; don't build a second transcript from session.events(). Have a look how you can show the UI:

import android.content.Context
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.lifecycleScope
import io.getstream.chat.android.ai.compose.conversation.AIMessage
import io.getstream.chat.android.ai.compose.conversation.AIMessageRole
import io.getstream.chat.android.ai.compose.parts.AIClientIdentity
import io.getstream.chat.android.ai.compose.parts.AIMessagePart
import io.getstream.chat.android.ai.compose.ui.component.AIConversation
import io.getstream.chat.android.ai.compose.ui.component.AIToolApprover
import io.getstream.chat.android.ai.compose.ui.component.ChatComposer
import io.getstream.chat.android.client.channel.state.ChannelState
import io.getstream.chat.android.models.Message
import io.getstream.visionagents.android.core.AgentSession
import io.getstream.visionagents.android.core.AgentsException
import io.getstream.visionagents.android.core.Conversation
import io.getstream.visionagents.android.core.channelState
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch

// In your activity, with the session from step 3.
lifecycleScope.launch {
    val chat = AgentChat.open(this@MainActivity, session, lifecycleScope)
    setContent { AgentConversation(chat, Modifier.fillMaxSize()) }
}

@Composable
fun AgentConversation(chat: AgentChat, modifier: Modifier = Modifier) {
    val messages by chat.messages.collectAsStateWithLifecycle()
    val answering by chat.isAnswering.collectAsStateWithLifecycle()

    Column(modifier) {
        // Each question moves to the top, and its reply streams in below it with its
        // reasoning and tool calls.
        AIConversation(
            messages = messages,
            modifier = Modifier.weight(1f),
            // The agent is on it, and its reply isn't in the channel yet.
            isThinking = answering && messages.lastOrNull()?.role != AIMessageRole.Assistant,
            // Asks the user before a tool that asks first runs.
            approver = chat.approver,
        )
        ChatComposer(
            // The agent does not answer a message sent to the channel: ask the session.
            onSendClick = { chat.send(it.text) },
            onStopClick = chat::stop,
            // While the agent answers, the composer shows a Stop button.
            isGenerating = answering,
        )
    }
}

/** The session's channel, as the AI components show it. */
@OptIn(ExperimentalCoroutinesApi::class)
class AgentChat private constructor(
    val session: AgentSession,
    val approver: AIToolApprover,
    channel: StateFlow<ChannelState?>,
    private val scope: CoroutineScope,
) {
    /** The channel's messages, oldest first, as Stream Chat keeps them up to date. */
    val messages: StateFlow<List<AgentMessage>> = channel
        .flatMapLatest { it?.messages ?: flowOf(emptyList()) }
        .map { messages -> messages.filter { it.deletedAt == null }.map(::AgentMessage) }
        .stateIn(scope, SharingStarted.Eagerly, emptyList())

    /** Whether a reply is on its way, from the first thought to the last word. */
    val isAnswering: StateFlow<Boolean> = combine(session.conversation, messages) { conversation, messages ->
        when (conversation.state) {
            Conversation.State.Responding, is Conversation.State.Working -> true
            else -> messages.lastOrNull()?.isGenerating == true
        }
    }.stateIn(scope, SharingStarted.Eagerly, false)

    fun send(text: String) {
        scope.launch {
            try {
                session.responses.create(text)
            } catch (_: AgentsException) {
                // Not sent: the user can send it again.
            }
        }
    }

    /** Stops the reply in flight. What was written so far is kept. */
    fun stop() {
        scope.launch {
            try {
                session.interrupt()
            } catch (_: AgentsException) {
                // The reply finished first.
            }
        }
    }

    companion object {
        /** Opens the session's channel. Pass a [scope] on the main thread, such as `lifecycleScope`. */
        suspend fun open(context: Context, session: AgentSession, scope: CoroutineScope): AgentChat {
            // The user set above, who answers the calls the agent addresses to them.
            val approver = AIToolApprover("jlahey", AIClientIdentity.installId(context), scope) { call, allowed ->
                session.decide(call.id, allowed)
            }
            // Connects to Stream Chat as the user set above and watches the session's channel.
            return AgentChat(session, approver, session.channelState(context, scope), scope)
        }
    }
}

/** A message of the channel, as the AI components show it. */
data class AgentMessage(val message: Message) : AIMessage {
    override val id: String = message.id
    // The agent's replies carry `ai_generated: true`.
    override val role: AIMessageRole =
        if (message.extraData["ai_generated"] == true) AIMessageRole.Assistant else AIMessageRole.User
    override val text: String = message.text
    override val isGenerating: Boolean = message.extraData["generating"] == true
    // The reply's reasoning and tool calls, which the router writes as its attachments. Stream Chat
    // lifts `name` out of an attachment's fields, and a tool call's step needs it back.
    override val parts: List<AIMessagePart> = AIMessagePart.parts(
        message.attachments.map { it.type.orEmpty() to it.extraData + ("name" to it.name) },
    )
}

On Android, the views are the AI components of stream-chat-android-ai-compose, and the agents SDK brings no views of its own. Stream Chat's client, which channelState watches the channel with, comes with the agents SDK. AIConversation shows each reply's reasoning and tool calls above its streaming markdown answer, and shows the agent thinking until the reply has something to show. AIToolApprover asks the user before a tool that asks first runs, and answers with session.decide(call.id, allowed). It keeps the user's answers, so in an app, open the chat in a ViewModel and pass its viewModelScope. ChatComposer asks for the microphone the first time the user taps dictation; RECORD_AUDIO is already in your manifest, from Stream Video, which comes with the agents SDK. Its photo picker needs no permission, but send here passes only the text: responses.create takes photos as images. The Android assistant sample builds a complete app on them, with a list of conversations, photos, voice mode, connector sign-ins and tools that run on the phone.

  1. Add the voice UI

A voice session puts the agent on a call. Your app joins that call, and the agent hears the user and answers out loud. What is said on the call is written into the session's channel, so the chat's views show the transcript here too. Add a glow that shows whether the agent is listening, thinking or speaking, and buttons to mute and hang up:

import io.getstream.chat.android.ai.compose.ui.component.AIVoiceAgentState
import io.getstream.chat.android.ai.compose.ui.component.AIVoiceGlow
import io.getstream.visionagents.android.core.Conversation
import io.getstream.visionagents.android.core.SessionOptions
import io.getstream.visionagents.android.core.VoiceSession

/** Starts a session with voice on. Ask for RECORD_AUDIO before you call it. */
suspend fun startVoice(context: Context): VoiceSession =
    // The agent joins the session's call right away.
    VoiceSession.start(context, agents, SessionOptions(agent = "my-agent"))

@Composable
fun AgentVoice(voice: VoiceSession) {
    val scope = rememberCoroutineScope()
    val call by voice.call.collectAsStateWithLifecycle()
    val muted by voice.isMuted.collectAsStateWithLifecycle()
    val conversation by voice.session.conversation.collectAsStateWithLifecycle()
    // Who on the call is speaking: the agent, or the person holding the phone.
    val speakers by remember(call) { call?.state?.activeSpeakers ?: MutableStateFlow(emptyList()) }
        .collectAsStateWithLifecycle()

    // Joins the call from this device, with the microphone on and the agent on the speaker.
    LaunchedEffect(voice) { voice.join() }

    // Speaking comes from the call: a reply is written before it is spoken.
    val state = when {
        call == null -> AIVoiceAgentState.Connecting
        speakers.any { !it.isLocal } -> AIVoiceAgentState.Speaking
        speakers.any { it.isLocal } -> AIVoiceAgentState.Listening
        else -> when (conversation.state) {
            Conversation.State.Listening -> AIVoiceAgentState.Listening
            Conversation.State.Responding, is Conversation.State.Working -> AIVoiceAgentState.Thinking
            else -> AIVoiceAgentState.Idle
        }
    }

    Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(16.dp)) {
        AIVoiceGlow(state = state, modifier = Modifier.size(240.dp))
        // What the user said and the agent's replies.
        LazyColumn(Modifier.weight(1f)) {
            items(conversation.turns) { turn -> Text(turn.text) }
        }
        Row(horizontalArrangement = Arrangement.spacedBy(24.dp)) {
            Button(onClick = { voice.setMuted(!muted) }) { Text(if (muted) "Unmute" else "Mute") }
            // Leaves the call and ends the session this device started.
            Button(onClick = { scope.launch { voice.leave() } }) { Text("Hang up") }
        }
    }
}

VoiceSession joins the call with Stream Video, signed in as the user you passed to setUser. join() doesn't throw. If joining fails, for example because the app doesn't hold RECORD_AUDIO, the error is in voice.failure, so ask for the microphone before startVoice. voice.session is a regular AgentSession, so AgentChat.open from step 4 works here too. conversation holds the turns, each reply growing as it is generated. You don't need to add Stream Video to your app: it comes with the agents SDK.

AIVoiceGlow is one of the AI components of stream-chat-android-ai-compose, from step 1. For a waveform instead of a glow, use AIVoiceWave, which takes the same states.

An agent made from the text template talks with the router's default speech-to-text and text-to-speech models. Make it with --template voice to choose those models and add a greeting. To switch an open chat to voice, call session.startVoice(), then join with VoiceSession.attach(context, agents, session.id). voice.end() ends the session whoever started it. The voice mode of the Android assistant sample does this.