Overview
Theinit
function initializes the Lucidic SDK with your credentials, configures providers, and optionally starts a new session. This must be called before any other SDK operations.
Syntax
Parameters
Initialization object with the following properties:
Returns
Returns a Promise that resolves to the session ID (string).Examples
Basic Initialization
With Session Creation
With Custom Configuration
Continue Existing Session
Important Notes
Provider Import Order
Preferred pattern: import providers and pass them viainstrumentModules
:
Auto-End Behavior
WhenautoEnd
is true (default), the SDK:
- Registers exit handlers for graceful shutdown
- Automatically ends active sessions on process exit
- Cleans up telemetry instrumentation
Environment Variables
The SDK checks these environment variables if not provided in config:LUCIDIC_API_KEY
- API key for authenticationLUCIDIC_AGENT_ID
- Agent identifier
Error Handling
See Also
- initSession - Create sessions explicitly
- continueSession - Continue existing sessions
- Quick Start Guide - Getting started tutorial