Skip to main content

ContextAssemblyApi

@codebolt/client-sdk


Class: ContextAssemblyApi

Defined in: CodeBolt/packages/clientsdk/src/api/context-assembly.api.ts:11

Manages context assembly for agent interactions in the CodeBolt runtime.

Context assembly combines information from multiple sources (memory, files, rules, variables) into a unified context that agents use for decision making. This API handles assembling, validating, and inspecting context configurations.

Constructors​

Constructor​

new ContextAssemblyApi(http: HttpClient): ContextAssemblyApi;

Defined in: CodeBolt/packages/clientsdk/src/api/context-assembly.api.ts:12

Parameters​

ParameterType
httpHttpClient

Returns​

ContextAssemblyApi

Methods​

assemble()​

assemble(data: ContextAssembleRequest): Promise<ContextAssembleResult>;

Defined in: CodeBolt/packages/clientsdk/src/api/context-assembly.api.ts:31

Assembles context from multiple sources.

Gathers and merges data from configured context sources (memory types, rules, files) into a single unified context object for agent consumption.

Parameters​

ParameterTypeDescription
dataContextAssembleRequestThe assembly request specifying sources and parameters

Returns​

Promise<ContextAssembleResult>

A promise that resolves to the assembled ContextAssembleResult

Example​

const context = await client.contextAssembly.assemble({
sources: ['episodic-memory', 'project-files'],
agentId: 'agent-001',
});

evaluateRules()​

evaluateRules(data: EvaluateContextRulesRequest): Promise<unknown>;

Defined in: CodeBolt/packages/clientsdk/src/api/context-assembly.api.ts:89

Evaluates context rules against provided data.

Runs the configured context rules to determine which context sources should be included based on the current state.

Parameters​

ParameterTypeDescription
dataEvaluateContextRulesRequestThe evaluation request with rule inputs

Returns​

Promise<unknown>

A promise that resolves with the rule evaluation results

Example​

const result = await client.contextAssembly.evaluateRules({
variables: { taskType: 'code-review' },
});

getMemoryTypes()​

getMemoryTypes(): Promise<ContextMemoryType[]>;

Defined in: CodeBolt/packages/clientsdk/src/api/context-assembly.api.ts:69

Retrieves available memory types for context assembly.

Returns the list of memory type sources that can be used when assembling context (e.g., episodic, semantic, working memory).

Returns​

Promise<ContextMemoryType[]>

A promise that resolves to an array of ContextMemoryType objects

Example​

const types = await client.contextAssembly.getMemoryTypes();
types.forEach(t => console.log(t.name, t.description));

getRequiredVariables()​

getRequiredVariables(data: GetRequiredVariablesRequest): Promise<string[]>;

Defined in: CodeBolt/packages/clientsdk/src/api/context-assembly.api.ts:110

Retrieves required variables for a context assembly configuration.

Returns the list of variable names that must be provided when assembling context with the given configuration.

Parameters​

ParameterTypeDescription
dataGetRequiredVariablesRequestThe configuration to inspect for required variables

Returns​

Promise<string[]>

A promise that resolves to an array of variable name strings

Example​

const vars = await client.contextAssembly.getRequiredVariables({
sources: ['episodic-memory'],
});
console.log('Required:', vars);

validate()​

validate(data: ValidateContextAssemblyRequest): Promise<unknown>;

Defined in: CodeBolt/packages/clientsdk/src/api/context-assembly.api.ts:51

Validates a context assembly configuration.

Checks that the provided assembly configuration is valid and all referenced sources and rules exist before execution.

Parameters​

ParameterTypeDescription
dataValidateContextAssemblyRequestThe configuration to validate

Returns​

Promise<unknown>

A promise that resolves with the validation result

Example​

const result = await client.contextAssembly.validate({
sources: ['episodic-memory'],
});