Skip to content

Create 🐍 Python AI Actions and 🤖 Automations, and deploy & operate them anywhere

License

Notifications You must be signed in to change notification settings

ExtraordinaryLabs/robocorp

 
 

Repository files navigation

Robocorp

Docs | BlogExamplesReMark | Courses | SlackYoutube𝕏

PyPI - Version PyPI - Version Downloads GitHub issues License

Create, deploy and operate 🐍 Python Automations
and AI Actions anywhere.

Robocorp is the easiest way to extend the capabilities of AI agents, assistants and copilots with custom actions, written in Python. Create and deploy tools, skills, loaders and plugins that securely connects any AI Assistant platform to your data and applications.

Robocorp Action Server makes your Python scripts compatible with ChatGPT and LangChain by automatically creating and exposing an API based on function declaration, type hints and docstrings. Just add @action and start!

Text changing depending on mode. Light: 'So light!' Dark: 'So dark!'

Looking for a replacement to RPA? Head over to our Enterprise Python Automation site for more.


🏃‍♂️ Quickstart

Install Robocorp Action Server:

For macOS
brew update
brew install robocorp/tools/action-server
For Windows
# Download Robocorp Action Server
curl -o action-server.exe https://downloads.robocorp.com/action-server/releases/latest/windows64/action-server.exe

You can download/move the executable into a folder that is in your PATH, or you can add the folder into PATH so that you can call action-server wherever you are.

For Linux
# Download Robocorp Action Server
curl -o action-server https://downloads.robocorp.com/action-server/releases/latest/linux64/action-server
chmod a+x action-server

# Add to PATH or move to a folder that is in PATH
sudo mv action-server /usr/local/bin/

Bootstrap a new project from a template. You’ll be prompted for a name of the project:

action-server new

Navigate to the freshly created project folder and start the server:

cd my-project
action-server start --expose

👉 You should now have an Action Server running locally at: http://localhost:8080, to open the web UI.

👉 Using the --expose -flag, you also get a public internet-facing URL (something like twently-cuddly-dinosaurs.robocorp.link) and an API key. These are the details that you need to configure your AI Agent.

Head over to Action Server docs for more.


What makes a Python function an⚡️Action?

1️⃣ conda.yaml file that sets up your Python environment and dependencies:

channels:
  - conda-forge

dependencies:
  - python=3.10.12
  - pip=23.2.1
  - robocorp-truststore=0.8.0
  - pip:
      - robocorp==1.4.0
      - robocorp-actions==0.0.4
      - numpy==1.26.3
🙋‍♂️ "Why not just pip install...?"

Think of this as an equivalent of the requirements.txt, but much better. 👩‍💻 With conda.yaml you are not just controlling your PyPI dependencies, you control the complete Python environment, which makes things repeatable and easy.

👉 You will probably not want run the Actions just on your machine, so by using conda.yaml:

  • You can avoid Works on my machine -cases
  • You do not need to manage Python installations on all the machines
  • You can control exactly which version of Python your automation will run on
    • ..as well as the pip version to avoid dep. resolution changes
  • No need for venv, pyenv, ... tooling and knowledge sharing inside your team.
  • Define dependencies in conda.yaml let our tooling do the heavy lifting.
  • You get all the content of conda-forge without any extra tooling

Dive deeper with these resources.


2️⃣ @action decorator that determines the action entry point and Type hints and docstring to let AI agents know what the Action does in natural language.

@action
def greeting(name: str) -> str:
    """
    Greets the user

    Args:
        name (str): The user name

    Returns:
        str: Final user greeting
    """

Connect with OpenAI GPTs Actions

Once you have started the Action Server with --expose flag, you’ll get a URL available to the public, along with the authentication token. The relevant part of the output from the terminal looks like this, of course with your own details:

...
Uvicorn running on http://localhost:8080 (Press CTRL+C to quit)
🌍 URL: https://seventy-six-helpless-dragonflies.robocorp.link
🔑 Add following header api authorization header to run actions: { "Authorization": "Bearer xxx_xxx" }

Adding the Action Server hosted AI Action to your custom GPT is super simple, basically just navigate to “Actions” section of the GPT configuration, add the link to import the actions, and Add Authentication with Authentication method set to “API key” and Auth Type to “Bearer”.

TIP:
Use @action(is_consequential=False) flag to avoid user needing to accept the action execution separately each time on your GPT.

Add Action Server as a Toolkit to 🦜️🔗 LangChain

Robocorp Action Server comes with everything needed to connect it to your Langchain AI app project. The easiest way is to start with the template, provided in the Langchain project. Here’s how to do it:

# Install LangChain cli tool if not already there
pip install langchain-cli

# Create a new LangChain app using Action Server template
langchain app new my-awesome-app --package robocorp-action-server

And add the following code to the created ./my-awesome-app/app/server.py file:

from robocorp_action_server import agent_executor as action_server_chain

add_routes(app, action_server_chain, path="/robocorp-action-server")

And inside the project directory spin up a LangServe instance directly by:

langchain serve

After running the steps above, you’ll have a Playground available at http://127.0.0.1:8000/robocorp-action-server/playground/ where you can test your Actions with an AI agent.

Want to build your own thing? Adding your own Robocorp AI Actions to a Langchain project is as easy as the code below. Just remember to change the URL of the Action Server if you are not running both the Action Server and Langchain app on the same machine.

from langchain_robocorp import ActionServerToolkit

# Initialize Action Server Toolkit
toolkit = ActionServerToolkit(url="http://localhost:8080")
tools = toolkit.get_tools()

Why use Robocorp AI Actions

  • ❤️ “when it comes to automation, the Robocorp suite is the best one” /u/disturbing_nickname
  • ❤️ “Robocorp seems to be a good player in this domain” /u/thankred
  • ❤️ “Since you know Python, check out Robocorp. Their product is crazy good.” /u/Uomis

Robocorp stack is hands down the easiest way to give AI agents more capabilities. It’s an end-to-end stack supporting every type of connection between AI and your apps and data. You are in control where to run the code and everything is built for easiness, security, and scalability.

  • 🔐 Decouple AI and Actions that touches your data/apps - Clarity and security with segregation of duties between your AI agent and code that touches your data and apps. Build @action and use from multiple AI frameworks.
  • 🏎️ Develop Actions faster with robocorp automation libraries - Robocorp libraries and the Python ecosystem lets you act on anything - from data to API to Browser to Desktops.
  • 🕵️ Observability out of the box - Log and trace every @action run automatically without a single print statement. Pro tip: connect LangSmith traces with Action logs!
  • 🤯 No-pain Python environment management - Don't do this. Robocorp manages a full Python environment for your actions with ease.
  • 🚀 Deploy with zero config and infra - One step deployment, and you'll be connecting your @action to AI apps like Langchain and OpenAI GPTs in seconds.

Inspiration

Check out these example projects for inspiration.

Build more @actions and be awesome! We'd love to hear and see what have you built. Join our Slack community to share your work, or post it in the Discussions. We'll soon start showcasing the best from the community here!

Roadmap

  • Action Server brew install for Mac users
  • Expose actions to public URL
  • Resume previously exposed session
  • Run and debug @actions like @tasks with Robocorp VS Code Extension
  • MS Copilot Studio manifest file support
  • Llamaindex Tools support
  • Link and deploy Action Servers to Control Room
  • Hot reload of actions after a change
  • Docstring validator and autogeneration
  • More complex input args (currently str, bool, int and float) and return values (currently str and bool)
  • Explicit action user approval
  • Stateful actions

Contributing and issues

⭐️ First, please star the repo - your support is highly appreciated!

  • 🚩 Issues – our GitHub Issues is kept up to date with bugs, improvements, and feature requests
  • 🙋 Help - you are welcome to join our Community Slack if you experience any difficulty getting setup
  • 🌟 Contribution and recognition – Start here, PR's are welcome!
  • 🔐 Refer to our Security policy for details

Contributors

Contributors

About

Create 🐍 Python AI Actions and 🤖 Automations, and deploy & operate them anywhere

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 85.7%
  • TypeScript 12.0%
  • HTML 1.5%
  • Starlark 0.6%
  • Go 0.1%
  • JavaScript 0.1%