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

# JavaScript SDK

> Prepare a framework-independent browser integration with explicit initialization, event cleanup, and supported session access.

Use this page to plan an agent interface in a plain JavaScript application. There is no verified public Threetone browser SDK package, CDN script, or installation command in the current documentation.

## Prepare the browser boundary

Keep workspace API keys on a trusted server. The future client integration needs an authoritative package or script, a supported session-access flow, and a documented message contract. A browser `fetch` call to a resource endpoint is not a conversation transport.

<Steps>
  <Step title="Choose a single initialization point">
    Decide which page controller owns the interface. On applications that navigate without a full reload, define how entering and leaving a route mounts and disposes that controller. Prevent duplicate script loads and duplicate event listeners.
  </Step>

  <Step title="Design start and end controls">
    Use explicit visitor actions. Disable repeated starts while connecting, show a useful error on failure, and make ending the interaction available throughout an active session. Keep a fallback contact route outside the interface.
  </Step>

  <Step title="Plan resource cleanup">
    List each subscription, timer, network connection, and media resource the interface owns. Connect cleanup to the released client API and the page controller's disposal. Confirm that ending or leaving the page stops owned audio and event processing.
  </Step>
</Steps>

For voice, browser microphone access requires a secure context and permission. Handle a denied request and unavailable hardware as ordinary interface states. Review [browser microphone requirements](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) before testing an embedded voice interface.

## Before installing a release

Verify the exact distribution origin, versioning policy, export names, supported browsers, and session initialization contract. Test loading failures, slow connections, access expiry, repeated navigation, and cleanup. If an integration uses a socket, follow the released protocol rather than guessing a URL from REST endpoints; see [WebSocket preparation](/agents-platform/deploy/server/websockets).

Use the [TypeScript server example](/agents-platform/resources/sdks/typescript) for supported resource reads and [widget preparation](/agents-platform/deploy/web/widget) for an embedded interface.

## Frequently asked questions

<AccordionGroup>
  <Accordion title="Is there a CDN script I can paste into any page?" id="javascript-sdk-faq-cdn">No verified production script is supplied here. Use only the distribution URL documented by a released Threetone widget or client package.</Accordion>
  <Accordion title="Can I rename an internal event and use it in my application?" id="javascript-sdk-faq-events">Only a released client event contract defines supported messages and behavior. Internal event names are not a stable integration contract.</Accordion>
</AccordionGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.