Skip to content
Skills Library
AI & agents · Tool integration

opengeni-client

/opengeni-client

Add Opengeni agents to a product: the packaged chat UI behind one server route, workspaces per tenant or user, the product's own tools with per-user auth and approvals, background agents, and verification. Use when integrating Opengeni into a website, backend, or app. Not for changing Opengeni itself.

Repository
opengeni ↗
Licence
Apache-2.0
Last repository change
13.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
9
Scripts
0
HTML comments
0
URLs in SKILL.md
6
Deprecation

No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Add Opengeni agents to a product: the packaged chat UI behind one server route, workspaces per tenant or user, the product's own tools with per-user auth and approvals, background agents, and verification. Use when integrating Opengeni into a website, backend, or app. Not for changing Opengeni itself.

Original author description

Add Opengeni agents to a product: the packaged chat UI behind one server route, workspaces per tenant or user, the product's own tools with per-user auth and approvals, background agents, and verification. Use when integrating Opengeni into a website, backend, or app. Not for changing Opengeni itself.

How it works

  1. Decide
  2. Default integration
  3. Verify
  4. Rules
  5. Advanced
Original SKILL.md headings · 238 lines, 1,484 words
SKILL.md preview
---
name: opengeni-client
audience: integration-agent
description: >-
  Add Opengeni agents to a product: the packaged chat UI behind one server
  route, workspaces per tenant or user, the product's own tools with per-user
  auth and approvals, background agents, and verification. Use when integrating
  Opengeni into a website, backend, or app. Not for changing Opengeni itself.
---

# Opengeni client

The product keeps its users, auth, and UI. Opengeni runs the agent: sessions,
tools, approvals, and history. The browser talks only to the product's server,
and the server talks to Opengeni with an organization API key that never leaves
it.

No organization or key yet? Do
[Opengeni developer setup](https://docs.opengeni.ai/guides/developer-plugin)
first, then come back.

Everything in this guide works on app.opengeni.ai today (the full embed:
attachments, tool output, approvals). Older web pages or search results that
say otherwise are outdated. The installed `@opengeni/sdk` and `@opengeni/react`
types are authoritative.
Without the repository, read https://docs.opengeni.ai/llms.txt. The tenancy
model is specified in
[product-integration.md](https://github.com/Cloudgeni-ai/opengeni/blob/main/docs/product-integration.md).

## Decide

1. Inspect the repository: framework, auth, how users and teams are modeled,
   any existing chat UI, package manager, tests.
2. Ask the user only what the request and repository leave open, in one short
   message, with a recommendation:
   - Is each chat private to the person who started it, or shared with their
     team? (Recommend private.)
   - May the agent change data, and which actions need approval? (Recommend:
     approve every write.)
3. Pick the shape:
   - React frontend: the default below.
   - An existing chat UI to keep, an assistant bound to one record, or a
     custom layout: [Existing chat UI](references/existing-chat-ui.md).
   - A plain HTML/JS site, or a widget for anonymous visitors:
     [Website widget](references/website-widget.md).
   - A non-JavaScript backend: keep the React UI and implement the
     [proxy contract](https://docs.opengeni.ai/integrate/proxy-from-any-backend).
   - Scheduled work, or chats created by the server:
     [Background agents](references/background-agents.md).

Decide local mechanics yourself (ports, test users, tunnels). Do not push,
merge, or deploy without the user's permission.

## Default integration

Install `@opengeni/sdk` and `@opengeni/react` at the same exact version, the
current npm `latest` (see [Versions and upgrades](references/versions-and-upgrades.md)).
Put `OPENGENI_API_KEY` in the server's git-ignored env. Self-hosted
deployments also pass `baseUrl: process.env.OPENGENI_API_BASE_URL`.

Server, one catch-all route at `/api/opengeni/*` (Next.js App Router shown):

```ts
// app/api/opengeni/[...path]/route.ts
import { Opengeni } from "@opengeni/sdk/chat";
import { createSessionProxyRoute } from "@opengeni/sdk/next";

const og = new Opengeni({ apiKey: process.env.OPENGENI_API_KEY! });

export const dynamic = "force-dynamic";
export const { GET, POST, PUT, PATCH, DELETE } = createSessionProxyRoute(og, {
  resolve: async (request) => {
    const user = await getSignedInUser(request); // the product's own auth
    if (!user) return new Response("Unauthorized", { status: 401 });
    return { user: user.id, tenant: user.teamId };
  },
  createSession: ({ initialMessage, idempotencyKey }) => ({
    initialMessage,
    idempotencyKey,
    agent: { identity: "You are Acme's assistant. Friendly and brief.", capabilities: "none" },
    sandboxBackend: "none", // chat and tools only; turns start in seconds
    reasoningEffort: "medium", // faster replies; omit for the deployment default (slower, deeper)
  }),
});
```

Other servers: build `const handler = createSessionProxyHandler(og, options)`
from `@opengeni/sdk/session-proxy` with the same options, then mount
`toNodeMiddleware(handler)` from `@opengeni/sdk/express` (before any body
parser), `toHonoHandler(handler)` from `@opengeni/sdk/hono`, or call
`handler(request)` on any web-standard server. Next.js Pages Router: in
`pages/api/opengeni/[...path].ts`, export
`config = { api: { bodyParser: false, externalResolver: true } }` and a default
`(req, res) => middleware(req, res)` where
`middleware = toNodeMiddleware(handler)`; `resolve` reads the product session
from `request.headers` (the cookie), since `next/headers` is App Router only.

Browser:

```tsx
import { OpenGeniChat } from "@opengeni/react/session-ui";
import "@opengeni/react/compiled.css";

<OpenGeniChat baseUrl="/api/opengeni" />;
```

`OpenGeniChat` is the user's chat list plus the conversation, with streaming,
approvals, questions, and attachments. It needs no provider or workspace id:
the proxy tells it which workspace the user is in. Importing from `session-ui`
instead of the package root avoids pulling in optional heavy peers. Brand it
with `--og-*` CSS tokens.

Bearer-token auth instead of cookies: pass the token on every request, and
read it in `resolve`.

```tsx
<OpenGeniChat
  baseUrl="/api/opengeni"
  headers={() => ({ Authorization: `Bearer ${getAccessToken()}` })}
/>
```

`fetch` replaces the request function when the token must be awaited.

### Who sees what

| `resolve` returns       | Workspace      |
| ----------------------- | -------------- |
| `{ user, tenant }`      | one per tenant |
| `{ user }`              | one per user   |
| `{ user, workspaceId }` | yours          |

Workspaces and memberships are created on first use (the key needs
`members:manage`, which full-access keys have). To remove a user, stop
resolving them. Chats are private to the user who started them;
`chats: "shared"` on the handler shares them with the workspace. Files attached
in a private chat are the uploader's own (Only me), read by them and that chat's
agent; in shared chats they are workspace files. A tenant is
the product's team, organization, or customer: the group that shares data and
tools. Derive `user` and `tenant` from the product's session, never from the
request body or path. Anonymous visitors on a public site share one fixed
`tenant`; `{ user }` alone would give every visitor a workspace of their own.
Also return `visitor: true` for them: visitors get no file attachments unless
the handler sets `visitorUploads: true`. Live voice is off in the stock chat
unless the component turns it on
(`<OpenGeniChat conversationProps={{ realtimeVoice: true }} />`).
Server-side code gets the same workspace with
`og.workspaceId({ tenant })` or `og.workspaceId({ user })`.

Workspaces the product's organization key creates are managed by the product.
Organization owners and admins read those users' sessions, cost and an audit
log in Opengeni Console (console.opengeni.ai, or `/console` in the app), where
they also manage members, billing and API keys without opening the app; the
organization chooses full transcripts, metadata only or off. See
[opengeni-console.md](https://github.com/Cloudgeni-ai/opengeni/blob/main/docs/opengeni-console.md).

### The agent

The browser sends only the first message and its attached files (the proxy adds
them to the chat); `createSession` decides the rest:
`agent.identity` (who it is), `agent.capabilities` (`"none"` for product tools
only, `"all"`, or a mix), `agent.instructions`, inline product `skills`, and
`sandboxBackend`. See [Configure the agent](references/configure-the-agent.md).
Per-message facts such as today's date or the current page go in
`beforeForwardMessage: () => ({ modelContext })`, not in instructions.

Without `reasoningEffort`, chats use the deployment default, which can be high:
deeper answers, slower replies. A lighter effort (`"medium"` or `"low"`) suits
quick end-user chat; keep the default where answer quality matters more than
speed. The stock UI shows end users a model picker only when the handler sets
`modelSelection: true`; the component's `modelPicker` prop overrides this
either way. The picker lists the workspace's model catalog, so the workspace's
allowed-model settings decide which models appear. The option itself defaults
to `true`, so the relay accepts model choices a custom browser client sends;
set `modelSelection: false` to remove them.

### The product's tools

Expose the product's data as an MCP endpoint that acts as the signed-in user:

```ts
createSessionProxyRoute(og, {
  resolve,
  createSession,
  toolServer: { approvals: { ask: ["update_ticket"] } }, // every write tool
});
```

The proxy attaches the endpoint at `OPENGENI_TOOL_SERVER_URL` (public HTTPS)
to each chat with a short-lived per-user token. The endpoint calls
`verifyToolRequest(request)` from `@opengeni/sdk/tool-auth` and scopes every
query to the returned `user` and `tenant`. The user approves each call to a tool
in `approvals.ask`. See [Tools and auth](references/tools-and-auth.md).

`toolServer` throws at startup when `OPENGENI_TOOL_SERVER_URL` is not an
`https://` URL. Until the tunnel or deployment exists, pass it only when that
variable is set, so chat still works without the product's tools:
`...(process.env.OPENGENI_TOOL_SERVER_URL ? { toolServer } : {})`.

## Verify

1. The product's typecheck, build, and tests pass.
2. Signed out, `/api/opengeni/...` returns 401.
3. Signed in, a real product question streams a useful answer, and the chat is
   still there after reload.
4. A question that needs a product tool calls it with the right user's data; a
   write asks for approval first.
5. A second user, and a user in another tenant, cannot see the first user's
   chats or data.

To see which models a workspace can use, call
`GET /v1/config/client?workspaceId=<id>` with the key. Without `workspaceId`, an
organization key sees no models and an "unavailable" fallback; that is expected,
not a blocked model. A real chat turn is the true test.

Locally, Opengeni must reach the tool endpoint over public HTTPS. Never tunnel
the whole app (that publishes every page, including sign-in and admin): run the
tool-only forwarder from
[Tools and auth](references/tools-and-auth.md#local-development), tunnel only
its port, set `OPENGENI_TOOL_SERVER_URL` to the tunnel URL plus the tool path,
and tell the user.

Before production, and for the handoff, read the
[Production checklist](references/production-checklist.md).

## Rules

- The API key is used only by the server (the proxy); it never goes in browser
  code.
- Never replace the proxy with a raw passthrough to the Opengeni API.
- Keep every `@opengeni/*` package at one pinned version. Server updates keep
  that version working; upgrade all packages together when you want new
  features ([Versions and upgrades](references/versions-and-upgrades.md)). The
  SDK is ESM-only; from CommonJS, use `await import("@opengeni/sdk")`.
- With cookie auth, pass the product's existing CSRF check as
  `authorizeMutation`. If it has none, keep the default (it refuses cross-site
  mutations by `Sec-Fetch-Site`); a hand-written Origin/Host check breaks
  behind proxies, tunnels, and preview URLs.
- This skill guides the coding agent. Do not add it to the product agent's
  skills.

## Advanced

Products that provision workspaces and members themselves can still use
`ensureWorkspace`, `addExternalWorkspaceMember`, and `asUser`; see the
[Production checklist](references/production-checklist.md#explicit-provisioning).
Files in this package (9)
  • SKILL.md 11 KB
  • agents/openai.yaml 1 KB
  • references/background-agents.md 3 KB
  • references/configure-the-agent.md 6 KB
  • references/existing-chat-ui.md 3 KB
  • references/production-checklist.md 3 KB
  • references/tools-and-auth.md 12 KB
  • references/versions-and-upgrades.md 2 KB
  • references/website-widget.md 3 KB

Versions

RepositoryScoreLicence
This page · cloudgeni-ai/opengeni100Apache-2.0
cloudgeni-ai/opengeni100Apache-2.0

Database snapshot: 13.11.2026 · package version 6c921571575d (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90build-with-opengeni
    Add Opengeni agents to the user's own product, backend, website, or app with @opengeni/sdk and @opengeni/react: the packaged chat UI behind one server route, per-tenant workspaces, and the product's own tools. Also builds a small local demo web app with an Opengeni chat. Use…
  • 86run-opengeni
    Use when the user wants Opengeni running on their machine, or asks how to configure a local Opengeni checkout. Not for editing Opengeni source (opengeni skill) or embedding it in another product (opengeni-client).
  • 90blazing-agents
    Build products on Blazing Agents (BA), the hosted platform that runs production AI agents behind your backend. Use when the user wants to add an agent, chat, background or scheduled agent work, structured output, Workspaces and files, Skills, Memory, Prompts, web search, backend…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.