> For the complete documentation index, see [llms.txt](https://docs.uify.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uify.io/writing-code/actions.md).

# Actions

Actions are the key ingredient for adding logic to your applications, and for managing interactions with your datasources. Almost like native JavaScript functions, they are small units of code that perform a specific task. They are particularly useful for:

* Reading and mutating UI component state or app state variables
* Executing interactions with datasources, like fetching data from a database or API, or writing a file to an AWS S3 bucket
* Triggering other actions
* Sending notifications

They could be triggered by UI events which they are associated with, run immediately when the app is loaded, or run periodically at a configured interval. This section covers all you need to know about actions:

1. [Managing actions](/writing-code/actions/managing-actions.md): How to create, organize and configure actions
2. [Execution model](/writing-code/actions/execution-model.md): The internals around how actions are executed and the data they expose after successful or unsuccessful execution
3. [Preview](/writing-code/actions/preview.md): How to test actions without influencing application state
4. [Triggers](/writing-code/actions/triggers.md): Full overview of all events that may trigger actions to be executed


---

# 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.uify.io/writing-code/actions.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.
