Skip to content

feat: add agent self-provisioning with deployer demo#29

Merged
simonovic86 merged 1 commit intomainfrom
claude/unruffled-bassi
Mar 17, 2026
Merged

feat: add agent self-provisioning with deployer demo#29
simonovic86 merged 1 commit intomainfrom
claude/unruffled-bassi

Conversation

@simonovic86
Copy link
Owner

Overview

Completes Product Phase 2 (Agent Self-Provisioning): agents can now discover compute providers, compare prices, pay for infrastructure autonomously, and deploy themselves — all crash-safe via the effect lifecycle.

Changes

New Agent: Deployer (agents/deployer/)

  • Queries compute marketplace for provider prices via HTTP hostcall
  • Compares marketplace prices to current node cost (node_price hostcall)
  • Pays deployment fee using wallet_pay hostcall
  • POSTs its own checkpoint to provider via HTTP
  • Monitors deployment status until running
  • Crash-safe: unresolved payments/deployments are reconciled on resume
  • Effect lifecycle model ensures no duplicate payments or deployments

Mock Marketplace Server (cmd/marketplace/)

  • GET /providers — returns list of compute providers with prices
  • POST /deploy — accepts checkpoint deployment; requires payment header; returns deployment ID
  • GET /deploy/{id}/status — tracks deployment progress (provisioning → running)
  • Test suite included (main_test.go)

Demo Script (scripts/demo-deployer.sh)

  • Starts marketplace server
  • Runs deployer agent on Machine A
  • KILL process mid-deployment (SIGKILL)
  • Resume checkpoint on Machine B
  • Verifies reconciliation and lineage
  • Demonstrates full self-provisioning loop with crash recovery

Documentation Updates

  • CLAUDE.md: Mark Phase 2 complete; document deployer agent and marketplace
  • ROADMAP.md: Mark Phase 2 complete; detail delivered capabilities

Build System

  • Added make agent-deployer to build deployer WASM
  • Added make demo-deployer to run full demo
  • Updated Makefile for new targets

Key Capabilities

✅ HTTP hostcall (price discovery)
✅ Effect lifecycle model (crash-safe intents)
✅ Wallet payment (autonomous spending)
✅ Self-deployment (agents provision themselves)
✅ Reconciliation (resume rule: InFlight → Unresolved)
✅ Price comparison (agents decide where to run)

Testing

Run the demo:

make demo-deployer

Run marketplace tests:

go test ./cmd/marketplace -v

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2f64ac362a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +300 to +303
igor.Logf("[deployer] Payment FAILED: %s", err.Error())
_ = d.Effects.Compensate(intent.ID)
d.Effects.Prune()
d.Phase = phaseDiscovery

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Handle failed wallet_pay without invalid state transition

When igor.WalletPay returns an error (for example, insufficient budget or blocked recipient), this branch calls Effects.Compensate immediately after Effects.Begin. Compensate only succeeds from the Unresolved state, so this call fails and is ignored, leaving the intent in InFlight; Prune then does nothing and the stale intent persists. That breaks the effect lifecycle guarantees on payment errors and can leave non-terminal intents accumulating without being properly resolved.

Useful? React with 👍 / 👎.

Comment on lines +371 to +374
igor.Logf("[deployer] Deployment FAILED: %s", err.Error())
_ = d.Effects.Compensate(intent.ID)
d.Effects.Prune()
d.Phase = phaseDiscovery

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Handle failed deploy requests without invalid compensation

The deployment error path has the same transition bug: after Begin, an HTTP failure compensates immediately even though the intent is still InFlight. Because that compensate call is invalid and its error is ignored, failed deployment intents remain non-terminal and are never pruned, which can pollute effect state across retries/resumes and undermine crash-recovery behavior.

Useful? React with 👍 / 👎.

Compensate previously only accepted Unresolved state, but agents that
observe an action fail during InFlight (e.g., HTTP error, payment
rejected) need to mark the intent as terminal immediately. Without
this, failed intents remain InFlight, Compensate silently fails, and
Prune cannot remove them — leading to stale non-terminal intents
accumulating in effect state.

Widen Compensate to accept both InFlight and Unresolved:
- InFlight → Compensated: agent observed the failure directly
- Unresolved → Compensated: agent investigated after crash

Fixes the deployer and x402buyer error paths which already called
Compensate after Begin but got silent errInvalidTransition errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@simonovic86 simonovic86 force-pushed the claude/unruffled-bassi branch from 2f64ac3 to 412e502 Compare March 17, 2026 18:00
@simonovic86 simonovic86 merged commit fe24779 into main Mar 17, 2026
1 check passed
@simonovic86 simonovic86 deleted the claude/unruffled-bassi branch March 17, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant