# ⚡️ robocorp-actions
A Python library designed to simplify the development of Python actions _(AI or otherwise)_ to be run with the [Robocorp Action Server](../action_server/).
## Getting started
If you have not setup Action Server already, see the [🏃♂️ Quickstart](https://github.com/robocorp/robocorp#quickstart) on how to do that.
Decorate your Python function with the `@action` decorator:
```py
from robocorp.actions import action
@action
def sum_numbers(a: float, b: float) -> float:
...
```
**And your function is now an ⚡️Action!**
You can now run and debug your action by Starting Action Server with `action-server start` and accessing the UI at http://localhost:8080.
> Note: Action inputs and outputs support only `int`, `float`, `str` and `bool` types.
## Describe your action
For an action's purpose and usage to be understood by AI models _(and humans)_ it needs to be documented correctly.
To do that, use [Google Style Docstring](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings) to write a clear and concise description on what your action does and document the action inputs and expected output:
```py
@action
def get_weather_forecast(city: str, days: int, scale: str = "celsius") -> str:
"""
Returns weather conditions forecast for a given city.
Args:
city (str): Target city to get the weather conditions for
days: How many day forecast to return
scale (str): Temperature scale to use, should be one of "celsius" or "fahrenheit"
Returns:
str: The requested weather conditions forecast
"""
...
```
> Tip: Experiment with and iterate the exact documentation wording to get more predictable results when using your action with AI apps.
---
### Consequential flag
You can explicitly provide the `is_consequential` flag for an action to mark it's operations as "must always prompt the user for confirmation before running" by [OpenAI GPTs](https://platform.openai.com/docs/actions) _(and possibly by other providers)_. If set to `False`, the user will be provided with an "always allow" feature.
```py
@action(is_consequential=True)
def get_weather_forecast(city: str, days: int, scale: str = "celsius") -> str:
```
### Execution
To get the full benefits of your actions, the suggested way to run them is using Action Server. But it's also possible to do that directly in command line by passing the named arguments:
```sh
python -m robocorp.actions run -- --city=Helsinki --days=3
```
## Guides
- [Request headers](https://github.com/robocorp/robocorp/blob/master/actions/docs/guides/00-request.md)
## API Reference
Explore our [API](https://github.com/robocorp/robocorp/blob/master/actions/docs/api/README.md) for extensive documentation.
## Changelog
A list of releases and corresponding changes can be found in the [changelog](https://github.com/robocorp/robocorp/blob/master/actions/docs/CHANGELOG.md).
Raw data
{
"_id": null,
"home_page": "https://github.com/robocorp/robocorp/",
"name": "robocorp-actions",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Fabio Z.",
"author_email": "fabio@robocorp.com",
"download_url": "https://files.pythonhosted.org/packages/5b/c8/bf38b5768b13203445aaf90f5e9529ae664ec05de3bec7a021d10b46d872/robocorp_actions-0.2.0.tar.gz",
"platform": null,
"description": "# \u26a1\ufe0f robocorp-actions\n\nA Python library designed to simplify the development of Python actions _(AI or otherwise)_ to be run with the [Robocorp Action Server](../action_server/).\n\n## Getting started\n\nIf you have not setup Action Server already, see the [\ud83c\udfc3\u200d\u2642\ufe0f Quickstart](https://github.com/robocorp/robocorp#quickstart) on how to do that.\n\nDecorate your Python function with the `@action` decorator:\n\n```py\nfrom robocorp.actions import action\n\n@action\ndef sum_numbers(a: float, b: float) -> float:\n ...\n```\n\n**And your function is now an \u26a1\ufe0fAction!**\n\nYou can now run and debug your action by Starting Action Server with `action-server start` and accessing the UI at http://localhost:8080.\n\n> Note: Action inputs and outputs support only `int`, `float`, `str` and `bool` types.\n\n## Describe your action\n\nFor an action's purpose and usage to be understood by AI models _(and humans)_ it needs to be documented correctly.\n\nTo do that, use [Google Style Docstring](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings) to write a clear and concise description on what your action does and document the action inputs and expected output:\n\n```py\n@action\ndef get_weather_forecast(city: str, days: int, scale: str = \"celsius\") -> str:\n \"\"\"\n Returns weather conditions forecast for a given city.\n\n Args:\n city (str): Target city to get the weather conditions for\n days: How many day forecast to return\n scale (str): Temperature scale to use, should be one of \"celsius\" or \"fahrenheit\"\n\n Returns:\n str: The requested weather conditions forecast\n \"\"\"\n ...\n```\n\n> Tip: Experiment with and iterate the exact documentation wording to get more predictable results when using your action with AI apps.\n\n---\n\n### Consequential flag\n\nYou can explicitly provide the `is_consequential` flag for an action to mark it's operations as \"must always prompt the user for confirmation before running\" by [OpenAI GPTs](https://platform.openai.com/docs/actions) _(and possibly by other providers)_. If set to `False`, the user will be provided with an \"always allow\" feature.\n\n```py\n@action(is_consequential=True)\ndef get_weather_forecast(city: str, days: int, scale: str = \"celsius\") -> str:\n```\n\n### Execution\n\nTo get the full benefits of your actions, the suggested way to run them is using Action Server. But it's also possible to do that directly in command line by passing the named arguments:\n\n```sh\npython -m robocorp.actions run -- --city=Helsinki --days=3\n```\n\n## Guides\n\n- [Request headers](https://github.com/robocorp/robocorp/blob/master/actions/docs/guides/00-request.md)\n\n## API Reference\n\nExplore our [API](https://github.com/robocorp/robocorp/blob/master/actions/docs/api/README.md) for extensive documentation.\n\n## Changelog\n\nA list of releases and corresponding changes can be found in the [changelog](https://github.com/robocorp/robocorp/blob/master/actions/docs/CHANGELOG.md).\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Robocorp Actions",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/robocorp/robocorp/",
"Repository": "https://github.com/robocorp/robocorp/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "27a1454bd713473fbf16108073cb8495bc1dca9719abcd34c125569ac7bf3dce",
"md5": "c98589f0ce411c53b4c1eed4e146ac8b",
"sha256": "bfc88b331ef9ffc37b34e81d8992b83f18a0e6c807f065e71c56ed0e4acc46e3"
},
"downloads": -1,
"filename": "robocorp_actions-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c98589f0ce411c53b4c1eed4e146ac8b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 19398,
"upload_time": "2024-04-10T19:51:19",
"upload_time_iso_8601": "2024-04-10T19:51:19.129148Z",
"url": "https://files.pythonhosted.org/packages/27/a1/454bd713473fbf16108073cb8495bc1dca9719abcd34c125569ac7bf3dce/robocorp_actions-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5bc8bf38b5768b13203445aaf90f5e9529ae664ec05de3bec7a021d10b46d872",
"md5": "4a912acfe172732711d99503c90ea4da",
"sha256": "cf4efce6badbcdf2acda47b2abd8ba7d5a75b5bec8761e7c4a03e9f2f3bdf1f9"
},
"downloads": -1,
"filename": "robocorp_actions-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "4a912acfe172732711d99503c90ea4da",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 16279,
"upload_time": "2024-04-10T19:51:21",
"upload_time_iso_8601": "2024-04-10T19:51:21.801219Z",
"url": "https://files.pythonhosted.org/packages/5b/c8/bf38b5768b13203445aaf90f5e9529ae664ec05de3bec7a021d10b46d872/robocorp_actions-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-10 19:51:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "robocorp",
"github_project": "robocorp",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "robocorp-actions"
}