Skip to content

Latest commit

 

History

History
315 lines (242 loc) · 10.5 KB

File metadata and controls

315 lines (242 loc) · 10.5 KB

Phala self-deploy (agent-challenge)

Miner-facing map for the ordered review → eval Intel TDX path. Authoritative implementation and full flag surface live in BaseIntelligence/agent-challenge: python -m agent_challenge.selfdeploy and that repo's docs/miner/self-deploy.md.

agent-recipe does not vendor the agent-challenge service. Install the package, then run the module (or use the thin agent-recipe selfdeploy -- … wrapper).

Install challenge package

git clone https://github.com/BaseIntelligence/agent-challenge.git
cd agent-challenge
python -m venv .venv && source .venv/bin/activate
pip install -e .

# Discovery (safe; no Phala spend)
python -m agent_challenge.selfdeploy --help

From agent-recipe (after the install above is available on PYTHONPATH / same venv):

cd /path/to/agent-recipe
pip install -e ".[dev]"
# same venv also: pip install -e /path/to/agent-challenge

agent-recipe selfdeploy-status --json
agent-recipe selfdeploy-help
agent-recipe selfdeploy -- --help
# equivalent:
python -m agent_challenge.selfdeploy --help

If agent-challenge is not installed, agent-recipe selfdeploy-help exits non-zero and prints an install hint. That is expected offline discovery, not a product failure.

Production model

Concern Value
Plane Phala Cloud Intel TDX CPU CVMs (no GPU)
Stages Miner funds attested review, then after verified allow, attested eval
Validator owns Measurement allowlists, golden key-release, quote verification
Money cap Hard preference $20; prefer tdx.small / tdx.medium
Secrets OPENROUTER_API_KEY enters via Phala encrypted_env (never compose plaintext)
Gateway Production refuses Base LLM gateway; OpenRouter-in-TEE only
Measured OpenRouter model x-ai/grok-4.5 (agent-challenge REVIEW_MODEL pin)

Challenge service production flags must be ON:

  • phala_attestation_enabled / CHALLENGE_PHALA_ATTESTATION_ENABLED
  • attested_review_enabled

Only an explicit deploy (without --dry-run) or teardown reaches Phala for spend. Dry-runs, --help, unit tests, and offline tooling never create CVMs.

Credentials

Secret Required for Notes
OPENROUTER_API_KEY Live review/eval LLM Encrypt into CVM; never commit or log
PHALA_CLOUD_API_KEY Live CVM create/teardown Host env only; never print
Miner hotkey signing prepare/deploy auth Prefer remote-sign; MINER_HOTKEY_MNEMONIC / MINER_HOTKEY_URI for --auto-sign

When PHALA_CLOUD_API_KEY is absent, only run --help / documented dry-run paths. Do not attempt live deploy without a budget decision (cap $20 like AC docs).

# Safe discovery (no spend)
unset PHALA_CLOUD_API_KEY   # or leave unset
python -m agent_challenge.selfdeploy --help
agent-recipe selfdeploy-status --json
# Expect JSON field: "phala_key_present": false

Names-only env template: .env.example.

Ordered lifecycle (review → eval)

review prepare → review deploy → review deployed → review result
                 (need verified allow before eval)
eval prepare   → eval deploy   → eval result
always: teardown (review + eval) when finished

CLI subcommands under each stage:

review: prepare, deploy, deployed, result, history, cancel, retry, teardown
eval:   prepare, deploy, result, status, cancel, retry, failure, teardown

review deploy / eval deploy fetch the current signed prepare response and immediately consume the one-time capability. A standalone prepare is for custom clients; the CLI redacts capabilities from output and persisted JSON.

Reject / escalate / expiry / attestation failure must not create benchmark work.

Exact dry-run commands (no Phala spend)

Top-level help (always safe)

python -m agent_challenge.selfdeploy --help
python -m agent_challenge.selfdeploy review deploy --help
python -m agent_challenge.selfdeploy eval deploy --help
agent-recipe selfdeploy-help
agent-recipe selfdeploy -- --help

Review deploy dry-run (validate assignment; zero CVM create)

Requires a real submission id, hotkey signing material, and challenge base URL. Still safe: --dry-run does not provision Phala CVMs.

export OPENROUTER_API_KEY=...   # used only if assignment path needs encrypt prep; never log
# PHALA_CLOUD_API_KEY may stay unset for pure dry-run validation paths

python -m agent_challenge.selfdeploy review deploy \
  --base-url https://<challenge-host> \
  --submission-id <id> \
  --hotkey <miner-ss58> \
  --auto-sign \
  --dry-run

Via agent-recipe wrapper:

agent-recipe selfdeploy -- review deploy \
  --base-url https://<challenge-host> \
  --submission-id <id> \
  --hotkey <miner-ss58> \
  --auto-sign \
  --dry-run

Eval deploy dry-run (only after verified review allow)

python -m agent_challenge.selfdeploy eval deploy \
  --base-url https://<challenge-host> \
  --submission-id <id> \
  --hotkey <miner-ss58> \
  --auto-sign \
  --dry-run

Legacy offline plan dry-run (compose / cost projection; no ordered review)

Useful for measurement/cost rehearsal without a submission:

python -m agent_challenge.selfdeploy deploy \
  --image ghcr.io/baseintelligence/agent-challenge-canonical@sha256:<digest> \
  --key-release-url https://validator.example/keyrelease \
  --money-cap-usd 20 \
  --dry-run

If PHALA_CLOUD_API_KEY is unset, a non-dry-run deploy errors clearly without printing the key and without a Phala create call.

Live path (budget-gated; prefer dry-run first)

Only with PHALA_CLOUD_API_KEY set, money cap respected (≤ $20), and a decision to spend. Prefer --dry-run immediately before live create.

Review deploy (live)

export OPENROUTER_API_KEY=...
export PHALA_CLOUD_API_KEY=...   # host only; never commit / never print

python -m agent_challenge.selfdeploy review deploy \
  --base-url https://<challenge-host> \
  --submission-id <id> \
  --hotkey <miner-ss58> \
  --auto-sign \
  --openrouter-key-env OPENROUTER_API_KEY \
  --phala-api https://cloud-api.phala.com/api/v1 \
  --review-instance-type tdx.small \
  --eval-instance-type tdx.small \
  --review-runtime-hours 6 \
  --eval-runtime-hours 6 \
  --money-cap-usd 20

Explicit signature form (no --auto-sign):

python -m agent_challenge.selfdeploy review deploy \
  --base-url https://<challenge-host> \
  --submission-id <id> \
  --hotkey <miner-ss58> \
  --signature <signature> \
  --nonce <unique-nonce> \
  --timestamp <timestamp> \
  --openrouter-key-env OPENROUTER_API_KEY \
  --phala-api https://cloud-api.phala.com/api/v1 \
  --review-instance-type tdx.small \
  --eval-instance-type tdx.small \
  --money-cap-usd 20

Review result → need verified allow

python -m agent_challenge.selfdeploy review result \
  --base-url https://<challenge-host> \
  --submission-id <id> \
  --hotkey <miner-ss58> \
  --auto-sign

Public TEE math (no miner signature): GET /submissions/{id}/review/tee on the challenge host (see agent-challenge attestation-tee).

Eval deploy (live; after allow only)

python -m agent_challenge.selfdeploy eval deploy \
  --base-url https://<challenge-host> \
  --submission-id <id> \
  --hotkey <miner-ss58> \
  --auto-sign \
  --llm-cost-limit-env LLM_COST_LIMIT \
  --phala-api https://cloud-api.phala.com/api/v1 \
  --eval-instance-type tdx.small \
  --money-cap-usd 20

Base LLM gateway secrets are not required and must not be injected (BASE_GATEWAY_TOKEN / BASE_LLM_GATEWAY_URL removed from eval required secrets).

Teardown (always)

python -m agent_challenge.selfdeploy review teardown --cvm-id <review-cvm-id>
python -m agent_challenge.selfdeploy eval teardown --cvm-id <eval-cvm-id>
# or legacy:
python -m agent_challenge.selfdeploy teardown --cvm-id <cvm-id>

# Confirm empty inventory via phala CLI when available:
phala cvms list   # expect total: 0

Measured OpenRouter model pin

Pin Value Source
Documented / product pin x-ai/grok-4.5 agent-recipe DEFAULT_OPENROUTER_MODEL
Challenge review harness x-ai/grok-4.5 agent-challenge REVIEW_MODEL
agent-recipe info
# → default_openrouter_model: "x-ai/grok-4.5"

Confirm against current agent-challenge measurement/docs before spending. agent-recipe does not override challenge-measured image pins; it mirrors the product narrative.

Dry-run vs live matrix

Mode Phala spend When
--help / unit tests / offline No Always safe
review deploy --dry-run / eval deploy --dry-run No CI / rehearsal with submit id
deploy --dry-run (legacy) No Compose/cost plan only
deploy / review deploy / eval deploy without dry-run Yes Only with key + budget ≤ $20

agent-recipe selfdeploy-status reports phala_key_present as a boolean only (never key material).

baseagent template policy (align)

Production agent template (vendored template/baseagent/agent.py):

  • Calls refuse_if_gateway_residue fail-closed when Base gateway URL/token residue appears in the environment.
  • Scored path is OpenRouter-in-TEE only, not a Base gateway.

See docs/security.md and template/baseagent/SYNC.md.

Money / safety caps

  • Hard money cap: $20 (--money-cap-usd 20).
  • CPU TDX only; GPU shapes refused by selfdeploy before any Phala call.
  • Prefer tdx.small / tdx.medium.
  • Tear down CVMs after success and failure; do not leave residual funded inventory.
  • Post-create failure paths in AC delete attributable CVMs before returning.

Failure hygiene

  • Tear down CVMs after failures and successes.
  • Do not paste prepare capability tokens into tickets or git.
  • Prefer challenge repo docs if flags drift; this map tracks the ordered CLI.
  • Never log OPENROUTER_API_KEY, PHALA_CLOUD_API_KEY, or hotkey mnemonics.

Related docs