App development
This guide is for developers integrating an existing application. To work on your own project with Tress's agent, start with Run on your machine.
Run the complete reference app
Use Node 26 LTS (24+ works) and stable Rust. From this repository's root:
cargo build --locked -p tress
npm --prefix examples/existing-app ci
npm --prefix examples/existing-app run build
cd examples/existing-app
APP_PASSWORD=local-example-password PUBLIC_ORIGIN=http://localhost:3000 npm startOpen http://localhost:3000 and sign in with local-example-password. The
sample agent echoes messages without a model key. Download a terminal
credential, then follow the browser-first steps below using the built binary
and the file's actual download path.
The reference app demonstrates one owner and one thread, including the
optional createTressAccess adapter and separate terminal grants. Existing
apps can keep their own session/access implementation. Replace this example's password
login with your application's identity provider for production. Its
AGENT_MODULE option accepts a module exporting your existing AI SDK agent;
no separate chat-backend URL is required.
Use your existing application
Build the preview CLI from this checkout:
cargo build --locked -p tress
./target/debug/tress --helpStart your existing application with its normal development command after adding the integration. Keep its thread host alive outside the lifetime of an individual browser tab.
Browser first
- Open
http://localhost:3000, sign in, and select a conversation. - Use the app's terminal-sharing action. The reference app issues a separate grant; save its header file privately. The website demo instead supplies a command containing its secret session token.
- Copy the thread endpoint and connect. For the reference app:
chmod 600 app-headers.json
./target/debug/tress attach http://localhost:3000/api/threads/main \
--headers-file app-headers.json- Send a message in either client. Both should show one reply.
- Close the terminal mid-run and reconnect. The host keeps working.
Terminal first
Obtain the endpoint and any required credential through your app's access flow, then run the same command. The preview discovers existing threads when the app publishes its manifest:
tress attach http://localhost:3000 --api-key-env MY_APP_API_KEYThe variable holds an app-issued bearer credential. Omit the flag only when
the app allows anonymous access; use --headers-file for its custom headers.
The reference app above uses a downloaded grant file. Thread creation and a
generic browser login flow remain separate work.
Have the app provide the browser URL for that thread alongside its endpoint:
const connection = {
endpoint: new URL(`/api/threads/${encodeURIComponent(threadId)}`, appOrigin).href,
browserUrl: new URL(`/chat/${encodeURIComponent(threadId)}`, appOrigin).href,
};These routes are examples; use your application's actual routing. The browser URL selects the thread and still requires the app's normal login.
Remote development machine
Run the app on the remote machine, then forward its local port:
ssh -L 3000:127.0.0.1:3000 user@your-serverOpen http://localhost:3000 and use the same local attach command on your
laptop. Here, SSH carries traffic to the remote host. No public domain is
required. The remote host still runs the agent and owns its workspace.
Develop terminal access for an existing assistant-ui application.