Skip to main content

Robocorp Actions

Project description

⚡️ robocorp-actions

A Python library designed to simplify the development of Python actions (AI or otherwise) to be run with the Robocorp Action Server.

Getting started

If you have not setup Action Server already, see the 🏃‍♂️ Quickstart on how to do that.

Decorate your Python function with the @action decorator:

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 to write a clear and concise description on what your action does and document the action inputs and expected output:

@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 (and possibly by other providers). If set to False, the user will be provided with an "always allow" feature.

@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:

python -m robocorp.actions run -- --city=Helsinki --days=3

API Reference

Information on specific functions or classes: robocorp.actions

Changelog

A list of releases and corresponding changes can be found in the changelog.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robocorp_actions-0.0.7.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

robocorp_actions-0.0.7-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file robocorp_actions-0.0.7.tar.gz.

File metadata

  • Download URL: robocorp_actions-0.0.7.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/6.2.0-1019-azure

File hashes

Hashes for robocorp_actions-0.0.7.tar.gz
Algorithm Hash digest
SHA256 6845d33737191df08d5521f5fad24771359245b99cfefda7e29fc063e9c1928a
MD5 784236fa15f7afbc7b6a32d4efe79cf0
BLAKE2b-256 edbeea2fd6cb186a9db2a662f7bc922e36c4f4f071489da14c0174e1f68bbbc5

See more details on using hashes here.

File details

Details for the file robocorp_actions-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: robocorp_actions-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/6.2.0-1019-azure

File hashes

Hashes for robocorp_actions-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a25fff2275eada96656f6631623ca372b1b9acee3cef09335c4f03fd7b00d9fd
MD5 00f13e747e454e25f1e89f1f1ec8e2dc
BLAKE2b-256 0458d53a568249d9840ad8bd3c718fac0611872f1e1e3c508dc6b2268f519d50

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page