WithRetrievers. Pick one backend per run.
| Backend | Entrypoint |
|---|---|
| Weaviate | go run ./agent_with_retriever/weaviate |
| PostgreSQL + pgvector | go run ./agent_with_retriever/pgvector |
docker/weaviate/sample-documents.json or docker/pgvector/sample-documents.json and re-run up to change corpus content.
Source: examples/agent_with_retriever/
Retriever modes
SetRETRIEVER_MODE in .env (default agentic):
| Mode | Behavior |
|---|---|
agentic | Retriever exposed as a tool; LLM decides when to search |
prefetch | Search runs once before the first LLM call; context injected into system prompt |
hybrid | Prefetch and retriever tools |
Setup
Fromexamples/:
Run examples
SHOW_TELEMETRY=true to compare prefetch vs agentic search counts.
Expected output
task infra:weaviate:up / task infra:pgvector:up. With SHOW_TELEMETRY=true in agentic mode you’ll see total_retriever_searches: 1.
Learn more
Retrieval
Retriever modes and backends
Memory
Long-term memory on same infra