Skip to content

Configuration

The Lota SDK is configured through the LotaRuntimeConfig object passed to createLotaRuntime(). This page covers every configuration field and the environment variables they map to.

LotaRuntimeConfig

ts
import { createLotaRuntime } from '@lota-sdk/core'

const runtime = await createLotaRuntime({
  database: { url, namespace, username, password },
  redis: { url },
  aiGateway: { url, key, admin, pass, embeddingModel },
  s3: { endpoint, bucket, region, accessKeyId, secretAccessKey, attachmentUrlExpiresIn },
  firecrawl: { apiKey, apiBaseUrl },
  logging: { level },
  memory: { searchK },
  workstreams: { bootstrap: { /* ... */ } },
  agents: { /* ... */ },
  turnHooks: { /* ... */ },
  runtimeAdapters: { /* ... */ },
  pluginRuntime: { /* ... */ },
  toolProviders: { /* ... */ },
  extraSchemaFiles: [],
  extraWorkers: {},
})

database

FieldTypeDescription
urlstringSurrealDB WebSocket URL (e.g. ws://localhost:8003)
namespacestringSurrealDB namespace
usernamestringSurrealDB username
passwordstringSurrealDB password

The SDK database name is fixed to lotasdk; consumers do not configure it.

redis

FieldTypeDescription
urlstringRedis connection URL (e.g. redis://localhost:6382)

aiGateway

FieldTypeDescription
urlstringBifrost AI gateway URL
keystringBifrost virtual key (must start with sk-bf-)
adminstring?Gateway admin endpoint (optional)
passstring?Gateway admin password (optional)
embeddingModelstring?Embedding model ID. Defaults to openai/text-embedding-3-small

s3

FieldTypeDescription
endpointstringS3-compatible endpoint URL
bucketstringS3 bucket name
regionstring?S3 region. Defaults to garage
accessKeyIdstringS3 access key
secretAccessKeystringS3 secret key
attachmentUrlExpiresInnumber?Presigned URL expiry in seconds. Defaults to 1800

firecrawl

FieldTypeDescription
apiKeystringFirecrawl API key (must start with fc-)
apiBaseUrlstring?Custom Firecrawl API base URL

logging

FieldTypeDescription
levelstring?One of trace, debug, info, warning, error, fatal. Defaults to info

memory

FieldTypeDescription
searchKnumber?Number of memory results returned per search. Defaults to 6

workstreams

Use workstreams.bootstrap to define host-specific provisioning rules instead of relying on SDK hardcoded agents or core types.

ts
workstreams: {
  bootstrap: {
    onboardingDirectAgents: ['chief'],
    completedDirectAgents: ['chief', 'ceo', 'cto'],
    coreTypesAfterOnboarding: ['daily-activities', 'gtm'],
    ensureDefaultGroupOnCompleted: true,
    onboardingWelcome: {
      directAgentId: 'chief',
      buildMessageText: ({ userName }) => `Hello ${userName ?? 'there'}`,
    },
  },
}
FieldTypeDescription
bootstrap.onboardingDirectAgentsreadonly string[]?Direct workstreams created before onboarding is complete
bootstrap.completedDirectAgentsreadonly string[]?Direct workstreams created once onboarding is complete
bootstrap.coreTypesAfterOnboardingreadonly string[]?Group core workstream types provisioned after onboarding
bootstrap.ensureDefaultGroupOnCompletedboolean?Whether to guarantee one standard non-core group workstream after onboarding
bootstrap.onboardingWelcomeobject?Optional first assistant turn inserted into a configured direct workstream

Agent Configuration

The agents field controls which agents are registered and how they are created.

ts
agents: {
  roster: ['chief', 'ceo', 'cto', 'cpo', 'cmo', 'cfo', 'mentor'],
  displayNames: {
    chief: 'Chief',
    ceo: 'CEO',
    cto: 'CTO',
    cpo: 'CPO',
    cmo: 'CMO',
    cfo: 'CFO',
    mentor: 'Mentor',
  },
  shortDisplayNames: { chief: 'Chief', ceo: 'CEO' },
  teamConsultParticipants: ['ceo', 'cto', 'cpo', 'cmo', 'cfo', 'mentor'],
  getCoreWorkstreamProfile: (coreType) => ({ /* ... */ }),
  createAgent: (agentId, options) => { /* ... */ },
  buildAgentTools: (agentId, context) => { /* ... */ },
  getAgentRuntimeConfig: (agentId) => { /* ... */ },
}
FieldTypeDescription
rosterreadonly string[]All agent IDs available in the runtime
displayNamesRecord<string, string>Human-readable names for agents
shortDisplayNamesRecord<string, string>?Abbreviated display names
teamConsultParticipantsreadonly string[]Agent IDs that participate in consultTeam
getCoreWorkstreamProfilefunctionReturns profile config for core workstream types
createAgentfunctionFactory function for creating agent instances
buildAgentToolsfunctionBuilds the tool set for a given agent
getAgentRuntimeConfigfunctionReturns runtime configuration for an agent

Turn Hooks

Turn hooks let consumers customize the workstream turn lifecycle. See the Hooks API for full signatures.

ts
turnHooks: {
  buildContext: async (params) => { /* return context */ },
  afterTurn: async (params) => { /* post-turn side effects */ },
  resolveAgent: async (params) => { /* return agent config */ },
  buildExtraInstructionSections: async (params) => ['<section>...</section>'],
}
HookDescription
buildContextCalled before agent execution to assemble the full context payload
afterTurnCalled after the SDK completes the turn so the host can trigger non-critical side effects
resolveAgentResolves agent configuration and routing for a given turn
buildExtraInstructionSectionsReturns additional XML instruction sections injected into the system prompt

Plugin Runtime

Plugins are registered via pluginRuntime. Each plugin contributes services, tools, env keys, and schema files.

ts
pluginRuntime: {
  github: githubPlugin,
  linear: linearPlugin,
}

Each plugin implements the LotaPlugin interface:

ts
interface LotaPlugin<TServices, TTools> {
  services: TServices
  tools?: TTools
  contributions: {
    envKeys: readonly string[]
    schemaFiles: readonly (string | URL)[]
  }
}

If a plugin exposes a connectDatabase() service method, call await runtime.connectPluginDatabases() during host startup.

Tool Providers

Register extra runtime-owned tools that should be merged into the shared tool registry:

ts
toolProviders: {
  myTool: createMyTool(),
}

Runtime Adapters

Use runtimeAdapters when the generic SDK runtime needs to call back into host-owned product behavior without importing host code directly.

ts
runtimeAdapters: {
  services: {
    workspaceProvider,
  },
  workstream: {
    buildIndexedRepositoriesContext,
    buildTeamThinkAgentTools,
  },
  queues: {
    enqueuePostChatOrgAction,
    enqueueOnboardingRepoIndexFollowUp,
  },
  workers: {
    connectPluginDatabases,
    withWorkspaceMemoryLock,
  },
}
FieldDescription
services.workspaceProviderHost workspace lifecycle, projection, retrieval, and cursor access
workstream.buildIndexedRepositoriesContextBuilds host-specific repository context for the turn runtime
workstream.buildTeamThinkAgentToolsAdds host-specific tools for team-think style agent execution
queues.enqueuePostChatOrgActionLets the SDK enqueue a host-owned post-turn org-action job
queues.enqueueOnboardingRepoIndexFollowUpLets the SDK enqueue a host-owned onboarding repo follow-up job
workers.connectPluginDatabasesHost hook for plugin DB initialization
workers.withWorkspaceMemoryLockHost-provided distributed lock wrapper for workspace memory work

Environment Variables

The SDK validates its environment internally. When using createLotaRuntime(), all env values are passed through the config object. The underlying Zod schemas provide the validation:

VariableDefaultNotes
AI_GATEWAY_URLRequiredBifrost gateway URL
AI_GATEWAY_KEYRequiredMust start with sk-bf-
AI_GATEWAY_ADMIN-Optional admin endpoint
AI_GATEWAY_PASS-Optional admin password
AI_EMBEDDING_MODELopenai/text-embedding-3-smallEmbedding model routed through Bifrost
REDIS_URLRequiredRedis connection string
LOG_LEVELinfotrace / debug / info / warning / error / fatal
S3_ENDPOINTRequiredS3-compatible endpoint
S3_BUCKETRequiredBucket name
S3_REGIONgarageRegion identifier
S3_ACCESS_KEY_IDRequiredS3 access key
S3_SECRET_ACCESS_KEYRequiredS3 secret key
ATTACHMENT_URL_EXPIRES_IN1800Presigned URL expiry (seconds)
FIRECRAWL_API_KEYRequiredMust start with fc-
FIRECRAWL_API_BASE_URL-Optional custom base URL
MEMORY_SEARCH_K6Results per memory search

Extra Schema Files

Add consumer-owned SurrealDB schema files that are applied at startup alongside built-in schemas:

ts
extraSchemaFiles: [
  '/path/to/my-custom-table.surql',
]

Extra Workers

Register consumer-provided BullMQ workers alongside the built-in queues:

ts
extraWorkers: {
  myCustomQueue: myWorkerFactory,
}

These entries are merged onto runtime.workers.