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
// Package.swift: needs iOS 16 and Xcode 27 or newer
platforms: [.iOS(.v16)],
dependencies: [
    .package(url: "https://github.com/GetStream/Vision-Agents.git", branch: "accelerate"),
    .package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "5.15.0"),
],
targets: [
    .target(
        name: "MyApp",
        dependencies: [
            .product(name: "VisionAgentsCore", package: "Vision-Agents"),
            .product(name: "StreamChatAI", package: "stream-chat-swift"),
        ]
    ),
]
  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:

import VisionAgentsCore

let agents = VisionAgents(apiKey: "your_api_key")

/// Call once, when the user signs in.
func signIn() {
    agents.setUser(User(id: "jlahey"), token: "paste_the_token_here")
}

/// Opens a session with the agent and asks it something.
@MainActor
func startSession() async throws -> AgentSession {
    let session = try await agents.agent("my-agent").sessions.create()
    // The session's socket, which stops a reply and runs the tools this phone offers.
    await session.start()
    _ = try await session.responses.create("How do I get started with Acme?")
    return session
}
  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 StreamChat
import StreamChatAI
import SwiftUI
import VisionAgentsCore

/// Opens the session's channel, as the AI components show it.
@MainActor
func openChat(for session: AgentSession) async throws -> AgentChat {
    // `session.chat()` connects to Stream Chat as the user set above and opens the session's channel.
    let channel = try await session.chat()
    return AgentChat(session: session, channel: channel)
}

struct AgentConversation: View {
    @ObservedObject var chat: AgentChat
    @StateObject private var composer = AIComposerViewModel()

    var body: some View {
        VStack(spacing: 0) {
            // Each question moves to the top, and its reply streams in below it with its
            // reasoning and tool calls.
            AIConversationView(messages: chat.messages)
            AIComposerView(
                viewModel: composer,
                // The agent does not answer a message sent to the channel: ask the session.
                onMessageSend: { message in
                    Task { _ = try? await chat.session.responses.create(message.text) }
                },
                onStopGenerating: {
                    Task { try? await chat.session.interrupt() }
                }
            )
        }
        // While the agent writes, the composer shows a Stop button.
        .onReceive(chat.$isAnswering) { composer.isGenerating = $0 }
    }
}

/// The session's channel, as the AI components show it.
@MainActor
final class AgentChat: ObservableObject, ChatChannelControllerDelegate {
    let session: AgentSession
    @Published private(set) var messages: [AgentMessage] = []
    @Published private(set) var isAnswering = false

    private let channel: ChatChannelController

    init(session: AgentSession, channel: ChatChannelController) {
        self.session = session
        self.channel = channel
        channel.delegate = self
        channel.synchronize()
    }

    func channelController(
        _ channelController: ChatChannelController,
        didUpdateMessages changes: [ListChange<ChatMessage>]
    ) {
        // The channel lists its messages newest first, the conversation oldest first.
        messages = channelController.messages.reversed().map(AgentMessage.init)
        isAnswering = messages.last?.isGenerating == true
    }
}

/// A message of the channel, as the AI components show it.
struct AgentMessage: AIMessage {
    let message: ChatMessage

    var id: MessageId { message.id }
    // The agent's replies carry `ai_generated: true`.
    var role: AIMessageRole {
        message.extraData["ai_generated"]?.boolValue == true ? .assistant : .user
    }
    var text: String { message.text }
    var isGenerating: Bool { message.extraData["generating"]?.boolValue == true }
    // The reply's reasoning and tool calls, which the router writes as its attachments.
    var parts: [AIMessagePart] {
        AIMessagePart.parts(from: message.allAttachments.map { ($0.type.rawValue, $0.payload) })
    }
}

On iOS, the views are the AI components of StreamChatAI, and VisionAgentsCore brings no views of its own. StreamChat, which the snippet imports for the channel, comes with VisionAgentsCore. AIComposerView needs iOS 16. AIConversationView shows the reply's reasoning and tool calls above its streaming markdown answer, and shows the agent thinking until the reply has something to show. To let the user answer a tool that asks first, pass an AIToolApprover as its approver and answer with session.decide(call.id, allowed: allowed). The composer's photo picker and dictation need the camera, photo library, microphone and speech recognition usage descriptions in your Info.plist. The Swift 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 StreamChatAI
import StreamVideo
import SwiftUI
import VisionAgentsCore

/// Starts a session with voice on, and opens its transcript.
@MainActor
func startVoice() async throws -> (voice: VoiceSession, chat: AgentChat) {
    // The agent joins the session's call right away.
    let voice = try await VoiceSession.start(agents: agents, agent: "my-agent")
    // The session's socket, which follows what the agent is doing and runs the tools this phone offers.
    await voice.session.start()
    // What is said on the call is written into the session's channel, so the chat's views show it.
    return (voice, try await openChat(for: voice.session))
}

struct AgentVoice: View {
    @ObservedObject var voice: VoiceSession
    @ObservedObject var chat: AgentChat

    var body: some View {
        VStack(spacing: 16) {
            if let call = voice.call {
                AgentStatus(voice: voice, call: call.state)
            } else {
                AIVoiceGlowView(state: .connecting)
                    .frame(width: 240, height: 240)
            }
            // What the user said and the agent's replies, as in the chat.
            AIConversationView(messages: chat.messages)
            HStack(spacing: 24) {
                Button {
                    Task { await voice.setMuted(!voice.isMuted) }
                } label: {
                    Image(systemName: voice.isMuted ? "mic.slash.fill" : "mic.fill")
                }
                // Leaves the call and ends the session this device started.
                Button(role: .destructive) {
                    Task { await voice.leave() }
                } label: {
                    Image(systemName: "phone.down.fill")
                }
            }
            .font(.title2)
            .buttonStyle(.bordered)
        }
        // Joins the call from this device, with the microphone on and the agent on the speaker.
        .task { await voice.join() }
    }
}

/// What the agent is doing, as the glow shows it.
struct AgentStatus: View {
    @ObservedObject var voice: VoiceSession
    // The call's participants, and which of them is speaking.
    @ObservedObject var call: CallState

    var body: some View {
        AIVoiceGlowView(state: state)
            .frame(width: 240, height: 240)
    }

    private var state: AIVoiceAgentState {
        // Speaking comes from the call: a reply is written before it is spoken,
        // and is done before the agent stops talking.
        if call.remoteParticipants.contains(where: \.isSpeaking) { return .speaking }
        if call.localParticipant?.isSpeaking == true { return .listening }
        switch voice.session.state {
        case .listening: return .listening
        case .responding, .working: return .thinking
        case .idle, .ended: return .idle
        }
    }
}

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 user denied microphone access, the error is in voice.failure. voice.session is a regular AgentSession, so openChat(for:) from step 4 works here too, and the agent's replies stream into the transcript as they're generated. You don't need to add StreamVideo to your package: it comes with VisionAgentsCore.

AIVoiceGlowView is one of StreamChatAI's AI components. For a waveform instead of a glow, use AIVoiceWaveView, which takes the same states. Add a microphone usage description to your Info.plist. Without it, iOS closes the app when it asks for the microphone.

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(agents:sessionID:). The voice mode of the Swift assistant sample does this.