> ## Documentation Index
> Fetch the complete documentation index at: https://docs.servflow.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up memory and file access

> Create a workspace, give it to a sub-agent, and have the agent keep notes and read your files

A workspace is a folder your agent can read from and write to. This guide creates one, gives it to a sub-agent, and checks that the agent can save a note and find it again on a later run.

## Before you begin

* An agent with at least one sub-agent and a provider. See [Create an agent](https://docs.servflow.io/guides/create-an-agent.md).
* The check at the end runs the agent twice. Your model company bills you for those runs.

## Create a workspace

**1. Open the Workspaces page**

In the sidebar under **Configure**, open **Workspaces**.

![The Workspaces page with the New Workspace button](https://mintcdn.com/servflow/Tigm2DtWfuvgudby/images/guides/set-up-memory-and-file-access/01-workspaces.png?fit=max\&auto=format\&n=Tigm2DtWfuvgudby\&q=85\&s=358860d2e26761bdbf2559010f1a0a7c)

**2. Click New Workspace**

Click **New Workspace**. The **New Workspace** dialog opens.

**3. Name the workspace**

Enter a **Name**, such as `Support notes`, and a **Description**. Click **Create Workspace**. The workspace appears in the list.

![The New Workspace dialog with a name and description entered](https://mintcdn.com/servflow/Tigm2DtWfuvgudby/images/guides/set-up-memory-and-file-access/02-new-workspace.png?fit=max\&auto=format\&n=Tigm2DtWfuvgudby\&q=85\&s=0049f24e061d1d5081cf67f959bbdcbc)

## Add your own files

**1. Open the workspace**

Optional: to give the agent documents to work from, click the workspace in the list. A new workspace reads "No files yet".

![An empty workspace page with the Upload button](https://mintcdn.com/servflow/Tigm2DtWfuvgudby/images/guides/set-up-memory-and-file-access/03-empty-workspace.png?fit=max\&auto=format\&n=Tigm2DtWfuvgudby\&q=85\&s=1adaf37fd2f8ffdfb7c8001288f085b7)

**2. Upload files**

Click **Upload**, or drop files anywhere on the page. The files appear in the list.

The agent reads text files, such as `.md`, `.txt`, `.csv`, and `.json`. It cannot read pictures, PDFs, or other files that are not text.

## Give the workspace to a sub-agent

**1. Open the sub-agent**

Open your agent and click the sub-agent on the canvas. Its panel opens.

**2. Choose the workspace**

Scroll to **Memory**. Under **Workspace**, choose your workspace. The section's summary changes from "No memory" to the workspace's name.

![A sub-agent panel with the Memory section open, showing the Workspace select](https://mintcdn.com/servflow/545ICsSSJFr63lId/images/guides/set-up-memory-and-file-access/04-memory-section.png?fit=max\&auto=format\&n=545ICsSSJFr63lId\&q=85\&s=b3601e22d5f1ce56d7c0abe462cfd543)

The sub-agent can now list, read, and write files in the workspace. There is nothing else to switch on.

## Tell the agent how to use the workspace

The agent now has the ability, but it needs the instruction. Without one, it answers from the message alone and leaves the files untouched.

**1. Add instructions to the system prompt**

In the sub-agent's **System prompt**, say which file to use and when:

```
You keep your notes in a file called notes.md.
Before every answer, use read_memory to read notes.md. If it does not exist yet, carry on without it.
When someone asks you to remember something, read notes.md, add the new note, and use write_memory to save the whole file.
```

The last line asks for the whole file because writing a file replaces what was in it.

**2. Save**

Click **Save** in the top bar.

## Verify

**1. Ask the agent to remember something**

Click **Run**, enter a request that fits your agent's prompt, and click **Run**. For an agent that reads `{{ body "message" }}`:

```json theme={null}
{ "message": "Remember that our office closes at 5pm on Fridays." }
```

The **Log** in the **Run** panel shows "attempting to execute tool" and "successfully executed tool" twice, once for reading the notes and once for saving them, and the agent confirms.

![The Run panel showing two tool steps and the agent confirming the note](https://mintcdn.com/servflow/Tigm2DtWfuvgudby/images/guides/set-up-memory-and-file-access/05-run-write-file.png?fit=max\&auto=format\&n=Tigm2DtWfuvgudby\&q=85\&s=7a327a5b33f82cf9f2dd3c3bd445afe5)

**2. Read the note in the dashboard**

Open **Workspaces** and open your workspace. `notes.md` is in the list. Click it to read it.

![The workspace page with notes.md open in the file viewer](https://mintcdn.com/servflow/Tigm2DtWfuvgudby/images/guides/set-up-memory-and-file-access/06-file-viewer.png?fit=max\&auto=format\&n=Tigm2DtWfuvgudby\&q=85\&s=413918e752a8f02f267d393378a6fcbb)

**3. Ask for it back**

Run the agent again with a question the note answers:

```json theme={null}
{ "message": "When does the office close on Fridays?" }
```

The log shows one tool step, and the agent answers from the note. Each run from the editor is a new conversation, so the agent can only know this from the file.

## Remove a file or a workspace

To delete a file, open the workspace, hover the file's row, click the delete icon, and confirm.

Before you delete a workspace, open every sub-agent that uses it and choose another workspace, or **No memory**. An agent left pointing at a deleted workspace stops loading until you do. Deleting a workspace removes it from ServFlow and leaves its files on the server's disk.

## Manage workspaces from the CLI

To create a workspace from a file:

```bash theme={null}
servflowai resource workspace create -f workspace.json
```

For every command and the body it takes, see the [CLI reference](https://docs.servflow.io/references/cli.md#workspace).

## Related

> [card] [Workspaces and files](https://docs.servflow.io/concepts/workspaces-and-files.md)
>
> What a workspace is, and how it differs from the conversation an agent remembers on its own.

> [card] [Entries and entry handlers](https://docs.servflow.io/concepts/entries.md#what-the-agent-remembers)
>
> What an agent remembers within a conversation.

> [card] [Guard rails](https://docs.servflow.io/concepts/guard-rails.md)
>
> Limit what people can make your agent do.

> [card] [Add a tool to an agent](https://docs.servflow.io/guides/add-a-tool.md)
>
> Give a sub-agent other abilities.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.