Skip to content

Loading documentation…

↑ ↓ to navigate  ↵ to open  Esc to close
Website Console
Section menu
DocumentationHow-to guides

Launch a company agent

Launch your own AI agent in a workspace, test what a member can do in the app, then connect Telegram and verify a real conversation.

Give the agent one job and one role

Start with a linked workspace and one question whose answer you can verify. In the starter, a sales member might ask who owns a known lead. Decide which records that role may read and which action, if any, it may take. Give the agent a second test where a different role must be refused.

Set up the agent in the app

The current starter includes agent/. In an older project that lacks it, initialize the agent from the workspace root with the command below. Use agent/agent/instructions.md for its job and response conventions, agent/segmentstream.json for model and channel configuration, and ontology/ for the actions and their permissions. The signed-in starter app includes a chat at /agent, so you can try the first version there.

Terminal
segmentstream agent init --channel none

Test with a member in a preview

Commit the agent and its ontology changes on a branch in the linked workspace. Deploy a named preview, open its app and try the question about the known record. Compare the answer with the record itself. Repeat the permission test. Preview chat and evals run against the preview ontology. External channels, tasks and connections are inactive there.

Terminal
segmentstream deploy --preview --preview-name agent-pilot
segmentstream previews show agent-pilot

Turn the conversation into an eval

For a repeatable check, add a case in agent/evals/ with a known record and an expected result, then commit and redeploy the preview. Run the eval as an invented email address that does not belong to a production member. The example uses the starter’s sales role. In another workspace, supply a role its ontology declares.

Terminal
segmentstream agent eval --preview agent-pilot --as pilot@example.invalid --role sales

Publish the agent in the app

Merge the reviewed changes to the linked repository’s main branch and deploy that revision. Check the deployment and the agent status. Open /agent on the production app, sign in as a pilot member and repeat the question about a known record. The team can use app chat from this point.

Terminal
segmentstream deploy
segmentstream status
segmentstream agent status
The company agent as its agent/ folder declares it: the channels it is live on and whether each works, the models it uses and the deployment it runs.

Connect a production Telegram bot

If the team wants Telegram, run agent init with the Telegram channel in the linked project. Supply the workspace’s replies.pairingRequired, replies.pairingButton and texts.confirmation messages, review its file and dependency changes, and commit them. Deploy the reviewed main revision. For a newly declared telegram connection, run segmentstream connection authorize telegram after deployment and complete Telegram’s bot creation flow. For an existing BotFather token, configure the deployed connection with that token.

Terminal
segmentstream agent init --channel telegram

Verify a live conversation

Check that the deployed revision is live and that the agent lists the expected channel. In a member-only workspace, message the bot directly, open the app’s /agent/connect pairing link, sign in and approve it. Ask about the same known record. If self-sign-up is enabled, check which roles it assigns to the new user.

  • If the bot stays silent, check the channel name and connection status, then try a direct message to separate a connection problem from the group’s reply policy.
  • If the agent replies but cannot read the record, check the paired member’s role and the action logs. Use the session trace to inspect the tool call and its result.
Terminal
segmentstream connection get telegram
segmentstream agent status