Documentation
¶
Overview ¶
Command agent shows how to give an agent X-Ray as its memory through the Go SDK. It is provider-neutral: the model is an interface, and the example runs with a scripted model so it works with no API key. To use a real model, implement Model for your provider and pass it to NewAgent.
go run ./examples/agent # X-Ray in this process XRAY_URL=http://localhost:8083/mcp XRAY_TOKEN=... go run ./examples/agent
With no XRAY_URL the agent runs X-Ray's memory store inside its own process and keeps it in agent-memory.json, so what it learns survives a restart. With XRAY_URL it uses a shared X-Ray over MCP. The agent code is the same for both, because the in-process store and the remote client implement xray.Memory.
The agent does three things with X-Ray:
- Recall. Before it answers, it searches memory for the question and puts what it finds in the system prompt, each item with its id and origin.
- Tools. It hands the model three memory tools, so the model decides what is worth saving and what is wrong.
- Evidence. Anything the model saves is linked to the items that were in front of it, so refuting a fact later retires what was drawn from it.
Click to show internal directories.
Click to hide internal directories.