# Set up a Lassen account with an agent

The Lassen CLI connects to one existing business at a time. It reads setup state and uses the same account operations as Studio, Phone & SMS, and Integrations. The person authorizing the CLI should sign in to the intended business and approve the requested access in the browser. Use a dedicated CLI configuration directory for each agent and business.

## Connect your account

Install the Lassen CLI with Bun 1.4.4.

```sh
bun install -g https://lassen.site/cli/lassen-cli.tgz
lassen login --no-open
```

Open the displayed HTTPS link and sign in to Lassen. Review the business and permissions, then approve access. Copy the code from Lassen into the waiting terminal. If you asked a trusted agent to connect, have it send you the approval link and return the code only to that agent. The terminal that started login must remain running. The credential is stored in that terminal's private Lassen configuration directory. Set `LASSEN_CONFIG_DIR` to isolate sessions. For inspection only, request `--read-only` when logging in.

```sh
lassen status
lassen get account
```

`status` returns the connected business, scope, and grant expiry. `get account` returns the business ID, plan and revision, prepaid balance, phone setup status, and existing readiness steps. Check the connected business before any write. Run `logout` or open [Manage CLI access](https://lassen.site/api/cli/grants) to revoke the credential. Grants expire after eight hours.

## Apply a setup file

Start from the account holder's approved hours, services, escalation policy, and caller intake fields. Preview a setup file against the correct business. A setup file may include `assistant`, `agents` (one existing voice agent), `integrations`, `calendar`, `calendar-numbers` (one number override), and `sms`. Use individual commands to configure additional agents or numbers. Omit sections you intend to leave alone.

```json
{
  "businessId": "replace-with-the-id-from-get-account",
  "assistant": {
    "greeting": "Thank you for calling Example Repair. I’m the AI receptionist. How can I help?",
    "instructions": "Collect the caller’s name, callback number, and reason for calling. Offer a callback if the answer isn’t confirmed."
  }
}
```

```sh
lassen setup plan setup.json
lassen setup apply setup.json
lassen get assistant
```

`setup plan` reads the targeted account and lists the sections. The server validates each resource when applying it. If one step fails, the CLI reports the completed and failed steps. Read current state before retrying. A saved assistant revision becomes active when its applied revision catches up.

- **Assistant.** `set assistant assistant.json` accepts a partial update with `greeting`, `instructions`, `voice` for Summit, `economyVoice` for Basecamp, or `transfers`. Use `get assistant` for current values. The CLI uses the current revision and Lassen rejects stale writes. An offline draft from `init` can also be validated and saved with `apply receptionist.json`.
- **SMS.** Export the current registration with `get sms`. Save edits with `set sms sms.json`. The server applies A2P submission validation when the request includes `submit: true`.

## Configure Voice Agents and AI Architect

```sh
lassen get agents
lassen action agent-create new-agent.json
lassen action architect architect.json
lassen set agents agent-update.json
lassen get agents
```

To create an unattached draft, give `agent-create` a `label`, `businessName`, and `purpose`. Supported purposes are `front_desk`, `after_hours`, `intake_campaign`, `department`, and `billing_support`. You can also supply a greeting, instructions, and voices.

Use `get agents` for the saved agent IDs, phone assignments, and `openGaps`. For an AI Architect proposal, supply `messages` (for example `[{"role":"user","text":"Draft a receptionist for our after-hours service."}]`), `currentGreeting`, `currentInstructions`, and the selected agent's `id`, `label`, `businessName`, `phoneNumber`, `purpose`, and `openGaps` inside `agentContext`. Review the proposed greeting, instructions, and gaps before applying them. The command returns JSON and uses the account's existing preview limits.

Save with `set agents` and include the intended `agentId`. For `line_primary`, include `primaryRevision` from `get agents` as `revision`. Re-read the list after saving. `lassen delete agent <id>` removes a draft only when it has no attached number. Manage number purchases, attachment, and releases in **Phone & SMS**.

## Configure integrations and MCP

Run `get integrations` for the current webhooks, transfers, custom fields, and MCP servers. When editing an export, keep its `updatedAt` to detect conflicting saves. `set integrations integrations.json` preserves lists you leave out. A supplied list replaces that list, and an empty list clears it.

Each MCP server needs an `id`, `name`, and public HTTPS `url`. Configure its `transport` (`streamable_http` or `sse`), `authType` (`none`, `bearer`, or `header`), and `authHeaderName` when using custom header authentication. Keep an optional `authSecret` in a private input file. Published output returns only `hasAuthSecret`. Omit the secret when updating the same endpoint and authentication. Changing the endpoint or authentication requires a replacement credential or switching to `none`.

`lassen action mcp-discover mcp.json` lists tools on the specified server. It accepts the same URL and authentication fields. For an existing server you can include its `serverId` and matching endpoint and authentication settings to use the stored credential. Review the result before saving `discoveredTools` and `allowedTools`. Live discovery requires prepaid credit. Disable integrations until the account holder approves the endpoint and tools.

Webhook secrets are similarly redacted. Omit `secretHeader` to keep the secret for that webhook at the same URL, supply a new value to replace it, or use an empty string to clear it.

## Connect a calendar and choose booking destinations

- **Browser approval.** Run `action calendar-connect provider.json` with `{"provider":"google"}`, `{"provider":"microsoft"}`, or `{"provider":"composio","scopeMode":"events_only"}`. Composio uses `events_only` for the primary calendar. Use `full_calendar` when the owner needs to choose from multiple calendars. Have the owner open the returned Lassen link and complete provider consent in the browser.
- **Calendar selection.** Run `get calendar` to read connection and booking settings. For Composio, use `lassen get calendar-calendars <external-account-id>` to list selectable calendars. Use `set calendar calendar.json` with `mode: "external"`, `externalAccountId`, and `calendarId` to select the default external destination. Native calendar setup accepts `provider`, `calendarId`, and appointment rules such as `weeklyHours`.
- **Each phone number.** Use `set calendar-numbers number.json` with `phoneNumber` in E.164 format and a `mode` of `inherit`, `lassen`, `external`, or `off`. For `external`, also provide `externalAccountId` and `calendarId`. Use `get calendar` to verify the override before testing the line.
- **Email and removal.** Run `action calendar-verify-email email.json` with `{"replyTo":"team@example.com"}` to request verification. The account holder opens the email link before enabling booking. Run `action calendar-disconnect connection.json` with `externalAccountId` only after confirming the owner wants to disconnect the external account.

## Activate the phone and verify the result

1. Run `get account`. If it awaits payment, run `action checkout amount.json` with `{"cents":2000}` for the starter pack. Give the returned Stripe checkout link to the account holder to complete payment. Read the account again to verify credit and provisioning. Keep the same `LASSEN_REQUEST_ID` UUID when retrying an uncertain checkout request.
2. Use `get phone` to read configured lines. If Lassen asks you to choose another area code, run `action phone-availability empty.json` with `{}`, then `get area-codes`. Retry with `action phone-setup phone.json` and `{"areaCode":"843"}` or the verified area code the owner picked.
3. For a business configured to bring its Twilio number, use `get twilio` and `action twilio-connect twilio.json`. The existing account verification flow accepts `accountSid`, `apiKeySid`, `apiSecret`, `authToken`, `phoneNumber`, and `numberSid`. Keep provider credentials in a private file outside version control. Confirm the owned number and approval before changing its route.
4. If the owner requests another voice plan, read `get account` and run `action choose-plan plan.json` with `plan` (`premium` or `economy`) and the current `planRevision` as `revision`. The existing readiness and plan checks still apply.
5. Ask a test question with `action test-assistant chat.json`. Example input is `{"messages":[{"role":"user","text":"What services do you provide?"}]}`. Check the reply, then check `get account` and `get assistant` for the active number and applied revision. For a live call, have the owner call the ready number from another phone and verify the result in **Calls**. `get account` also reports whether the account has a settled call.

Account actions return JSON on stdout. Errors go to stderr and return a nonzero exit code. Server-side validation, provider authorization, and human payment approval remain in force. Carrier forwarding on a line outside Lassen is completed with that carrier. [Lassen setup documentation](https://lassen.site/docs)
