parent
4fe662eb19
commit
52d3f47ab8
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 131 KiB |
After Width: | Height: | Size: 831 KiB |
After Width: | Height: | Size: 352 KiB |
After Width: | Height: | Size: 844 KiB |
After Width: | Height: | Size: 346 KiB |
@ -1,7 +1,73 @@
|
|||||||
## To run project in Phala TEE
|
# Running Swarms Agent in Phala TEE
|
||||||
|
|
||||||
1. Build the docker image and publish it to the docker hub
|
Welcome! This guide will walk you through running your Swarms Agent in a Trusted Execution Environment (TEE) using Phala Cloud. This setup ensures your agent runs in a secure, isolated environment.
|
||||||
`docker compose build -t <your-dockerhub-username>/swarm-agent-node:latest`
|
|
||||||
`docker push <your-dockerhub-username>/swarm-agent-node:latest`
|
## Prerequisites
|
||||||
2. Deploy to Phala cloud using [tee-cloud-cli](https://github.com/Phala-Network/tee-cloud-cli) or manually with the [Cloud dashboard](https://cloud.phala.network/).
|
|
||||||
3. Check your agent's TEE proof and verify it on the [TEE Attestation Explorer](https://proof.t16z.com/).
|
- A Swarms Agent code repository (or docker image)
|
||||||
|
- A Phala Cloud account
|
||||||
|
- An OpenAI API key
|
||||||
|
|
||||||
|
## Step-by-Step Guide
|
||||||
|
|
||||||
|
### 1. Configure Your Environment
|
||||||
|
|
||||||
|
First, prepare your `docker-compose.yaml` file. You can find an example in [docker-compose.yaml](./docker-compose.yaml). Make sure to have your OpenAI API key ready.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
swarms-agent-server:
|
||||||
|
image: python:3.12-slim
|
||||||
|
volumes:
|
||||||
|
- swarms:/app
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||||
|
command: # Run swarms agent example
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
# install dependencies
|
||||||
|
apt update && apt install -y git python3-pip
|
||||||
|
mkdir -p /app && cd /app
|
||||||
|
|
||||||
|
git clone --depth 1 https://github.com/The-Swarm-Corporation/swarms-examples
|
||||||
|
cd swarms-examples/
|
||||||
|
pip install -r requirements.txt && pip install langchain-community langchain-core
|
||||||
|
cd examples/agents/
|
||||||
|
python o1_preview.py
|
||||||
|
|
||||||
|
# keep container running
|
||||||
|
sleep infinity
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
swarms:
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Deploy Your Agent
|
||||||
|
|
||||||
|
1. Navigate to the [Phala Cloud dashboard](https://cloud.phala.network/dashboard)
|
||||||
|
2. Create a new Swarms agent application
|
||||||
|

|
||||||
|
|
||||||
|
### 3. Monitor Your Deployment
|
||||||
|
|
||||||
|
1. Check the initialization logs of your agent
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
2. Verify your container is running
|
||||||
|

|
||||||
|
|
||||||
|
3. Monitor your agent's output
|
||||||
|

|
||||||
|
|
||||||
|
### 4. Verify TEE Attestation
|
||||||
|
|
||||||
|
Ensure your agent is running in a secure TEE environment by checking the attestation proof on the [TEE Attestation Explorer](https://proof.t16z.com/).
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Success!
|
||||||
|
|
||||||
|
You've successfully deployed your Swarms Agent in a secure TEE environment using Phala Cloud. Your agent is now running in an isolated, trusted execution environment, ensuring enhanced security for your AI operations.
|
||||||
|
@ -1,19 +1,27 @@
|
|||||||
services:
|
services:
|
||||||
swarms-agent-server:
|
swarms-agent-server:
|
||||||
image: swarms-agent-node:latest
|
image: python:3.12-slim
|
||||||
platform: linux/amd64
|
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/tappd.sock:/var/run/tappd.sock
|
|
||||||
- swarms:/app
|
- swarms:/app
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
environment:
|
||||||
- 8000:8000
|
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||||
command: # Sample MCP Server
|
command: # Run swarms agent example
|
||||||
- /bin/sh
|
- /bin/sh
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
cd /app/mcp_example
|
# install dependencies
|
||||||
python mcp_test.py
|
apt update && apt install -y git python3-pip
|
||||||
|
mkdir -p /app && cd /app
|
||||||
|
|
||||||
|
git clone --depth 1 https://github.com/The-Swarm-Corporation/swarms-examples
|
||||||
|
cd swarms-examples/
|
||||||
|
pip install -r requirements.txt && pip install langchain-community langchain-core
|
||||||
|
cd examples/agents/
|
||||||
|
python o1_preview.py
|
||||||
|
|
||||||
|
# keep container running
|
||||||
|
sleep infinity
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
swarms:
|
swarms:
|
||||||
|
Loading…
Reference in new issue