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

# Attach Task File

> Copies a file from an earlier task of the same agent onto the running task, so the agent can process it and a reviewer can see it.

Copies a file attached to an earlier task of the same agent onto the running task, and returns its `file_url`. Display name **"Attach Task File"**. Off by default.

Use it with [`list_task_files`](https://agents.nanonets.com/docs/tools/list-task-files) when a document that arrived on an earlier task is needed now, for example a document from a case's first submission once the case is in scope. Pass `file_url` unchanged to an extraction, classification or splitting tool. The copy belongs to the running task: it shows in the task's files, and citations and review resolve against it.

## Authentication and enablement

No integration. Off by default; enable it on the agent's tools list.

## Inputs

| Field | Type | Required | Description |
| - | - | - | - |
| `file_id` | string (UUID) | yes | The file, as `list_task_files` returns it. |

## Output

```json theme={null}
{
  "file_id": "7d41…09ab",
  "name": "collection_request_form.pdf",
  "mime_type": "application/pdf",
  "file_url": "${VAR_3}",
  "source_file_id": "0c9e…41d2",
  "source_task_id": "58b488ff-…"
}
```

* `file_id`: the copy on the running task.
* `file_url`: what to pass to the next file tool. On most agents it is a `${VAR_N}` reference that the platform resolves to the file's URL.
* `source_file_id`, `source_task_id`: the file that was copied and its task.

## Limits and side effects

* Side effect: a new file record is added to the running task. It points at the same stored document as the original, so nothing is downloaded or re-uploaded. The original is not changed.
* Attaching the same document again returns the copy already made, including when the running task already has it another way (it was forked from that task, or attached a copy of it from a third task). A file that already belongs to the running task is returned as it is.
* Editing the copy with `edit_file` gives it its own stored document first, so the original task's file stays as it was. `edit_file` does not edit another task's file directly: attach it, then edit the copy.
* `list_task_files` reports the copy as `received`, and the copy records the file and task it came from.
* Same agent only: files of the agent's own tasks, in any of its versions. A file of another agent's task, or in another workspace, returns the same error as a file that does not exist.
* The copy is a separate file of the running task. Deleting the source file or its task later does not remove the copy; delete it from the running task too.
* Only files attached to a task. Agent reference documents and uploaded CSVs are not reachable here.
* A deleted file, or a file whose task was deleted, cannot be attached.

## Expected errors

* `file <id> not found`: no such file on a task of this agent, or it or its task was deleted.
* `file_id must be a file UUID`: the input is not a UUID.
* `no task in context`: called outside a running task.
* `task files are unavailable`: misconfigured deployment.


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