-
Notifications
You must be signed in to change notification settings - Fork 574
Docs/deployment guide #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Agent deployment guide | ||
|
|
||
| This document walks through deploying a Polymarket agent in a production environment. | ||
|
|
||
| 1. **Clone the repository** and create a virtual environment. | ||
| 2. **Set environment variables** (`POLYGON_WALLET_PRIVATE_KEY`, `OPENAI_API_KEY`, etc.). | ||
| 3. **Install dependencies** with `pip install -r requirements.txt`. | ||
| 4. **Run the agent**: `python agents/main.py`. | ||
|
|
||
| For Docker deployments, build the image with `docker build -t polymarket-agent .` and configure secrets via environment variables. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| # Simple sanity check for the Polymarket Agents .env file. | ||
| # | ||
| # Usage: | ||
| # ./scripts/bash/check_env.sh | ||
| # | ||
| # The script checks that the .env file exists and that key variables | ||
| # required by the README are present and non-empty. | ||
|
|
||
| ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" | ||
| ENV_FILE="${ROOT_DIR}/.env" | ||
|
|
||
| REQUIRED_VARS=( | ||
| "POLYGON_WALLET_PRIVATE_KEY" | ||
| "OPENAI_API_KEY" | ||
| ) | ||
|
|
||
| if [ ! -f "${ENV_FILE}" ]; then | ||
| echo "[env-check] .env file not found at: ${ENV_FILE}" | ||
| echo "[env-check] Run: cp .env.example .env and fill in your values." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "[env-check] Using env file: ${ENV_FILE}" | ||
|
|
||
| missing=0 | ||
|
|
||
| while IFS='=' read -r key value; do | ||
| case "${key}" in | ||
| ''|\#*) | ||
| continue | ||
| ;; | ||
| *) | ||
| export "${key}=${value}" | ||
| ;; | ||
| esac | ||
| done < "${ENV_FILE}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Quoted empty values incorrectly pass validation checkThe |
||
|
|
||
| for var in "${REQUIRED_VARS[@]}"; do | ||
| if [ -z "${!var:-}" ]; then | ||
| echo "[env-check] Missing or empty variable: ${var}" | ||
| missing=1 | ||
| fi | ||
| done | ||
|
|
||
| if [ "${missing}" -ne 0 ]; then | ||
| echo "[env-check] One or more required variables are not set correctly." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "[env-check] All required variables are present." | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last line silently ignored if file lacks newline
The
while IFS='=' read -r key valueloop doesn't process the last line of the.envfile if it lacks a trailing newline. Whenreadhits EOF without a newline, it returns non-zero even though it successfully read data, causing the loop to exit before processing that line. This could silently ignore a required variable likeOPENAI_API_KEYif it happens to be on the final line, with no error message indicating why the check fails.