Skip to content
Run it

Connect a browser to a Session

Use the public HTTP client without taking ownership of the Agent runtime.

An existing host admits the browser and exposes Shiitake’s HTTP routes. The browser creates a Session, sends a prompt and keeps the returned Session client for observations and later commands. It does not run reconciliation itself.

recipes/browser-client.ts
import { createShiitakeClient } from "@fungi.computer/shiitake/client";
/** Connect to an existing admitted HTTP host; the server owns authentication. */
export async function browserConversation(baseUrl: string, requestId: string) {
const client = createShiitakeClient({ baseUrl });
const sessionId = await client.createSession(requestId);
const session = client.session(sessionId);
const accepted = await session.send("Hello.", {
requestId: `${requestId}-hello`,
});
return { session, accepted };
}

Supply your host’s base URL and retain one request ID for retries of this action. The return value accepted means durable acceptance, not a completed model reply. Read or subscribe through the returned Session client for progress.

Grove uses this client through its admitted App host to open a Session and observe its messages in the inbox. The browser keeps the returned Session client; the host retains responsibility for admission and reconciliation.

The maintained client parses HTTP responses and preserves typed refusals. Authentication, Team membership and Session authority belong to the server; this helper supplies none of them. The excerpt compiles against public exports. Running it requires an existing admitted HTTP host; it is not a standalone credential-free host demonstration. For that, use Quickstart.