> For the complete documentation index, see [llms.txt](https://docs.lleverage.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lleverage.ai/run-operations/agent/agent-context/file-handling.md).

# Working with files

Use files as Agent inputs, evidence and outputs, and understand where session files fit relative to durable project knowledge.

Files can be part of the work going into a session or the concrete output coming back from it.

The Agent can read supported files, extract and compare information, transform data and create new files as the result of a task.

## Add files where the work happens

Attach relevant material in the session and describe the outcome you need. Point to the relevant page, sheet, columns or section when that helps narrow the task.

## The Files panel shows outputs from this task

When the Agent creates files, the session's **Files** area gives you a dedicated place to open them instead of searching through the transcript.

This is useful for outputs such as spreadsheets, generated documents, reports or transformed datasets.

A file appearing in the session means it was created or made available for this piece of work. It does **not** automatically become maintained project knowledge or a governed source of truth.

## Files can play three roles

* **Input** — material the Agent needs to process.
* **Evidence** — material used to establish or verify what happened.
* **Output** — a file created as the result of the work.

The role matters when sources disagree. An uploaded spreadsheet may be useful evidence without outranking the current ERP record.

## Outputs can be inline or file-based

The Agent can return ordinary chat content, structured cards and generated files.

For HTML specifically, compact summaries can render as sanitised static cards in the conversation. Richer outputs with tabs or other interaction are better created as an `.html` file and opened in Lleverage's sandboxed file preview.

![Static inline HTML output compared with a richer interactive HTML file preview.](https://3370306531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlgSglJDQZxDZdn20CUcl%2Fuploads%2FN5YrKFgx81Wv1TFYTkTR%2Fhtml-output-comparison.png?alt=media)

For deterministic documents or reports, a reusable Skill can keep generation logic in code and use the Agent for the decisions and interpretation around it rather than reconstructing the whole document in model output every time.

## Verify the actual output

For important work, open the generated file rather than relying only on the Agent's summary of it. Check that the expected rows, values, formulas, document sections or other output are really present.

## Move durable information to the right home

A session attachment is not automatically the right long-term home for reusable information. Depending on what it is, durable material may belong in a Knowledge Base, Table, Skill, maintained project Files area, Workflow or the underlying business system.

If another required file is missing, the Agent should ask for it rather than invent the absent evidence.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.lleverage.ai/run-operations/agent/agent-context/file-handling.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
