Operators

provide

Attach memory layers to descendant steps without creating an isolated context.

Quick Example

import { provide, step } from '@noetic/core';

const withLayers = provide({
  id: 'with-knowledge',
  child: step.llm({
    id: 'researcher',
    model: 'gpt-4o',
    instructions: 'Research the topic thoroughly.',
  }),
  memory: [knowledgeLayer, steeringLayer],
});

What It Does

provide attaches memory layers to a subtree of steps without creating an isolated context. Like React's Context.Provider, layers become available to all descendant steps -- the child shares the parent's ItemLog and conversation history.

This is the primitive for scoping memory layers to a section of your execution tree. Any StepLLM descendant will have access to the provided layers during recall, store, and steering hooks.

spawn and detachedSpawn break the inheritance chain. If a descendant step spawns a child, the provided layers do not propagate into the spawn boundary.

API Reference

PropertyTypeRequiredDescription
idstringYesUnique step identifier
childStep<TMemory, I, O>YesThe step to execute with the provided layers
memoryMemoryConfig | MemoryLayer[]YesMemory layers available to all descendant steps

Example: Scoped Knowledge Layer

Attach a knowledge base layer only to a specific subtree, without affecting sibling steps:

import { provide, step } from '@noetic/core';

const researchPhase = provide({
  id: 'research-with-knowledge',
  child: {
    kind: 'loop',
    id: 'research-loop',
    steps: [step.llm({
      id: 'researcher-llm',
      model: 'gpt-4o',
      instructions: 'You are a research assistant.',
      tools: [searchTool],
    })],
    until: until.noToolCalls(),
    maxIterations: 10,
  },
  memory: [semanticMemory, steeringLayer],
});
  • spawn -- context isolation with spawn-local memory layers.
  • Memory -- memory layer system overview.
  • Overview -- how provide fits into the step primitives.

On this page