phantasmlabs / phantasm

Toolkits to create a human-in-the-loop approval layer to monitor and guide AI agents workflow in real-time.
https://docs.phantasmlabs.com
GNU General Public License v3.0
126 stars 6 forks source link
ai-agents ai-safety ai-security approval-workflow automation-tools control-flow dashboard human-computer-interaction human-in-the-loop llm llm-security llmops monitoring open-source rust

GitHub Discord License

Phantasm

Phantasm offers open-source toolkits that allows you to create human-in-the-loop (HITL) workflows for modern AI agents. Phantasm comes with 3 main components that work together to create a seamless HITL experience:

Features

How It Works

Phantasm allows you to have an approval layer on top of your AI agents. This means, you're free to use any AI framework or model you see fit. By using Phantasm, you can delay the execution of certain business critical actions by your AI agents until a human approves them.

This is particularly useful in scenarios where the AI agent is not 100% accurate or the cost of making a mistake is high. For example, an AI agent that can automate calendar scheduling. In this case, you can use Phantasm to make sure that the AI agent schedules the right meetings at the right time.

Here's how it works under the hood:

  1. Your AI agent sends an approval request to Phantasm's server.
  2. Phantasm relays the request to a human approver.
  3. The approver reviews the request and either approves or rejects it.
  4. Phantasm sends the decision back to the AI agent.

Phantasm can also relay the action parameters to the approvers. This parameters can be modified by the approvers before approving the action. This is useful if there is only a slight mistake in the action parameters that can be corrected by the approvers. This way the action can be approved with some modifications instead of rejected.

Demo

Getting Started

The easiest way to get started with Phantasm is by using Docker. There are 2 components that you need to run before you can start using Phantasm: Server and Dashboard. To run these components, first, you need to pull the Docker images of these components.

These Docker images are hosted on GitHub Container Registry: Packages

docker pull ghcr.io/phantasmlabs/phantasm/dashboard:latest
docker pull ghcr.io/phantasmlabs/phantasm/server:latest

After pulling the images, you can run the components with these commands:

docker run -d -p 2515:2515 ghcr.io/phantasmlabs/phantasm/dashboard:latest
docker run -d -p 2505:2505 -p 2510:2510 ghcr.io/phantasmlabs/phantasm/server:latest start

After running the components, you will have access to:

You can use the dashboard to manage the approval workflows by adding a connection to Phantasm's Coordinator Server. The Receiver Server is used to receive the approval requests from the AI agents via Phantasm's client library. Depending on the programming language you use, you can choose the appropriate client library from the list below:

Best Practices

Error Handling & Fallback Mechanism

Phantasm is designed for real-time approval workflows for AI agents with some non-technical dependencies that could be unpredictable such as the availability of the approvers. Therefore, it is important to have good error handling and fallback mechanisms in place. Here are some edge cases that you should consider before using Phantasm in production:

To handle these edge cases, you can use the following strategies:

Parameters & Context

When sending an approval request using Phantasm, you can also send the action parameters and context to be relayed to the approvers. Most of the time, you want to use this feature to help the approvers make an informed decision. Parameters are usually the input values of the action while the context is the additional information that can help the approvers understand the action better.

Here are some best practices when sending parameters and context:

Contributing

The easiest way to contribute to Phantasm is by starring the repository and sharing it with your colleagues. By doing so, you help us reach a wider audience and grow the community. If you are interested in contributing to the project in the form of code, design, or documentation, please read our Contributing Guidelines.

Other than the clients, which is licensed under the MIT License, Phantasm is licensed under the GNU General Public License v3.0. By contributing to the project, you agree to license your contributions under the applicable license. For more information, please read our licenses:

Disclaimer

Phantasm is still in its early stages of development. Therefore, use it at your own risk. With that being said, we are actively working on improving the toolkits and adding essential features to make it more robust and secure. We will be happy if you actually use it and provide us with feedback to make it better.