Skip to main content
Your users chat in your app, and your server talks to the agent. The browser never sees the service credential, and the agent sees each of your users as a separate person, with their own conversations.
Two parts make it work:
  • A route on your server passes the chat’s requests to the agent. It holds the service credential, since every request to the agent needs a Jaccard token, and that token must stay on your server.
  • eve’s useEveAgent hook runs in the page. It starts the session, sends messages, and streams the replies and approval requests into React state.
Start with a chat only you can use, on your machine. Then add your users before anyone else uses it.

Before you start

  • Your server has a service credential, listed in the agent’s callers: see Access.
  • The steps use Next.js with the App Router. For other frameworks, see Other frameworks.

Try it on your machine

1

Set up the app

Create a Next.js app, then install eve at the version in the agent’s package.json, for its React hook:
2

Give your server the credential

Add the agent’s URL, from jaccard agent get <agent>, and the credential to the app’s server environment:
.env.local
Never give these names a NEXT_PUBLIC_ prefix or read them in a client component: that would send the secret to every browser.
3

Add the server helpers

lib/agent.ts
4

Add the route the browser calls

eve’s React hook calls /eve/v1/* on your app’s own origin. This route passes on the requests a chat makes, and nothing else:
app/eve/v1/[...path]/route.ts
5

Add the chat page

The page sends messages, streams the replies, and shows buttons when the agent asks the user to approve a tool, answer a question or sign in to a service:
app/page.tsx
eve’s frontend documentation covers the hook. For a page with markdown, tool details and a saved session, see Use a styled chat page.
6

Chat with the agent

Start the app on this machine only, then open http://127.0.0.1:3000 and send a message:
This version has no sign-in. Anyone who can reach the app chats as your service, spends your model tokens and can read every conversation. Keep it on 127.0.0.1 until you’ve added your users.

Add your users

Before anyone else uses the chat, have your server name the signed-in user on each message, and let each user reach only their own sessions. Until then, the agent sees one caller, your service, so all your users share its memory, approvals and connections.
1

Let your service speak for your users

Add the service to forwarders and accept forwarded users in agent/channels/eve.ts, as in Access, then deploy.
2

Add the user helpers

signedInUser returns the id of whoever is signed in to your app. Use your own sign-in. This version reads a cookie, so you can test with two users before wiring it up:
lib/users.ts
3

Check the user on every request

Replace the route:
app/eve/v1/[...path]/route.ts
Keep all three checks. Every request reaches the agent as your service, with your service’s authority:
  • Allowed calls (isChatCall). Without them, a signed-in user could reach every route the agent has.
  • Ownership (ownerOf). The agent can’t tell your users’ sessions apart, so without it anyone signed in to your app who learns a session id can read that conversation and write to it.
  • Body fields (chatFields). The agent also accepts fields meant for services, such as a URL to send results to. Copying the browser’s body would let a user set them.
If your page saves the session in the browser, as the shadcn/ui version does, remove it when a user signs out, so the next person on that browser starts their own chat.Each message costs model tokens, so limit how many a user can send, as you would any paid API.

Check it works

Use two users to check that the agent tells them apart and that each sees only their own conversation.
  1. Add a test sign-in route, and remove it before you ship:
    app/login/route.ts
  2. Give the agent a tool that reports who is calling, and deploy:
    agent/tools/whoami.ts
  3. Start the app on this machine only, since the test sign-in lets anyone who can reach it be any user: npx next dev -H 127.0.0.1. Open /login?user=alice in one browser and /login?user=bob in a private window, and try:
  4. Copy alice’s session id from her browser’s network panel, where it appears in the /eve/v1/session/<id>/stream request. In bob’s window, open /eve/v1/session/<id>/stream: your route should answer 403 “Not your session.”

Other frameworks

For Vue or Svelte, use useEveAgent from eve/vue or eve/svelte, and port the route to your framework’s server routes with its three checks. A server-rendered app, such as one in Python, can skip the route and the hook, and call the agent from your server as in Calls from your service.
Don’t use eve’s framework plugins, such as eve/next, with an agent on Jaccard. They pass every request to the agent without your route’s checks.

Use a styled chat page

This version renders markdown in the replies, shows each tool call with its result, and keeps the session across reloads. It adds more packages: shadcn/ui’s chat components and Streamdown. It uses the same route, so the checks in Add your users still apply.Add shadcn/ui and its chat components, and Streamdown for markdown. In an app that already has shadcn/ui, start at shadcn add.
Two small changes to the generated files:
  • In app/layout.tsx, rename the font variable --font-geist-sans to --font-sans, the name shadcn/ui’s styles use.
  • In app/globals.css, add @source "../node_modules/streamdown/dist/*.js"; below the @import lines, so the replies’ markdown is styled.
Replace app/page.tsx. This page keeps the session in the browser, so a reload brings the conversation back, and New chat starts a new one:
app/page.tsx
Each tool call shows as a line you can open. When the agent asks the user to approve a tool or answer a question, it sends the question and its buttons, and the page shows them until the user answers:
components/tool-call.tsx

Troubleshooting

Last modified on November 16, 2026