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

# Agent Attributes

> Reference for <char-agent> attributes, properties, and auth methods

Reference for the `<char-agent>` custom element.

## Attributes

| Attribute            | Type                                | Description                                 |
| -------------------- | ----------------------------------- | ------------------------------------------- |
| `publishable-key`    | `string`                            | Publishable key used to resolve org context |
| `display-mode`       | `'pip' \| 'inline' \| 'fullscreen'` | Host display mode hint                      |
| `enable-debug-tools` | `boolean`                           | Enables debug tools in embed runtime        |
| `api-base`           | `string`                            | Overrides API base (default production)     |

## Properties

| Property         | Type                  | Description                        |
| ---------------- | --------------------- | ---------------------------------- |
| `publishableKey` | `string \| undefined` | Property form of `publishable-key` |
| `apiBase`        | `string \| undefined` | Property form of `api-base`        |

## Imperative auth API

```ts theme={null}
import type { CharAgentElement } from "@mcp-b/char/web-component";

const agent = document.querySelector("char-agent") as CharAgentElement;

agent.connect({
  publishableKey: "pk_live_...",
  idToken: currentUserIdToken, // optional
});
```

### `connect(options)`

* Requires `publishableKey`
* Accepts optional `idToken`
* Returns `boolean`

### `setAuth(options | null)`

* Wrapper for `connect()` / `disconnect()`
* Pass `null` to clear auth

### `disconnect()`

* Clears auth in the embed runtime
* Returns `boolean`

## Method option types

| Option           | Type     | Required | Notes                                 |
| ---------------- | -------- | -------- | ------------------------------------- |
| `publishableKey` | `string` | Yes      | Org-scoped embed credential           |
| `idToken`        | `string` | No       | End-user identity token from your IDP |

<Warning>
  Only `publishableKey` (required) and `idToken` (optional) are supported in auth methods.
</Warning>

## Events

| Event                       | Detail                         |
| --------------------------- | ------------------------------ |
| `char-initialized`          | `void`                         |
| `char-close`                | `void`                         |
| `char-error`                | `CharErrorDetail`              |
| `char-size-changed`         | `CharSizeChangedDetail`        |
| `char-request-display-mode` | `CharRequestDisplayModeDetail` |
| `char-open-link`            | `CharOpenLinkDetail`           |

<Snippet file="support-cta.mdx" />
