@segmentstream/agent · agent/

The company agent, in a folder of your repository.

The extension behind the company agent in agent/. It gives the agent the workspace's ontology as tools, acting as the member who is talking to it, and puts it in your team's channels through the workspace's connections: unknown senders pair with a member first, voice messages become text, and groups are answered only when the agent is addressed.

Get started

agent/
$ cd agent && npm install

At a glance

  • One agent per workspace, in agent/, deployed with the rest
  • Acts as the member who writes, with their roles
  • Channels through the workspace’s connections; no tokens in code
  • Open source under Apache-2.0

What it does

01

One folder

agent/ is a package of its own, like ontology/. You write the instructions; tools come from the ontology and the channel from a connection.

agent/
agent/├── package.json            # @segmentstream/agent and its runtime, pinned├── segmentstream.json      # channels and models; the platform reads it too└── agent/    ├── agent.ts            # model, reasoning and limits    ├── instructions.md     # who the company is, how the agent behaves    └── extensions/        └── segmentstream.ts  # mounts the SegmentStream extension
02

Mount the extension

The extension gives the agent the app's ontology as tools, acting as the member of each turn, and puts it behind the workspace's channels.

agent/
// agent/agent/extensions/segmentstream.tsimport { segmentstream } from "@segmentstream/agent/extension";import config from "../../segmentstream.json";export default segmentstream(config);// agent/segmentstream.json{  "channels": {    "telegram": { "connection": "telegram", "policy": "smart" }  }}
03

A model per role

Choose the model once per session from the member's roles. Every major model is available, with no API key to configure. The default tools stay off: the ontology is the tool surface, and `sandbox` adds bash and file tools in an isolated sandbox without network.

agent/agent/agent.ts
import { defineAgent, segmentstream } from "@segmentstream/agent";export default defineAgent({  defaultTools: false,  model: segmentstream.model({    default: DEFAULT_MODEL,              // a gateway model id    byRole: { accountant: FINANCE_MODEL },  }),  reasoning: "medium",  limits: { sessionUsage: ({ window }) => (window.costUsd ?? 0) >= 2 },});
04

Pairing with a member

An unknown sender gets a link to the app's /agent/connect page. The member signs in and approves once, and from then on the agent acts as them. Members see and revoke their pairings in the app.

app/src/app/api/agent/connect/route.ts
// app/src/app/api/agent/connect/route.tsimport { segmentstream } from "@/segmentstream";export const { POST } = segmentstream.agent.connectHandler();
05

Run and deploy

Run it locally in the terminal, then deploy with the workspace. The platform registers the channels' webhooks after each production deploy; previews never answer real chats.

terminal
$ cd agent && npm install$ npm run dev$ segmentstream deploy
Inside SegmentStream

What the Agent SDK deploys.

The company agent from agent/: its models, the deployment it runs and every step a message takes, from the channel to the reply.

segmentstream.com
The console's agent page: live on Telegram, its chat model and the model for preview deployments, the deployment it runs and its Agent SDK version, then how a message is handled, from the channel it arrives on, with voice transcribed to text and images described for the chat model, to who may talk
The company agent as its agent/ folder declares it: the models it uses, the deployment it runs and every step a message takes, from the channel to the reply.

The rest of the surface

Build your company’s own software. Let agents run it.

$ segmentstream workspace create acme --region eu --subdomain acme

▸ Created workspace acme · database, warehouse and a private git repository

$ segmentstream workspace WORKSPACE-ID clone acme && cd acme

▸ your coding agent builds what your team asked for and runs the checks

$ git add -A && git commit -m "First version"

$ segmentstream deploy

▸ app, company agent, API and MCP tools live for your invited members

Start a pilot

Our engineers build the first version on your data in two weeks, at a fixed price.

Or build it yourself with your coding agent:

curl -fsSL https://segmentstream.com/install.sh | sh

We’ll email you product updates, tips and onboarding help. Unsubscribe anytime.