# How to Access Configuration Values Programmatically in Continue Dev

> Learn how to access configuration values programmatically in Continue Dev using its CLI, ConfigService, or ConfigHandler APIs. Unlock runtime settings for your development workflow.

- Repository: [Continue/continue](https://github.com/continuedev/continue)
- Tags: how-to-guide
- Published: 2026-06-18

---

**Continue Dev exposes runtime configuration as an `AssistantUnrolled` object available through three primary APIs: the CLI's `loadConfiguration` function, the `ConfigService` state manager, or the core `ConfigHandler.loadConfig()` method.**

Continue Dev stores assistant configurations as fully-expanded `AssistantUnrolled` objects that contain models, rules, MCP servers, and UI settings. When building extensions or integrations for the `continuedev/continue` repository, you can programmatically access these values using type-safe APIs that resolve configuration from local YAML files, remote sources, or CLI overrides.

## Access Configuration via the CLI Loader

The **`loadConfiguration`** function in [`extensions/cli/src/configLoader.ts`](https://github.com/continuedev/continue/blob/main/extensions/cli/src/configLoader.ts) serves as the central entry point for CLI-based applications. This function reads configuration from the selected source—whether a CLI flag, saved URI, local [`config.yaml`](https://github.com/continuedev/continue/blob/main/config.yaml), or remote default—resolves all package identifiers, and returns an object containing both the config and its source metadata.

This approach is ideal for custom CLI commands or standalone scripts that need to bootstrap the full configuration without running the entire service layer.

```typescript
import { loadConfiguration } from "./extensions/cli/src/configLoader.js";
import { loadAuthConfig } from "./extensions/cli/src/auth/workos.js";
import { DefaultApi } from "@continuedev/sdk/dist/api/index.js";

async function readConfig() {
  const auth = loadAuthConfig();
  const apiClient = new DefaultApi();
  const result = await loadConfiguration(
    auth,
    undefined,    // no --config flag override
    apiClient,
    [],           // no additional injected blocks
    false,        // not headless mode
  );

  // result.config is typed as AssistantUnrolled
  console.log("Chat model:", result.config.modelsByRole?.chat);
  console.log("Rules:", result.config.rules);
}
readConfig();

```

## Access Configuration via ConfigService

The **`ConfigService`** maintains configuration in a Redux-style state object, making it the standard pattern for core services like `ModelService` and `ToolPermissionService`. Located in [`extensions/cli/src/services/ConfigService.ts`](https://github.com/continuedev/continue/blob/main/extensions/cli/src/services/ConfigService.ts), this service wraps `loadConfiguration` and exposes the loaded config through its `state.config` property.

Use this method when your code runs within the Continue service container and needs reactive access to configuration values.

```typescript
import { serviceContainer } from "./extensions/cli/src/services/ServiceContainer.js";

// Initialize the service (typically done at application startup)
await serviceContainer.get("ConfigService").initialize();

// Access the loaded configuration
const config = serviceContainer.get("ConfigService").state.config;

// Example: enumerate MCP servers
if (config?.mcpServers?.length) {
  config.mcpServers.forEach(s => console.log(`${s.name} → ${s.url}`));
}

```

## Access Configuration via Core ConfigHandler

For UI code or extensions running inside the GUI, the **`ConfigHandler`** class in [`core/config/ConfigHandler.ts`](https://github.com/continuedev/continue/blob/main/core/config/ConfigHandler.ts) provides the core-level API. Its `loadConfig()` method returns a **`ConfigResult<ContinueConfig>`** containing the parsed configuration alongside any validation errors.

This approach is essential when you need to handle configuration validation gracefully or when operating in browser-based contexts where the CLI loader is unavailable.

```typescript
import { ConfigHandler } from "./core/config/ConfigHandler.js";

async function getBrowserConfig() {
  const handler = new ConfigHandler();
  const result = await handler.loadConfig();   // returns ConfigResult<ContinueConfig>

  if (result.errors?.length) {
    console.error("Config validation errors:", result.errors);
    return;
  }

  const cfg = result.config; // typed as ContinueConfig
  console.log("Available models:", cfg.modelsByRole);
}
getBrowserConfig();

```

## Understanding the AssistantUnrolled Structure

All three access methods ultimately resolve to an **`AssistantUnrolled`** object (or a wrapped `ConfigResult` containing it). This interface represents the fully-expanded configuration after YAML unrolling and package resolution, defined in `@continuedev/config-yaml` and re-exported throughout the codebase.

```typescript
interface AssistantUnrolled {
  name: string;
  version: string;
  rules: string[];
  mcpServers: { name: string; url: string }[];
  prompts: string[];
  modelsByRole: {
    chat?: ModelDescription;
    edit?: ModelDescription;
    apply?: ModelDescription;
    // ... additional roles
  };
  // Additional fields for tools, UI configuration, etc.
}

```

You can read any field directly, such as `config.modelsByRole.chat` for the active chat model or `config.rules` for system instructions. The type definitions live in [`packages/config-yaml/src/load/unroll.ts`](https://github.com/continuedev/continue/blob/main/packages/config-yaml/src/load/unroll.ts) and [`packages/config-yaml/src/validation.ts`](https://github.com/continuedev/continue/blob/main/packages/config-yaml/src/validation.ts) for the `ConfigResult` wrapper.

## Summary

- **CLI environments** should use **`loadConfiguration`** from [`extensions/cli/src/configLoader.ts`](https://github.com/continuedev/continue/blob/main/extensions/cli/src/configLoader.ts) to resolve configuration from files or remote sources.
- **Service-layer code** should access **`configService.state.config`** after initializing the `ConfigService` to obtain reactive configuration state.
- **GUI or browser extensions** should use **`ConfigHandler.loadConfig()`** from [`core/config/ConfigHandler.ts`](https://github.com/continuedev/continue/blob/main/core/config/ConfigHandler.ts) to receive validated configuration with error handling.
- All methods return an **`AssistantUnrolled`** object containing `modelsByRole`, `rules`, `mcpServers`, and other assistant settings.

## Frequently Asked Questions

### What is the difference between ConfigService and ConfigHandler?

**ConfigService** is a higher-level service wrapper used in the CLI backend that maintains configuration in a reactive state object for dependency injection across services. **ConfigHandler** is the core configuration loader used by the GUI and browser extensions that returns a `ConfigResult` with validation errors. Use ConfigService for backend service development and ConfigHandler for frontend or core API integration.

### How do I handle configuration validation errors programmatically?

When using the **core ConfigHandler**, check the `result.errors` array returned by `loadConfig()`. This array contains validation errors from [`packages/config-yaml/src/validation.ts`](https://github.com/continuedev/continue/blob/main/packages/config-yaml/src/validation.ts). For CLI loader usage, validation errors typically throw exceptions or return error states depending on the `loadConfiguration` implementation, so wrap calls in try-catch blocks or check the return type documentation.

### Where are the TypeScript definitions for configuration objects?

The primary definitions reside in **`@continuedev/config-yaml`**. Specifically, [`packages/config-yaml/src/load/unroll.ts`](https://github.com/continuedev/continue/blob/main/packages/config-yaml/src/load/unroll.ts) defines the `AssistantUnrolled` interface, while [`packages/config-yaml/src/validation.ts`](https://github.com/continuedev/continue/blob/main/packages/config-yaml/src/validation.ts) exports `ConfigResult<T>` and validation error types. These are re-exported throughout the `continuedev/continue` repository for consistent typing across CLI, core, and GUI packages.

### Can I modify configuration values at runtime?

The configuration objects returned by these APIs are typically mutable JavaScript objects, but changes made programmatically do not persist back to the source YAML files automatically. To modify configuration permanently, you must write changes to the underlying [`config.yaml`](https://github.com/continuedev/continue/blob/main/config.yaml) or use the appropriate save methods provided by the SDK or extension APIs, then reload the configuration through one of the three access methods.