Fabriq
1.x
Docs/Fabriq/Agent Toolkit
Open

Reading3 min
Updated2 Aug 2026
Sourcev1/(ai-agents)/agent-toolkit.mdx

The agent toolkit (core/agent) lets an AI agent use the data fabric as a brain: it retrieves the relevant slice of a large corpus on demand, forms new memory under policy, and stays current as the world changes. It operates only on the existing query.Fabric facade — no new storage, no engine coupling — so everything an agent can recall or write rides the same tenancy, eventing, and projection invariants as the rest of fabriq.

Note

An agent's context window holds ~1 MB of text; a corpus is gigabytes (~1000×). The toolkit never loads the corpus — it returns the ranked, budget-fitted slice the model needs for the turn. Embeddings, graph edges, and projections are the compression that lets a small window reach into a large base.

The shape01

Two front doors over one core:

Native Go agents (in-process)

Import

Unsupported
<code>
  core/agent
</code>
, build a
Unsupported
<code>
  Toolkit
</code>
over the facade, and call it directly — zero network hops. The hot wire.

Any agent (over MCP)

The

Unsupported
<code>
  forgeext/agentmcp
</code>
Forge extension exposes the
Unsupported
<em>
  same
</em>
tool handlers over MCP (JSON-RPC
Unsupported
<code>
  tools/list
</code>
/
Unsupported
<code>
  tools/call
</code>
) so any LLM agent can reach them.

import "github.com/xraph/fabriq/core/agent"

tk, err := agent.NewToolkit(f, f.Registry(), embedder, agent.Config{
    Write: agent.WritePolicy{Allow: map[string][]command.Op{
        "note": {command.OpCreate, command.OpUpdate},
    }},
})

// Recall: the auto-context front door.
pack, err := tk.Recall(ctx, agent.RecallRequest{
    Query:    "overheating pumps at the north site",
    Budget:   8000, // token budget for the returned context pack
    Entities: []string{"asset", "note"},
})

// Remember: guarded memory formation through the command plane.
res, err := tk.Remember(ctx, agent.RememberRequest{
    Entity: "note", Op: "create", Payload: []byte(`{"title":"…","body":"…"}`),
})

// Watch: react to live deltas.
deltas, err := tk.Watch(ctx, query.SubscribeScope{Entity: "asset", Scope: "tenant"})

What it does02

The Embedder seam03

Semantic recall and auto-indexing both need to turn text into vectors. Fabriq stores vectors (the vector plane) but does not produce them — the host supplies an Embedder, exactly the way it supplies auth:

// Embedder turns text into vectors. The host wires the model
// (Anthropic, OpenAI, a local model); fabriq stays model-agnostic.
type Embedder interface {
    Embed(ctx context.Context, texts []string) ([][]float32, error)
    Dims() int
}

Dims() is validated against the vector port at NewToolkit. With no embedder wired, recall still works — it degrades to the lexical and relational channels and records a warning on the result, rather than failing.

Note

The toolkit is transport-agnostic: core/agent imports no Forge, no HTTP, and no MCP. Cognition (embedding orchestration, fusion, token-budgeting) lives in the core; transport and auth live in the agentmcp Forge shell — the same "primitives in core, policy in the seam" discipline as the rest of fabriq.