# Deploy an Agent

### Architecture

<figure><img src="/files/L1FZQKgqhFLgPef0Y6wt" alt=""><figcaption></figcaption></figure>

### Publishing your agent container

1. Containerise your app
2. Publish it on Docker hub and get the reference to the container

### UI- Palliora Explorer

1. Open up the explorer and connect your wallet
2. Go to the Agents tab
3. You will find a "Upload Agent" button on the top right
4. Fill in the agent details.
   1. Name
   2. Description
   3. Price: The amount of Palliora tokens you want to charge from the users running your agent
   4. Container Image: The image reference pointing to your agent container image on docker hub.
   5. Environment Variables: The .env variables required for your agent to run. This will be passed to the agent container along with the `docker run` cmd. Make sure to include:\
      `TEST_OLLAMA_MODEL_ID` : The id of the model from the ollama registry to run your agent against. For eg:\
      `TEST_OLLAMA_MODEL_ID=gpt-oss:20b`&#x20;
   6. Port: The port on which your agent container will open up the websocket server to enable interaction with it.\
      WS Port: `8080`
5. Click Upload!
6. The network encrypts the agent details using **threshold encryption** by the guardian network and upload encrypted agent reference to Palliora's DA layer. The network will emit a `submitData` event to notify the participants of the upload.
7. The agent's metadata event will also be emitted as `daccRegisterData` which will hold a reference `refList` to the previously emitted `submitData` event.
8. Both these events will confirm the uploading of your agent!

### CLI

1. Define a json object with the agent properties, reference to its container and the `.env` variables required to have a functioning agent:

   ```
   {
       "name": "Defi-agent",
       "description": "A DeFi trading agent",
       "price": 1,
       "deploymentRef": {
           "containerImg": "0xshiven/defi-swapper-agent:latest",
           "envs": "APIKEY=apikeyvalue\nAPIKEY1=apikeyvalue1\nAPIKEY2=apikeyvalue3\n",
           "port": 8080
       }
   }
   ```
2. Add this json file under `Palliora-cli/data/agent.json`&#x20;
3. Use our Palliora CLI to upload the agent onto the Palliora network

```
pnpm run:upload-agent
```

6. This script will pick your agent's details from the `agent.json` file you added `Palliora-cli/data/agent.json` , encrypt the `deploymentRef` object using **threshold encryption** by the guardian network and upload encrypted agent reference to Palliora's DA layer. The network will emit a `submitData` event to notify the participants of the upload.
7. The agent's metadata event will also be emitted as `daccRegisterData` which will hold a reference `refList` to the previously emitted `submitData` event.
8. Both these events will confirm the uploading of your agent!

See a private, accountable DeFi agent in action on [https://www.lynra.ai](https://www.lynra.ai/)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.palliora.org/build/deploy-an-agent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
