# Action Data Sources

An *action data source* is a collection of records, scoped to an action. It is always backed by an [object class](https://docs.appfarm.io/reference/data-model/object-classes): the object class determines the properties on each record, and the data source itself has a cardinality of **one** (a single record) or **many** (a collection of records).

An action data source exists only for the duration of the action run that declares it. Subsequent action nodes in the same run can read and write to it in the same way any [data source](https://docs.appfarm.io/reference/apps/data/data-sources) in the platform is used, and it is discarded when the action completes. Action data sources are the action-scoped counterpart to [runtime-only data sources](https://docs.appfarm.io/reference/apps/data/data-sources) in apps.

Action data sources are useful for work that an action performs on a collection of object-class records — staging records before they are persisted, transforming records as they flow through an action, or collecting results to return to the caller.

### Creating an action data source

Action data sources are defined on their parent action, alongside action variables and action params. The authoring surface differs between flows and apps:

* **In a flow action,** action data is configured on the **Action data** tab in the flow action editor.
* **In an app action,** action data is configured under **Action settings** in the right-side panel.

When adding an action data source, select the object class that backs it and choose a cardinality — **One** for a single record, **Many** for a collection.

### Using an action data source

**As the way to work with object classes from a flow.** Flows run on the server and do not have access to app-level data sources, so action data sources are the only mechanism for creating, reading, updating, or persisting object class records from within a flow. Any flow that needs to interact with its solution's database through its object classes does so via an action data source.

**As a persistence target.** Records on an action data source are written to the database with the [Persist Objects](https://docs.appfarm.io/library/action-nodes/persist-objects) action node.

**As intermediate collection state.** An action can read, filter, transform, and write against an action data source in the same way an app action would work with an app data source.

### Returning an action data source from an action

An action data source can be marked **return from action**, which makes it available to the caller as an output. When the caller — for example, a **Run Flow** or **Run Action** node — invokes the action, the returned data source is mapped into a data source in the calling context, either another action data source or an app data source. The mapping UI and its options are documented on the reference pages for [Run Flow](https://docs.appfarm.io/library/action-nodes/run-flow) and [Run Action](https://docs.appfarm.io/library/action-nodes/run-action).

### Properties

| Property               | Description                                                                                                                                                                           |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Name**               | A descriptive name.                                                                                                                                                                   |
| **Object Class**       | The [object class](https://docs.appfarm.io/reference/data-model/object-classes) that backs the data source. Determines the properties available on each record.                       |
| **Cardinality**        | Whether the data source holds a single record (**One**) or a collection of records (**Many**).                                                                                        |
| **Auto Create**        | *Available if Cardinality is One.* Automatically create an object in the data source when the action starts.                                                                          |
| **Runtime Properties** | Add runtime properties to the action data source. These are calculated or temporary properties that exist only at runtime, in the same way as runtime properties on app data sources. |
| **Description**        | A longer description of the action data source. For your own reference.                                                                                                               |
| **Return from Action** | Make the action data source available to the caller as an output. See [Returning an action data source from an action](#returning-an-action-data-source-from-an-action).              |


---

# Agent Instructions: 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:

```
GET https://docs.appfarm.io/reference/actions/action-data-sources.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
