ragnotify

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package ragnotify implements agent.DocFinder over an MCP retrieval server (e.g. ragtag) — the concrete half of agentkit's proactive-retrieval seam.

agent owns the neutral machinery (DocFinder + FinderPreparer in agent/finder.go): observe the conversation, gate/cap/dedup, inject pointer notices. This package owns the one thing agent must NOT (invariant #2: agent imports only llm + mcpmgr + stdlib) — talking to an actual retrieval backend. It depends on agent + mcpmgr only.

The whole integration is: point the SAME MCP server at both channels.

  • Explicit: advertise the server's search tool to the model normally (the mcpToolDefs bridge). The model calls it when it knows to.
  • Passive: wrap that same tool in an MCPFinder and hand it to agent.FinderPreparer. A pointer notice says "doc X looks relevant"; the model fetches the body with the tool it already has.

Reranking is the server's job. This finder passes the conversation text straight to the tool and trusts the ordering/scores it returns — agent's MinScore/MaxHits only trims a pre-ranked list. If ragtag returns raw vector top-k without a reranker, expect noise regardless of MinScore.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MCPFinder

func MCPFinder(mgr *mcpmgr.Manager, serverID, toolName string, opts Opts) agent.DocFinder

MCPFinder returns an agent.DocFinder backed by an MCP search tool on mgr. serverID + toolName name the ragtag server and its search tool (the same tool you advertise to the model for the explicit channel).

func ParseHits

func ParseHits(raw string) ([]agent.DocHit, error)

ParseHits maps a ragtag search result string onto []agent.DocHit. It accepts either a bare JSON array of hits or an object wrapping them under "hits" / "results" / "documents" — the shapes retrieval servers commonly return. A hit missing an id is dropped (the id is the dedup + fetch key). Exported so a host with a different wire shape can test its own adapter against this one.

Types

type Opts

type Opts struct {
	// QueryArg is the tool argument that carries the query text. Default "query".
	QueryArg string
	// ExtraArgs are merged into every call (e.g. {"top_k": 8, "strategy":
	// "hybrid"}) — this is where you pin the server's rerank strategy.
	ExtraArgs map[string]any
	// Join combines the observed entry texts into one query string. Default:
	// newline-join (most recent conversation turns as one query).
	Join func(texts []string) string
}

Opts configures how the conversation text maps onto an MCP tool call and how the tool's JSON result maps back onto []agent.DocHit. All fields default; a backend with different field names overrides them without touching agent.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL