> For the complete documentation index, see [llms.txt](https://docs.currents.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.currents.dev/ai/agent-evidence/any-agent-task.md).

# Record any agent task

Record the logs, output files and screenshots of any task an AI agent did, not only testing, and share them as one link that outlives the machine it ran on

An agent that runs on a remote machine, such as a cloud dev box, a sandbox or a CI job, leaves its results on that machine. When the machine goes away, so do the logs, the files it wrote and the screenshots it took. Have the agent save them to Currents as a [session](/ai/agent-evidence.md) at the end of the task. You get one link to review what the agent did, and the files stay after the machine is gone.

The task does not have to be a test. For example:

* An agent ran a data migration. The session holds the migration log, the row counts before and after, and its summary.
* An agent updated the dependencies of a service. The session holds the build output and the list of packages it changed.
* An agent checked a staging site after a deploy. The session holds the screenshots of each page and the console log.

## What you need

The Currents CLI and a key on the machine. See [Install the Currents CLI and set a key](/ai/agent-evidence.md#install-the-currents-cli-and-set-a-key). On a CI job, the agent can use the record key the job already has.

## Ask the agent

Add this to the agent's task, or to its instructions file:

```
When you finish, save your results as a Currents session in project
<project-id>: your log, every file you wrote, and a summary.md with what you
did and what you did not do. Use --status failed if the task did not finish.
Reply with the link.
```

The agent saves the files with `currents session start`, `attach` and `share`. These commands take any file or folder. For the options, see [currents session](/resources/reporters/currents-cmd/currents-session.md) or run `npx currents session --help`.

<figure><img src="https://3745692499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqmFDEiUa9mr11LUlxDnt%2Fuploads%2Fgit-blob-7f556f5edb7189239d8a64bac653d363b7a8fffc%2Fterminal-agent-task.gif?alt=media" alt="A terminal: ls shows the task&#x27;s output folder, log and summary; currents session start, attach with the folder and two files, and share, which prints the session link and its Markdown link"><figcaption></figcaption></figure>

## What you get

The session page of the migration above, with the agent's summary open:

<figure><img src="https://3745692499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqmFDEiUa9mr11LUlxDnt%2Fuploads%2Fgit-blob-bc831945a44b2f604fba63f0158195111e3e2a59%2Fsession-agent-task.png?alt=media" alt="A passed session titled Migrate order items to order_line_items on staging, with four files: skipped-orders.csv, migration.log, row-counts.json and summary.md, which is open and rendered with a table of row counts before and after"><figcaption></figcaption></figure>

The link opens without a Currents login for 1, 3 or 7 days. The files stay until you delete the session. See [Share links](/ai/reference/share-links.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.currents.dev/ai/agent-evidence/any-agent-task.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
