Skip to main content
This appendix provides a quick reference for the foundational concepts covered throughout the book.

The Ten Elements

ElementDefinitionKey Insight
ContextThe complete information available for a single LLM callContext is ephemeral—reconstructed every call
MemoryPersistent storage across callsMemory stores; context loads
AgencyThe ability to cause effects beyond textAgency = causality, not just text generation
ReasoningStructured thinking for complex problemsSplit generation and evaluation into separate calls
CoordinationManaging work across componentsDesign handoffs like API contracts
ArtifactsSemantic objects with structure and operationsShared state coordinates implicitly
AutonomySelf-directed operationAutonomy requires boundaries
EvaluationMeasuring whether things workRun evals continuously, not once
FeedbackSignals that drive immediate improvementGood feedback is specific and actionable
LearningAccumulated improvement over timeSystems improve through use

Storage Structures

Arrays

  • Access: O(1) by index, O(n) search
  • Use for: Conversation history, event logs, queues
  • Operations: push, slice, filter, map
@field messages: Message[] = [];

// Append
this.messages.push({ role: 'user', content: input });

// Access recent
const recent = this.messages.slice(-10);

// Filter
const userMessages = this.messages.filter(m => m.role === 'user');

Maps

  • Access: O(1) by key
  • Use for: User preferences, entity data, keyed lookup
  • Operations: get, set, has, delete
@field preferences: Map<string, string> = new Map();

// Set
this.preferences.set('language', 'en');

// Get
const lang = this.preferences.get('language') || 'en';

// Check existence
if (this.preferences.has('theme')) { ... }

Vector Stores

  • Access: O(log n) approximate nearest neighbor
  • Use for: Semantic search, knowledge bases, similar item retrieval
  • Operations: insert, search, delete
@field knowledge: VectorStore<KnowledgeEntry>;

// Insert
await this.knowledge.insert({ content: 'fact', source: 'doc' });

// Search by meaning
const relevant = await this.knowledge.search(query, 5);

Retrieval Patterns

PatternImplementationBest For
By recencyarray.slice(-n)Conversation context
By keymap.get(key)Known identifiers
By similarityvectorStore.search(query, k)Semantic relevance
By queryarray.filter(predicate)Conditional access
HybridCombine multiple patternsComplex context assembly

Flow Patterns

Sequential

Operations that depend on each other:
const plan = await this.plan(task);
const result = await this.execute(plan);
const verified = await this.verify(result);

Parallel

Independent operations that can run simultaneously:
const [research, context, history] = await Promise.all([
  this.research(topic),
  this.gatherContext(topic),
  this.loadHistory(userId)
]);

Conditional

Branching based on classification or state:
switch (intent.category) {
  case 'faq': return this.faqHandler.handle(input);
  case 'technical': return this.techHandler.handle(input);
  default: return this.generalHandler.handle(input);
}

Iterative

Loops with termination conditions:
while (!verification.passed && attempts < maxAttempts) {
  const revised = await this.improve(output, verification.errors);
  verification = await this.verify(revised);
  attempts++;
}

Coordination Patterns

Pipeline

Sequential handoffs through stages:
Ideation → Research → Draft → Edit → Review → Publish

Hub and Spoke

Central coordinator delegates to specialists:
         ┌─── Worker A
Coordinator ─┼─── Worker B
         └─── Worker C

Swarm

Peers coordinate through shared state:
Worker A ──┐
Worker B ──┼── Shared Artifact
Worker C ──┘

Feedback Signal Types

Signal TypeExampleActionability
Compilation errorsUnexpected token at line 42High—specific location
Test failuresExpected 5, got 4High—expected vs actual
Type errorsType 'string' not assignable to 'number'High—type mismatch
Validation errorsMissing required field 'email'High—structural
Quality scoresRelevance: 0.7Medium—direction but not action
Human feedbackThis doesn't address my questionMedium—requires interpretation

Autonomy Boundaries

Boundary TypePurposeImplementation
Iteration limitsPrevent infinite loopsif (iterations > max) break
Time limitsBound execution durationif (elapsed > timeout) abort()
Scope limitsRestrict available actionsPermission levels on tools
Progress checksDetect stuck statesCompare progress across iterations
Kill switchesEmergency haltExternal control mechanism

Evaluation Dimensions

DimensionQuestionMetrics
CorrectnessIs the output right?Factual accuracy, task completion, format compliance
QualityIs the output good?Relevance, completeness, clarity
EfficiencyWhat did it cost?Tokens, latency, API calls, dollars
ReliabilityDoes it work consistently?Success rate, error rate, variance

Learning Types

TypeWhat’s LearnedStorageApplication
KnowledgeFacts, informationVector storeRetrieval into context
PatternsWhat works for whatPattern libraryStrategy selection
PreferencesUser/context adaptationsUser profilesPersonalization
SkillsBetter approachesPrompt variantsGeneration improvement