> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aiybiz.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How Aiybiz works

> Platform architecture from a product perspective.

## The actors

| Actor        | Role                                           |
| ------------ | ---------------------------------------------- |
| **Client**   | A company that uses AI agents to automate work |
| **Platform** | Aiybiz — manages agents, billing, and sessions |

## Agent templates vs sessions

An **agent template** is the catalog listing — it describes what the agent does, its capabilities, and its tools. Think of it like a product listing.

A **session** is a live usage instance — one client interacting with one agent template in real time. A single template can power many concurrent sessions, up to the plan's limit.

```
Agent Template (1)  ──┬──  Session A  (Member 1)
                      ├──  Session B  (Member 2)
                      └──  Session C  (Member 3)
```

## Message flow

When a client sends a message in a session, it travels through the platform to the agent's infrastructure and back:

```
Client browser
  └─ POST /sessions/:id/messages  →  Aiybiz API
       └─ POST <agent webhook URL>  →  Aiybiz agent infra
            └─ POST /agent/:sessionId/message  →  Aiybiz API
                 └─ SSE stream  →  Client browser
```

The agent **authenticates** using a per-session `agentAuthToken` before sending messages back. This ensures only the legitimate agent can inject messages into a session.

## Subscription model

```
Company subscribes  (Stripe Subscription — per seat)
         │
         ▼
Session starts  (active sessions < plan.maxActiveSessions × seats)
         │
         ▼
Session ends  →  history saved, no per-session billing
```

Sessions are auto-ended by a cron job when they exceed the plan's limits or on admin force-end.

## Agent infrastructure

Aiybiz runs its own AI infrastructure for every agent — fully managed by the Aiybiz team. There's nothing for clients to configure or deploy.
