Skip to main content
An agent’s file history is every deliverable its sessions saved: files written with write_artifact or placed in the deliverables folder, including those saved by the sessions’ subagents and teammates. Turn on File history for an agent, and each new session can search that history and read what it finds, so work from earlier runs is not lost or redone.

Before you begin

How it works

  • The history belongs to the agent. A deliverable is kept in the history of the agent the session was started from, including deliverables saved by its subagents, teammates, and other agents it delegated to. Those helpers search the same history while they work in that session. A session started from another agent never sees it, and neither does an outcome grader.
  • Sessions search on demand. A session is told the history exists, but no files are loaded into it up front. The agent decides when a search is worth making.
  • Earlier sessions only. A session sees deliverables saved before it started, not its own work in progress.
  • Current access is checked every time. A deleted file, a deleted session’s deliverables, and deliverables of sessions with restricted access are left out. Turning File history off stops the next search of every running session.

Turn on file history

  1. In the sidebar, click Agents and open the agent.
  2. On Configuration, under Tools, select File history.
  3. Click Save.
Sessions started after the change get the tools. Sessions already running keep the tools they started with, but a search fails once the setting is off.

Make deliverables easy to find

Metadata makes a search exact. Ask the agent to label what it saves: A search can then ask for kind equal to report and quarter equal to Q3 and get exactly those files. See Label deliverables with metadata.

What a session can do

The session’s agent uses two tools. You can also name them in prompts, for example “Search your file history for last quarter’s report before writing this one.”

Metadata conditions

Each condition names a top-level metadata key, an op, and usually a value. All conditions must hold. Values are never converted between types: "3" does not match 3, and true does not match "true". Nested objects and arrays are stored and returned but are not compared. text finds words in the contents of text files: Markdown, plain text, JSON, CSV, YAML, code, and similar. All words must appear; put a phrase in quotes, write OR between words to match either, and prefix a word with - to exclude it. Results can be ranked by relevance instead of newest first, and each result carries a short snippet. Some files can’t be text-searched in full: images, PDFs, and other binary formats, and text beyond the first 1 MiB of a file. The result’s coverage says how many candidates were not fully searched, so an empty result is never mistaken for a complete one. Set strictContent to fail instead when coverage is partial.

Pages

Results come in pages of up to 100 (20 by default, 50 for a session’s tool), newest first unless ranked by relevance. Every page reads the same snapshot, named by asOf: files saved after the first page are not added part-way through. Pass nextCursor back with an otherwise unchanged request for the next page. total counts the snapshot’s matches under current access, so a file deleted between pages lowers it. A cursor expires after an hour.

Browse an agent’s files

  1. In the sidebar, click Agents and open the agent.
  2. Click Files.
  3. Search file contents, filter by path or metadata, and click a file to preview or download it.
The response lists the matching files with the session that saved each one:
GET /managed-agents/v1/agents/{agentId}/files/{fileId} returns one file of the history.

What can go wrong

Next steps

Deliverables and artifacts

Save deliverables and label them with metadata.

Referenced sessions

Read specific earlier sessions’ transcripts and deliverables.