Docs | Blog |ย Examples |ย CodeGen | Slack |ย Youtube |ย ๐
NOTE: This project started as Robocorp Action Server, and is currently being migrated under Sema4.ai organization. You will still likely find links to Robocorp resources. It's all the same company!
Sema4.ai 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 connect any AI Assistant platform to your data and applications.
Sema4.ai Action Server makes your Python scripts compatible with Agents using protocols such as MCP, OpenAI's custom GPTs, LangChain and OpenGPTs by automatically creating and exposing an API based on function declaration, type hints and docstrings. Just create your @tool
(or @action
) and start!

There are two main ways using the Action Server: with the command line, or with our VS Code extension. This section gets you going!
Install from PyPI
Using an existing Python installation, run:
pip install sema4ai-action-server
After installed the action-server
executable should be in the Scripts
or bin
(depending on the OS) for the given python installation/environment.
Alternatively, it's also possible to download the Action Server as a standalone binary for a specific platform:
CLI For macOS
brew update
brew install sema4ai/tools/action-server
CLI For Windows
# Download Sema4.ai Action Server
curl -o action-server.exe https://cdn.sema4.ai/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.
CLI For Linux
# Download Sema4.ai Action Server
curl -o action-server https://cdn.sema4.ai/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/
Sema4.ai SDK extension for VS Code
After installing Sema4.ai SDK extension from the VS Code Markeplace, open the Command Palette (Command-Shift-P
or Ctrl-Shift-P
) and select Sema4.ai: Create Action Package
. This will bootstrap a new project. You can then run/debug indvidual Actions from the Extension's sidebar, or start the Action Server.
Bootstrap a new project from a template. Youโll be prompted for the name of the project:
action-server new
Navigate to the freshly created project folder and start the server:
cd my-project
action-server start
๐ You should now have an Action Server running locally at: http://localhost:8080, to open the web UI.
๐ The MCP
endpoint is available at: http://localhost:8080/mcp
.
๐ Using the --auto-reload -flag for developing the Action Server will automatically reload your tools/actions when you change them during development.
Head over to Action Server docs for more.
1๏ธโฃ package.yaml
file that describes the MCP/Action Package
you are working on, and defines up your Python environment and dependencies:
spec-version: v2
name: Package name
description: Package description
documentation: https://github.com/...
dependencies:
conda-forge:
- python=3.12.10
- uv=0.6.11
pypi:
- sema4ai-actions=1.3.15
- sema4ai-mcp=0.0.1
- pytz=2024.1
pythonpath:
- src
- tests
dev-dependencies:
pypi:
- pytest=8.3.3
dev-tasks:
test: pytest tests
packaging:
exclude:
- ./.git/**
- ./.vscode/**
- ./devdata/**
- ./output/**
- ./venv/**
- ./.venv/**
- ./.DS_store/**
- ./**/*.pyc
- ./**/*.zip
- ./**/.env
- ./**/__MACOSX
- ./**/__pycache__
- ./**/.git
- ./node_modules/**
๐โโ๏ธ "Why not just pip install...?"
Think of this as an equivalent of the requirements.txt, but much better. ๐ฉโ๐ป With package.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 package.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 or uv version to avoid dependency resolution changes
- No need for venv, pyenv, ... tooling and knowledge sharing inside your team.
- Define dependencies in
package.yaml
and let our tooling do the heavy lifting. - You get all the content of conda-forge without any extra tooling
The environment management is provided by RCC.
2๏ธโฃ @tool decorator or @action decorator that determines the tool or action entry point and Type hints and docstring to let AI agents know what the Tool/Action does in natural language
Note: any function decorated as @action
imported from sema4ai.actions
is also available as a @tool
imported from sema4ai.mcp
and vice-versa (besides, there are other custom decorators for other functionalities such as @resource
, @prompt
for mcp and @query
for actions).
from sema4ai.mcp import tool
@tool
def greeting(name: str) -> str:
"""
Greets the user
Args:
name (str): The user name
Returns:
str: Final user greeting
"""
## Connect using an MCP client
Once you have started the Action Server, point the client to the Action Server /mcp
endpoint
(example: http://localhost:8080/mcp
).
Note: in production, the Action Server
should be put under a reverse proxy that controls SSL and authentication.
For testing with a GPTs actions, it's possible to start the Action Server
with the --expose
flag.
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.sema4ai.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 the
@action(is_consequential=False)
flag to avoid the user needing to accept the action execution separately each time on your GPT.
- โค๏ธย โwhen it comes to automation, the (ex)Robocorp suite is the best oneโ /u/disturbing_nickname
- โค๏ธย โ(ex)Robocorp seems to be a good player in this domainโ /u/thankred
- โค๏ธย โSince you know Python, check out (ex)Robocorp. Their product is crazy good.โ /u/Uomis
Sema4.ai 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
@tool
or@action
and use from multiple AI frameworks. - ๐๏ธย Develop Actions faster with Sema4.ai's
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
@tool
or@action
run automatically without a singleprint
statement. Pro tip: connect LangSmith traces with Action logs! - ๐คฏ No-pain Python environment management - Don't do this. Sema4.ai 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
@tool
to MCP clients or@action
to AI apps like Langchain and OpenAI GPTs in seconds.
Check out these example projects for inspiration.
- ๐ฃ Simplest possible AI Action
- ๐คก Get a random joke or jokes per theme. Showcases how easy it is to work with APIs.
- ๐ Add files to agent conversation
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.
โญ๏ธ 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