Robocorp Toolkit
This notebook covers how to get started with Robocorp Action Server action toolkit and LangChain.
Robocorp is the easiest way to extend the capabilities of AI agents, assistants and copilots with custom actions.
Installation
First, see the Robocorp Quickstart on how to setup Action Server
and create your Actions.
In your LangChain application, install the langchain-robocorp
package:
# Install package
%pip install --upgrade --quiet langchain-robocorp
When you create the new Action Server
following the above quickstart.
It will create a directory with files, including action.py
.
We can add python function as actions as shown here.
Let's add a dummy function to action.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
"""
return "75F and sunny :)"
We then start the server:
action-server start
And we can see:
Found new action: get_weather_forecast
Test locally by going to the server running at http://localhost:8080
and use the UI to run the function.