Skip to content

Configuration ​

Using the CLI?

If you're using the shiplightai CLI, SDK configuration is handled automatically. This page is for direct SDK usage.

SDK Configuration ​

Configure global settings with configureSdk(). Call once at startup before creating agents.

typescript
import { configureSdk, LogLevel } from "@shiplightai/sdk";

configureSdk({
  env: {
    GOOGLE_API_KEY: process.env.GOOGLE_API_KEY!,
  },
  logLevel: LogLevel.INFO,
});

The SDK does not automatically read provider credentials from process.env. Pass each required value through configureSdk({ env }).

Options ​

OptionTypeDefaultDescription
envRecord<string, string>—Runtime configuration and credentials
logLevelLogLevelINFODEBUG, INFO, WARN, ERROR, or SILENT
debugAgentbooleanfalseEnable detailed agent logging
agentLogPathstring—Path for agent log file
consoleLogsPathstring—Path for captured console logs
testResultsJsonPathstring—Path for test results JSON
stderrOnlybooleanfalseRoute SDK log output to stderr

configureSdk() applies a partial update to the process-wide configuration. Use getSdkConfig() to read a copy of the current configuration.

Agent Configuration ​

typescript
import { createAgent } from "@shiplightai/sdk";

const agent = createAgent({
  model: "claude-haiku-4-5",
  computer_use_model: "claude-sonnet-4-6",
  variables: { username: "test@example.com" },
  sensitiveKeys: ["password"],
  testDataDir: "./test-data",
  downloadDir: "./downloads",
});

model is required. The provider is inferred from the model name, or you can use an explicit provider:model value such as openai:gpt-4o.

Agent options ​

OptionTypeDefaultDescription
modelstring—Required primary model
computer_use_modelstringmodelModel for computer-use operations
variablesRecord<string, unknown>{}Initial variables
sensitiveKeysstring[][]Keys withheld from LLM context and masked in logs
testDataDirstring—Base directory for upload fixtures
downloadDirstring—Directory for downloads

Environment Variables ​

VariableDescription
ANTHROPIC_API_KEYDirect key for claude-* models
GOOGLE_API_KEYDirect key for gemini-* models
OPENAI_API_KEYDirect key for gpt-*, o1*, o3*, o4*, and similar models
SHIPLIGHT_API_TOKENShiplight proxy token; can be used instead of a provider key

Provide one credential that can serve the selected model. A matching direct provider key takes precedence over SHIPLIGHT_API_TOKEN.

Additional routing options ​

VariableDescription
OPENAI_BASE_URLOpenAI-compatible base URL; requires OPENAI_API_KEY
SHIPLIGHT_API_URLOverride the Shiplight proxy base URL
GOOGLE_GENAI_USE_VERTEXAISet to "true" to route Gemini through Vertex AI
ANTHROPIC_MODELS_USE_VERTEXAISet to a truthy value to route Claude through Vertex AI
GOOGLE_CLOUD_PROJECTRequired project when a Vertex route is enabled
GOOGLE_CLOUD_LOCATIONRequired Vertex location

Vertex routing uses the model's normal gemini-* or claude-* name plus the flags above. Although vertex:, azure:, and bedrock: are recognized model prefixes, those explicit providers are not implemented and will throw.

Variables ​

Variables are key-value pairs that can be used in instructions as $variableName, ${variableName}, or {{ variableName }}.

typescript
// Set variables
agent.setVariable("username", "test@example.com");
agent.setVariable("password", "secret", true); // withheld from LLM context

// Use in instructions
await agent.act(page, "Fill username with {{ username }}");

// Read back
const value = agent.getVariable("username");

// Extract from page
await agent.extract(page, "the order total", "orderTotal");

createAgent({ variables, sensitiveKeys }) sets initial variables. Calling setVariable() again with sensitive: false removes an existing variable's sensitive designation.

Public exports ​

The package exports:

  • Runtime values: createAgent, Agent, VariableStore, z, configureSdk, getSdkConfig, and LogLevel
  • Types: CreateAgentOptions, LoginOptions, StepOptions, RunOptions, AgentStepResult, ICustomAction, ActionExecutionContext, CustomActionResult, and SdkConfig

Released under the MIT License.