Skip to main content

Aventora Intake (Flutter)

Embedding-style form intake client: connects to the Aventora agent WebSocket as an anonymous user, with forms_enabled: true. Domain and target form id come from assets/intake.env (same idea as the HTML embedding samples under aventora-bot/embedding/).

The agent is expected to run with SECURE_AGENT=true. Before each WebSocket session the app obtains a JWT by:

  1. POST {INTAKE_API_BASE_URL}/auth/api/v1/tokens/generate with header Authorization: Bearer {INTAKE_DOMAIN_API_KEY} and JSON body username: "anonymous", language, expires_in_hours (same pattern as domain API keys used for embedding / internal services).
  2. POST {INTAKE_API_BASE_URL}/auth/autologin with JSON { "token": "<temporary token from step 1>" } and uses access_token as the session JWT on the socket (?token= query + token in the first metadata message).

Start over closes the socket and runs that flow again (new temporary token, new JWT, new session).

On launch the app connects immediately; after the server sends connection, it optionally sends one bootstrap user message so the model can select_form for INTAKE_FORM_ID.

Configure assets/intake.env

KeyPurpose
AGENT_WS_URLe.g. ws://127.0.0.1:7861/ws (Android emulator → ws://10.0.2.2:7861/ws)
INTAKE_DOMAINDomain folder under SEARCH_DOMAIN_FOLDER (must contain form-depo/)
INTAKE_FORM_IDForm schema id (e.g. contact_form, mortgage_quote from LLM_full/domains/demo/form-depo/)
INTAKE_LANGUAGEe.g. en
INTAKE_API_BASE_URLHTTP base for auth (same as backend BACKEND_URL), e.g. https://api.example.com
INTAKE_DOMAIN_API_KEYDomain API key for /auth/api/v1/tokens/generate
AGENT_JWTDev/test only: if set, skips the two-step mint and uses this JWT directly

Overrides without editing the file

flutter run --dart-define=INTAKE_DOMAIN=demo --dart-define=INTAKE_FORM_ID=mortgage_quote

AGENT_WS_URL, INTAKE_API_BASE_URL, INTAKE_DOMAIN_API_KEY, and other keys support the same pattern.

Run

cd aventora-intake
flutter pub get
flutter run

Reference

For a parallel “configure URL + domain + embed” mental model, see aventora-bot/embedding/ (static HTML embeds). This app is the Flutter equivalent for intake-only sessions, with API-key → JWT aligned to how internal services authenticate (LLM/utils/internal_auth.py uses generate; this client adds autologin because the WebSocket validates a JWT, not the raw temporary token).