Agents in Your App Template
Drop the SDK into an existing product, add an agent endpoint, and stream to your UI
What it is
A pattern for adding an AI agent to a product you already have. You do not migrate anything. You install the SDK, add one server endpoint that streams an agent, and wire your existing UI to it. Your stack stays exactly as it is.
What it includes
How to start it
Install the SDK in your existing backend and create one agent.
Add an agent endpoint
Add one route to your existing server. Keep the API key server side and stream { delta } chunks to the client.
Stream to your UI
Your existing frontend reads the response body as it arrives. No framework lock-in.
In React Native, do not use chatStream(). Call r.agents.chatStreamText() instead.
Key SDK calls
r.agents.create({ project_id, model, instructions })- the agent, created oncer.agents.chatStream(agentId, { message })- stream from your server (Node and browser)r.agents.chatStreamText(agentId, { message })- the React Native streaming pathr.agents.chat(agentId, { message })- non-streaming, if you just want the full reply
Next steps
- Connect Node.js or Connect Next.js
- Add AI Agents to your framework
- API Reference for every endpoint