Yolk SDK
Integrations

Add knowledge search

Ingest documents, search them, and expose results as an agent tool.

Use this when agents need access to app documents, notes, files, or durable memory.

Ingest documents

Fragment; supply loadedSource and HostKnowledgeLayer from your app:

import { Effect } from 'effect'
import { KnowledgeDocumentId, KnowledgeScopeId } from '@yolk-sdk/knowledge/documents'
import { ingestKnowledgeDocument } from '@yolk-sdk/knowledge/ingestion'

await Effect.runPromise(
  ingestKnowledgeDocument({
    scopeId: KnowledgeScopeId.make('workspace-docs'),
    documentId: KnowledgeDocumentId.make('doc_123'),
    source: loadedSource
  }).pipe(Effect.provide(HostKnowledgeLayer))
)

These are trusted example constants. Decode external/persisted IDs with Schema.decodeUnknownEffect before passing them to branded contracts; see Knowledge identities. Your app still checks permissions.

Your app provides extraction, chunking, embedding, summarization, and store layers. For file bytes, @yolk-sdk/extractors/knowledge can provide the extraction layer; see Ingestion pipeline. The pipeline updates SearchIndexStore, not KnowledgeStore, and is not a cross-operation transaction; your adapter owns atomic chunk replacement and rollback policy.

import { Effect } from 'effect'
import { searchKnowledge } from '@yolk-sdk/knowledge/search'

const results = await Effect.runPromise(
  searchKnowledge({
    scope,
    query: 'How does HITL work?',
    mode: 'hybrid',
    limit: 5,
    contextChunks: 1
  }).pipe(Effect.provide(HostKnowledgeLayer))
)

Filter the store to host-approved ready documents with active availability. The search helper does not apply status or availability policy itself.

Expose as tool

import { Effect } from 'effect'
import { makeKnowledgeLookupTool } from '@yolk-sdk/knowledge/agent'

const tool = makeKnowledgeLookupTool(HostKnowledgeLookupHandlers)

Resolve the tool with @yolk-sdk/agent/tools and pass it to the loop.

On this page