Examples
These examples are rendered from files in the private Sandbox Loom source
repository. Their snippets are visible here for evaluation, but running the
complete examples requires authorized access to that source distribution.
The public site is a curated product and portfolio projection, not a mirror
or substitute for the source repository.
Install the repository's pinned dependencies with bundle install before
running examples. Commands below run from the repository root unless stated
otherwise. Offline examples do not need provider credentials; live examples
are identified explicitly and remain opt-in.
Run the offline verification matrix from the repository root:
Verify all offline examplesbin/sandbox-loom examples check
The OpenAI example is live-provider-only and is skipped unless SANDBOX_LOOM_RUN_LIVE_EXAMPLES=1 is explicitly set. Never publish or commit API keys.
The examples progress from offline local capabilities to workflow composition,
repair and acceptance, protected operations, and explicitly opt-in provider
access. Use them as executable design references: each example shows a
different authority, verification, or evidence boundary rather than merely a
different syntax for running a command.
1. Hello workspace — Ruby gateway API
| examples/01_hello_workspace.rb |
|---|
| # frozen_string_literal: true
require "fileutils"
require "tmpdir"
require "gateway"
ROOT = File.expand_path("..", __dir__)
registry = PolicyEngine::Registry.load(File.join(ROOT, "specifications/sandbox/v0.2/capability-registry-v0.2.yaml"))
policy = PolicyEngine::Policy.load(File.join(ROOT, "specifications/sandbox/v0.2/autonomous-development.yaml"))
audit = PolicyEngine::MemoryAuditLog.new
evaluator = PolicyEngine::Evaluator.new(registry: registry, policy: policy, audit_log: audit)
Dir.mktmpdir("sandbox-loom-example") do |root|
workspace = File.join(root, "workspace")
gateway = Gateway::Filesystem.new(workspace_root: workspace, evaluator: evaluator, sandbox_id: "example-1", profile: policy.profile)
gateway.write("/workspace/message.txt", "hello from the gateway")
puts gateway.read("/workspace/message.txt")
puts "audit_events=#{audit.events.length}"
end
|
2. Verify a file — YAML workflow
| examples/02_verify_file.yml |
|---|
| # yaml-language-server: $schema=../specifications/workflows/v0.1/workflow.schema.json
version: "0.1"
workflow: verify-file
profile: autonomous-development
tasks:
- id: verify
action: verify
checks: [file_exists, content_present]
|
3. Dependencies — Ruby DSL
| examples/03_dependencies.rb |
|---|
| # frozen_string_literal: true
require "json"
require "workflow"
document = Workflow::DSL.define("dependency-composition", profile: "autonomous-development") do
task :inspect, action: "gateway.git.status"
task :implement, action: "executor.request"
task :verify, action: "verify", checks: %i[test build lint]
after :inspect, :implement
after :implement, :verify
end
plan = Workflow::Planner.new(validator: Workflow::Validator.new).plan(document)
puts JSON.pretty_generate(plan)
|
4. Quality loop — repair and acceptance
| examples/04_quality_loop.rb |
|---|
| # frozen_string_literal: true
require "development_loop"
attempts = 0
runner = DevelopmentLoop::Runner.new(
planner: ->(context) { { steps: [context[:specification][:objective]] } },
implementer: ->(_context) { { changed_files: ["/workspace/service.rb"] } },
verifier: lambda do |_context|
attempts += 1
{ success: attempts > 1, checks: [{ name: :test, status: attempts > 1 ? "passed" : "failed" }] }
end,
repairer: ->(context) { { repair: "retry verification", previous_attempt: context[:failure][:repair_count] } },
checkpoint_store: DevelopmentLoop::MemoryCheckpointStore.new
)
result = runner.run(
{ id: "quality-loop", objective: "verify a service change", acceptance_criteria: ["tests pass"] },
run_id: "quality-loop-run"
)
puts "status=#{result[:status]} repair_count=#{result[:evidence][:repair_count]}"
|
5. Snapshot and restore — Ruby gateway API
| examples/05_snapshot_restore.rb |
|---|
| # frozen_string_literal: true
require "fileutils"
require "tmpdir"
require "gateway"
ROOT = File.expand_path("..", __dir__)
registry = PolicyEngine::Registry.load(File.join(ROOT, "specifications/sandbox/v0.2/capability-registry-v0.2.yaml"))
policy = PolicyEngine::Policy.load(File.join(ROOT, "specifications/sandbox/v0.2/autonomous-development.yaml"))
audit = PolicyEngine::MemoryAuditLog.new
evaluator = PolicyEngine::Evaluator.new(registry: registry, policy: policy, audit_log: audit)
Dir.mktmpdir("sandbox-loom-snapshot") do |root|
workspace = File.join(root, "workspace")
snapshots = File.join(root, "snapshots")
options = { evaluator: evaluator, sandbox_id: "example-5", profile: policy.profile }
filesystem = Gateway::Filesystem.new(workspace_root: workspace, **options)
snapshots_api = Gateway::Snapshots.new(workspace_root: workspace, snapshot_root: snapshots, **options)
filesystem.write("/workspace/state.txt", "before")
snapshot_id = snapshots_api.create
filesystem.write("/workspace/state.txt", "after")
snapshots_api.restore(snapshot_id)
puts "restored=#{filesystem.read('/workspace/state.txt')}"
end
|
6. Feature-branch push — brokered YAML plan
| examples/06_feature_branch_push.yml |
|---|
| # yaml-language-server: $schema=../specifications/workflows/v0.1/workflow.schema.json
version: "0.1"
workflow: feature-branch-push
profile: autonomous-development
tasks:
- id: push
action: broker.git.push_feature
with:
branch: agent/example
remote: origin
|
7. Protected operation — approval boundary
| examples/07_protected_operation.yml |
|---|
| # yaml-language-server: $schema=../specifications/workflows/v0.1/workflow.schema.json
version: "0.1"
workflow: protected-operation
profile: autonomous-development
tasks:
- id: approval
action: approval.request
approval: true
with:
operation: protected-branch-push
|
8. Invalid workflow — fail-closed validation
| examples/08_invalid_workflow.yml |
|---|
| # yaml-language-server: $schema=../specifications/workflows/v0.1/workflow.schema.json
version: "0.1"
workflow: invalid-cycle
profile: autonomous-development
tasks:
- id: first
action: verify
after: [second]
- id: second
action: verify
after: [first]
|
9. Autonomous feature — realistic YAML workflow
| examples/09_autonomous_feature.yml |
|---|
| # yaml-language-server: $schema=../specifications/workflows/v0.1/workflow.schema.json
version: "0.1"
workflow: autonomous-feature
profile: autonomous-development
limits:
max_tasks: 10
max_retries: 2
tasks:
- id: inspect
action: gateway.git.status
- id: implement
action: executor.request
after: [inspect]
with:
operation: implement-feature
- id: verify
action: verify
after: [implement]
checks: [test, build, lint]
retry: 1
- id: checkpoint
action: checkpoint
after: [verify]
- id: review
action: approval.request
after: [checkpoint]
|
10. Deterministic coding agent
Workflow:
| examples/10_coding_agent_feature/workflow.yml |
|---|
| # yaml-language-server: $schema=../../specifications/workflows/v0.1/workflow.schema.json
version: "0.1"
workflow: coding-agent-feature
profile: autonomous-development
tasks:
- id: inspect
action: executor.request
with:
operation: inspect_repository
- id: implement
action: executor.request
after: [inspect]
with:
operation: implement_feature
- id: verify_initial
action: verify
after: [implement]
checks: [greeting_content]
- id: repair
action: executor.request
after: [verify_initial]
with:
operation: repair
- id: verify_final
action: verify
after: [repair]
checks: [greeting_content]
- id: checkpoint
action: checkpoint
after: [verify_final]
|
Runner:
| examples/10_coding_agent_feature/run.rb |
|---|
| # frozen_string_literal: true
require "json"
require "tmpdir"
require "coding_agent"
require "development_loop"
require "gateway"
require "workflow"
ROOT = File.expand_path("../..", __dir__)
registry = PolicyEngine::Registry.load(File.join(ROOT, "specifications/sandbox/v0.2/capability-registry-v0.2.yaml"))
policy = PolicyEngine::Policy.load(File.join(ROOT, "specifications/sandbox/v0.2/autonomous-development.yaml"))
audit = PolicyEngine::MemoryAuditLog.new
evaluator = PolicyEngine::Evaluator.new(registry: registry, policy: policy, audit_log: audit)
workflow = Workflow::Loader.load(File.join(__dir__, "workflow.yml"))
Dir.mktmpdir("sandbox-loom-coding-agent") do |root|
gateway = Gateway::Filesystem.new(workspace_root: File.join(root, "workspace"), evaluator: evaluator, sandbox_id: "coding-agent-sandbox", profile: policy.profile)
agent = CodingAgent::Deterministic.new(gateway: gateway)
checkpoints = DevelopmentLoop::MemoryCheckpointStore.new
verification_attempts = 0
handlers = {
"executor.request" => lambda do |task:, context:|
agent.request(operation: task.fetch("with").fetch("operation"), context: context)
end,
"verify" => lambda do |task:, context:|
verification_attempts += 1
content = gateway.read("/workspace/greeting.txt") rescue ""
{ task: task.fetch("id"), checks: task.fetch("checks"), success: content == "hello from the coding agent\n", attempt: verification_attempts }
end,
"checkpoint" => ->(task:, context:) { { task: task.fetch("id"), run_id: context.fetch(:run_id) } }
}
result = Workflow::Executor.new(
planner: Workflow::Planner.new(validator: Workflow::Validator.new(registry: registry, policy: policy)),
handlers: handlers,
checkpoint_store: checkpoints
).run(workflow, run_id: "coding-agent-run")
final_verification = result.fetch(:results).fetch("verify_final").fetch(:result)
raise "coding-agent example was not accepted" unless result[:status] == :completed && final_verification[:success]
puts JSON.pretty_generate(status: "accepted", agent_events: agent.events.length, policy_decisions: audit.events.count { |event| event[:event_type] == "decision" }, checkpoints: checkpoints.all(run_id: "coding-agent-run").length, final_check: final_verification[:success])
end
|
11. OpenAI Responses agent — opt-in live provider
Workflow:
| examples/11_openai_responses_agent/workflow.yml |
|---|
| # yaml-language-server: $schema=../../specifications/workflows/v0.1/workflow.schema.json
version: "0.1"
workflow: openai-responses-inspection
profile: autonomous-development
tasks:
- id: inspect
action: executor.request
with:
operation: model.inspect_workspace
provider: openai.responses
- id: checkpoint
action: checkpoint
after: [inspect]
|
Runner:
| examples/11_openai_responses_agent/run.rb |
|---|
| # frozen_string_literal: true
require "fileutils"
require "json"
require "tmpdir"
require "coding_agent"
require "gateway"
ROOT = File.expand_path("../..", __dir__)
api_key = ENV.fetch("OPENAI_API_KEY") { abort "OPENAI_API_KEY is required" }
model = ENV.fetch("SANDBOX_LOOM_OPENAI_MODEL") { abort "SANDBOX_LOOM_OPENAI_MODEL is required" }
endpoint = ENV.fetch("SANDBOX_LOOM_OPENAI_ENDPOINT", CodingAgent::OpenAIResponsesTransport::DEFAULT_ENDPOINT)
registry = PolicyEngine::Registry.load(File.join(ROOT, "specifications/sandbox/v0.2/capability-registry-v0.2.yaml"))
policy = PolicyEngine::Policy.load(File.join(ROOT, "specifications/sandbox/v0.2/autonomous-development.yaml"))
audit = PolicyEngine::MemoryAuditLog.new
evaluator = PolicyEngine::Evaluator.new(registry: registry, policy: policy, audit_log: audit)
Dir.mktmpdir("sandbox-loom-openai") do |root|
workspace = File.join(root, "workspace")
FileUtils.mkdir_p(workspace)
File.write(File.join(workspace, "README.md"), "Sandbox Loom workspace\n")
options = { evaluator: evaluator, sandbox_id: "openai-example-sandbox", profile: policy.profile }
gateway = Gateway::Filesystem.new(workspace_root: workspace, **options)
tools = {
"workspace.read" => ->(arguments, _context) { gateway.read(arguments.fetch(:path)) }
}
tool_definitions = [
{
type: "function",
name: "workspace.read",
description: "Read a file inside the declared workspace.",
parameters: {
type: "object",
properties: { path: { type: "string", description: "An absolute virtual workspace path." } },
required: ["path"],
additionalProperties: false
},
strict: true
}
]
transport = CodingAgent::OpenAIResponsesTransport.new(
api_key: api_key,
model: model,
endpoint: endpoint,
tool_definitions: tool_definitions
)
result = CodingAgent::ProviderAdapter.new(transport: transport, tools: tools).run(
session_id: "openai-example-session",
prompt: "Inspect /workspace/README.md with the workspace.read tool and summarize its contents."
)
puts JSON.pretty_generate(
status: result.fetch(:status),
run_id: result.fetch(:run_id),
event_count: result.fetch(:events).length,
audit_decisions: audit.events.count { |event| event[:event_type] == "decision" },
note: "The API key is not included in this output."
)
end
|
Run the live example only with an explicitly configured API key and model, as described in the example README. The credential is read from the environment and is never part of the displayed source or workflow.
12. CLI coding agent — bounded local adapter
Workflow:
| examples/12_cli_coding_agent/workflow.yml |
|---|
| # yaml-language-server: $schema=../../specifications/workflows/v0.1/workflow.schema.json
version: "0.1"
workflow: todo-cli-agent
profile: autonomous-development
limits:
max_tasks: 6
max_retries: 1
tasks:
- id: inspect
action: coding_agent.cli.request
with:
operation: inspect
prompt: "operation=inspect\nInspect the todo workspace"
- id: implement
action: coding_agent.cli.request
after: [inspect]
with:
operation: implement
prompt: "operation=implement\nAdd todo completion to the workspace"
- id: verify
action: verify
after: [implement]
checks: [todo_file_exists, todo_completion_present]
- id: checkpoint
action: checkpoint
after: [verify]
|
Runner:
| examples/12_cli_coding_agent/run.rb |
|---|
| # frozen_string_literal: true
require "json"
require "rbconfig"
require "tmpdir"
require_relative "../../src/coding_agent"
require_relative "../../src/development_loop"
require_relative "../../src/workflow"
ROOT = File.expand_path("../..", __dir__)
registry = PolicyEngine::Registry.load(File.join(ROOT, "specifications/sandbox/v0.2/capability-registry-v0.2.yaml"))
policy = PolicyEngine::Policy.load(File.join(ROOT, "specifications/sandbox/v0.2/autonomous-development.yaml"))
audit = PolicyEngine::MemoryAuditLog.new
evaluator = PolicyEngine::Evaluator.new(registry: registry, policy: policy, audit_log: audit)
workflow = Workflow::Loader.load(File.join(__dir__, "workflow.yml"))
Dir.mktmpdir("sandbox-loom-cli-agent") do |workspace|
fixture = File.join(__dir__, "support/fake_cli.rb")
cli = CodingAgent::CliAdapter.new(
configuration: CodingAgent::CliAdapter::Configuration.new(
executable: RbConfig.ruby,
allowed_arguments: [fixture],
working_directory: workspace,
environment: { "SANDBOX_LOOM_CLI_FIXTURE" => "1" },
timeout: 5,
max_output_bytes: 10_000,
network_mode: "none"
),
authorizer: lambda do |capability:, resource_type:, resource_value:, session_id:, run_id:, **context|
evaluator.evaluate(
request_id: "cli-request-#{run_id}",
run_id: run_id,
sandbox_id: "cli-example-sandbox",
agent_id: "cli-example-agent",
executor_id: "cli-example-executor",
environment_id: "cli-example-environment",
policy_version: policy.version,
registry_version: registry.version,
profile: policy.profile,
capability: capability,
resource: { type: resource_type, value: resource_value },
context: context.merge(session_id: session_id)
)
end
)
handlers = {
"coding_agent.cli.request" => lambda do |task:, context:|
input = task.fetch("with")
cli.request(
operation: input.fetch("operation"),
prompt: input.fetch("prompt"),
session_id: "cli-example-session",
run_id: context.fetch(:run_id)
)
end,
"verify" => lambda do |task:, context:|
content = File.read(File.join(workspace, "todos.txt"))
{ checks: task.fetch("checks"), passed: content.include?("[x] try Sandbox Loom") }
end,
"checkpoint" => ->(task:, context:) { { task: task.fetch("id"), run_id: context.fetch(:run_id) } }
}
result = Workflow::Executor.new(
planner: Workflow::Planner.new(validator: Workflow::Validator.new(registry: registry, policy: policy)),
handlers: handlers,
checkpoint_store: DevelopmentLoop::MemoryCheckpointStore.new
).run(workflow, run_id: "cli-example-run")
verification = result.fetch(:results).fetch("verify").fetch(:result)
raise "CLI coding-agent example was not accepted" unless result[:status] == :completed && verification[:passed]
puts JSON.pretty_generate(
status: "accepted",
changed_file: "/workspace/todos.txt",
policy_decisions: audit.events.count { |event| event[:event_type] == "decision" },
acceptance: verification[:passed]
)
end
|
This credential-free example runs a deterministic CLI fixture inside a temporary workspace. It demonstrates the adapter boundary without enabling arbitrary shell commands or a live provider.
13. Tada List — project-specific autonomous development
Workflow:
| examples/13_tada_list_autonomous_development/workflow.yml |
|---|
| # yaml-language-server: $schema=../../specifications/workflows/v0.1/workflow.schema.json
version: "0.1"
workflow: tada-list-autonomous-development
profile: autonomous-development
limits:
max_tasks: 12
max_retries: 2
tasks:
- id: inspect_project_harness
action: coding_agent.cli.request
with:
operation: inspect-project
prompt: >-
Inspect the Tada List repository at /workspace. Read AGENTS.md,
specifications/README.md, specifications/AGENTS.md,
specifications/ARCHITECTURE.md, specifications/ARCHITECTURE_DECISIONS.md,
and specifications/IMPLEMENTATION.md. Identify the next incomplete
implementation phase, its source-of-truth documents, affected
boundaries, and required quality gates. Do not modify files.
- id: inspect_current_state
action: gateway.git.status
after: [inspect_project_harness]
- id: implement_next_slice
action: coding_agent.cli.request
after: [inspect_current_state]
with:
operation: implement-next-slice
prompt: >-
Implement only the next approved Tada List implementation slice from
the repository specifications. Preserve OpenAPI-first design,
tenant isolation, UUIDv7 identifiers, generated-client boundaries,
and the documented command surface. Update specifications or ADRs
when a public boundary or quality gate changes. Run narrow checks
before broader checks and report changed files and evidence.
- id: verify_backend
action: verify
after: [implement_next_slice]
checks: [backend_lint, backend_tests, backend_coverage]
retry: 1
- id: verify_frontend
action: verify
after: [implement_next_slice]
checks: [frontend_lint, frontend_typecheck, frontend_tests, frontend_coverage, frontend_build]
retry: 1
- id: verify_contract_and_e2e
action: verify
after: [verify_backend, verify_frontend]
checks: [openapi_validation, generated_client_drift, api_e2e, browser_e2e]
retry: 1
- id: checkpoint
action: checkpoint
after: [verify_contract_and_e2e]
- id: review
action: approval.request
after: [checkpoint]
approval: true
- id: commit_accepted_slice
action: gateway.git.commit
after: [review]
with:
message: "Implement next approved Tada List slice"
|
Quality gates:
| examples/13_tada_list_autonomous_development/quality-gates.yml |
|---|
| version: "0.1"
project: tada-list
repository: workspace
# These are named gates consumed by the workflow's verify handler. The target
# repository documents the command surface; the handler must resolve each gate
# to the repository's actual task/Make/Rake/package command after bootstrap.
gates:
backend_lint:
command: lint
scope: backend
backend_tests:
command: test
scope: backend
backend_coverage:
command: coverage
scope: backend
minimum:
line: 90
branch: 90
frontend_lint:
command: lint
scope: frontend
frontend_typecheck:
command: typecheck
scope: frontend
frontend_tests:
command: test
scope: frontend
frontend_coverage:
command: coverage
scope: frontend
minimum:
line: 90
branch: 90
frontend_build:
command: build
scope: frontend
openapi_validation:
command: contract
scope: openapi
generated_client_drift:
command: contract
scope: generated_client
api_e2e:
command: e2e:api
scope: api
browser_e2e:
command: e2e:web
scope: frontend
required_evidence:
- command
- exit_status
- duration
- stdout_redacted
- stderr_redacted
- artifact_references
|
This bundle applies Sandbox Loom to the specification-only Tada List project. It reads the project harness, implements one approved slice, runs named backend/frontend/contract gates, checkpoints evidence, requests approval, and commits only after review. See the bundle README for workspace mapping and execution requirements.
14. Generic project harness
Manifest:
| examples/14_generic_project_harness/.sandbox-loom/project.yml |
|---|
| version: '0.1'
project: notes-fixture
repository: repo
workflow: workflow.yml
profile: autonomous-development
workspace:
mount: /workspace
writable: [/workspace]
cli:
executable: ruby
arguments: [support/notes_agent.rb]
environment: {}
timeout: 120
max_output_bytes: 262144
network_mode: none
oci:
required_commands: [ruby]
required_interpreters: [/usr/bin/ruby]
required_libraries: []
quality_gates: quality-gates.yaml
approval:
required_before_commit: false
commit:
enabled: false
evidence: evidence
|
Workflow:
| examples/14_generic_project_harness/workflow.yml |
|---|
| version: '0.1'
workflow: notes-maintenance
profile: autonomous-development
tasks:
- id: inspect_notes
action: coding_agent.cli.request
with:
operation: inspect-notes
prompt: Inspect the notes repository and report the bounded result.
- id: verify_notes
action: verify
after: [inspect_notes]
checks: [notes_lint]
|
This independent fixture demonstrates that the same bin/sandbox-loom run <project> contract works with a different repository, agent identity, workflow, and quality gate.
15. Static site project — cross-project acceptance fixture
This fixture uses a composed workflow, a deterministic local agent, project
quality gates, and bounded evidence retention. It is the smallest complete
project-harness acceptance example.
bin/sandbox-loom project check examples/15_static_site_project
bin/sandbox-loom run examples/15_static_site_project --check
bin/sandbox-loom run examples/15_static_site_project --runtime local --json-summary
See the fixture's README in the source checkout for its workspace and
acceptance details.
16. Done Deal Desk — governed real-estate operations showcase
This provider-free vertical slice demonstrates tenant-scoped lead intake,
approved knowledge retrieval, deterministic deal scoring, Hermes skill guidance,
OpenClaw intents, a narrow MCP surface, approval-controlled mock CRM/Mailpit
delivery, local platform dependencies, and builder onboarding artifacts.
Run it with:
bin/sandbox-loom run examples/16_done_deal_desk --runtime local --approve --json-summary
The live workflow does not require provider credentials or Docker. Its local
platform declaration is validated as an artifact; a production-shaped project
would run the declared Compose services separately.
Manifest:
| examples/16_done_deal_desk/.sandbox-loom/project.yml |
|---|
| version: '0.1'
project: done-deal-desk
repository: repo
workflow: .sandbox-loom/workflow.yml
profile: autonomous-development
workspace:
mount: /workspace
writable: [/workspace]
cli:
executable: ruby
arguments: [support/deal_desk_agent.rb]
environment: {}
timeout: 120
max_output_bytes: 262144
network_mode: none
oci:
required_commands: [ruby]
required_interpreters: [/usr/bin/ruby]
required_libraries: []
quality_gates: .sandbox-loom/quality-gates.yaml
approval:
required_before_commit: false
commit:
enabled: false
evidence: evidence
retention:
profile: standard
max_artifact_bytes: 262144
redact: true
|
Workflow:
| examples/16_done_deal_desk/.sandbox-loom/workflow.yml |
|---|
| version: '0.1'
workflow: done-deal-desk-analysis
profile: autonomous-development
limits:
max_parallel: 1
tasks:
- id: inspect_leads
action: coding_agent.cli.request
with:
operation: inspect-leads
prompt: Inspect the sample property leads and report the tenant-scoped input summary.
- id: implement_analysis
action: coding_agent.cli.request
after: [inspect_leads]
with:
operation: implement-analysis
prompt: Normalize and deduplicate the sample leads, calculate deterministic scores, and write repo/analysis.json.
- id: verify
action: verify
after: [implement_analysis]
checks: [lint, test, contract, provenance]
- id: draft_offer
action: coding_agent.cli.request
after: [verify]
with:
operation: draft-offer
prompt: Draft an offer from the approved analysis. Do not send it; write repo/offer-draft.json for review.
- id: execute_external_action
action: coding_agent.cli.request
after: [draft_offer]
approval: true
with:
operation: execute-approved-action
prompt: Execute the already approved mock CRM and Mailpit action from repo/offer-draft.json and write repo/delivery.json.
- id: verify_delivery
action: verify
after: [execute_external_action]
checks: [lint, test, contract, provenance, delivery, builder_docs, platform]
- id: checkpoint
action: checkpoint
after: [verify_delivery]
|
OpenAPI contract:
| examples/16_done_deal_desk/repo/specifications/openapi.yml |
|---|
| openapi: 3.1.0
info:
title: Done Deal Desk API
version: 0.1.0
description: Tenant-scoped lead analysis and approval-controlled offer workflow.
servers:
- url: http://localhost:3000
paths:
/leads:
get:
operationId: listLeads
parameters:
- $ref: '#/components/parameters/TenantId'
responses:
'200':
description: Tenant-scoped leads
content:
application/json:
schema:
type: array
items: {$ref: '#/components/schemas/Lead'}
post:
operationId: createLead
parameters:
- $ref: '#/components/parameters/TenantId'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/LeadInput'}
responses:
'201':
description: Lead accepted
content:
application/json:
schema: {$ref: '#/components/schemas/Lead'}
/leads/{lead_id}/analysis:
get:
operationId: showLeadAnalysis
parameters:
- $ref: '#/components/parameters/TenantId'
- $ref: '#/components/parameters/LeadId'
responses:
'200':
description: Deterministic analysis with source references
content:
application/json:
schema: {$ref: '#/components/schemas/Analysis'}
/offers:
post:
operationId: draftOffer
parameters:
- $ref: '#/components/parameters/TenantId'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/OfferDraftInput'}
responses:
'201':
description: Draft offer; no external action is performed
content:
application/json:
schema: {$ref: '#/components/schemas/Offer'}
/offers/{offer_id}/approval:
post:
operationId: requestOfferApproval
parameters:
- $ref: '#/components/parameters/TenantId'
- $ref: '#/components/parameters/OfferId'
responses:
'202':
description: Approval request created
content:
application/json:
schema: {$ref: '#/components/schemas/Approval'}
/offers/{offer_id}/delivery:
post:
operationId: deliverApprovedOffer
parameters:
- $ref: '#/components/parameters/TenantId'
- $ref: '#/components/parameters/OfferId'
responses:
'202':
description: Approved offer delivered through governed brokers
content:
application/json:
schema: {$ref: '#/components/schemas/Delivery'}
components:
parameters:
TenantId:
name: X-Tenant-Id
in: header
required: true
schema: {type: string, minLength: 1}
LeadId:
name: lead_id
in: path
required: true
schema: {type: string}
OfferId:
name: offer_id
in: path
required: true
schema: {type: string}
schemas:
LeadInput:
type: object
required: [address, city, state, postal_code, asking_price, estimated_value, estimated_repair_cost]
properties:
address: {type: string}
city: {type: string}
state: {type: string}
postal_code: {type: string}
asking_price: {type: integer, minimum: 0}
estimated_value: {type: integer, minimum: 0}
estimated_repair_cost: {type: integer, minimum: 0}
Lead:
allOf:
- {$ref: '#/components/schemas/LeadInput'}
- type: object
required: [id, tenant_id, provenance]
properties:
id: {type: string}
tenant_id: {type: string}
provenance: {type: object}
Analysis:
type: object
required: [lead_id, score, components, sources]
properties:
lead_id: {type: string}
score: {type: integer, minimum: 0, maximum: 100}
components: {type: object}
sources: {type: array, items: {type: string}}
OfferDraftInput:
type: object
required: [lead_id, amount]
properties:
lead_id: {type: string}
amount: {type: integer, minimum: 0}
Offer:
type: object
required: [id, tenant_id, status, approval_required]
properties:
id: {type: string}
tenant_id: {type: string}
status: {type: string, enum: [draft, approved, delivered]}
approval_required: {type: boolean, const: true}
Approval:
type: object
required: [id, status, operation]
properties:
id: {type: string}
status: {type: string, enum: [pending, approved, rejected]}
operation: {type: string}
Delivery:
type: object
required: [offer_id, approval_id, targets]
properties:
offer_id: {type: string}
approval_id: {type: string}
targets: {type: array, items: {type: string}}
|
17. Live Hermes and OpenClaw acceptance
The live-provider bundle is skipped by default. It requires explicit
credentials/configuration and a disposable target; see the bundle README for
setup, redaction, evidence correlation, and cleanup. Hermes runs the complete
disposable workflow locally. OpenClaw authenticates and routes an intent to a
Sandbox Loom workflow endpoint, which must return the completed workflow
summary rather than only acknowledging the webhook.
SANDBOX_LOOM_RUN_LIVE_PROVIDERS=1 bin/sandbox-loom examples check
Hermes CLI source:
| examples/17_provider_acceptance/hermes_live.rb |
|---|
| # frozen_string_literal: true
require "json"
require "coding_agent"
require_relative "disposable_workflow"
abort "set SANDBOX_LOOM_RUN_LIVE_HERMES=1 to run the live acceptance" unless ENV["SANDBOX_LOOM_RUN_LIVE_HERMES"] == "1"
configuration = CodingAgent::HermesCliAdapter::Configuration.new(
executable: ENV.fetch("SANDBOX_LOOM_HERMES_EXECUTABLE", "hermes"),
provider: ENV.fetch("SANDBOX_LOOM_HERMES_PROVIDER"),
model: ENV.fetch("SANDBOX_LOOM_HERMES_MODEL"),
working_directory: ENV.fetch("SANDBOX_LOOM_HERMES_WORKING_DIRECTORY", Dir.pwd),
timeout: Integer(ENV.fetch("SANDBOX_LOOM_HERMES_TIMEOUT", "900"), 10),
max_output_bytes: Integer(ENV.fetch("SANDBOX_LOOM_HERMES_MAX_OUTPUT_BYTES", "262144"), 10)
)
adapter = CodingAgent::HermesCliAdapter.new(
configuration: configuration,
authorizer: ->(**request) { { "decision" => "ALLOW", "capability" => request.fetch(:capability) } }
)
result = ProviderAcceptance::DisposableWorkflow.run(
adapter: adapter,
provider: "hermes",
instruction: "Inspect this disposable project, write a concise result to provider-result.txt, and do not modify any other file. Do not include credentials."
)
puts JSON.generate(result.merge("note" => "Credential is held by Hermes and is not included in this output."))
|
OpenClaw webhook source:
| examples/17_provider_acceptance/openclaw_live.rb |
|---|
| # frozen_string_literal: true
require "json"
require "net/http"
require "openssl"
require "uri"
abort "set SANDBOX_LOOM_RUN_LIVE_OPENCLAW=1 to run the live acceptance" unless ENV["SANDBOX_LOOM_RUN_LIVE_OPENCLAW"] == "1"
endpoint = URI.parse(ENV.fetch("SANDBOX_LOOM_OPENCLAW_ENDPOINT"))
secret = ENV.fetch("SANDBOX_LOOM_OPENCLAW_SECRET")
timestamp = Time.now.to_i.to_s
payload = {
"version" => "0.1", "delivery_id" => "live-openclaw-acceptance-#{timestamp}",
"sender_id" => "sandbox-loom-operator", "channel_id" => "acceptance",
"conversation_id" => "live-acceptance", "session_id" => "openclaw-live-acceptance",
"intent" => "implement_next_slice", "message" => "Run the disposable provider acceptance workflow and return its completed summary.",
"project" => ENV.fetch("SANDBOX_LOOM_OPENCLAW_PROJECT", "provider-acceptance"),
"run_id" => ENV.fetch("SANDBOX_LOOM_OPENCLAW_RUN_ID", "openclaw-live-acceptance-#{timestamp}"),
"phase_id" => ENV.fetch("SANDBOX_LOOM_OPENCLAW_PHASE_ID", "phase-26"),
"slice_id" => ENV.fetch("SANDBOX_LOOM_OPENCLAW_SLICE_ID", "openclaw-live")
}
body = JSON.generate(payload)
signature = OpenSSL::HMAC.hexdigest("SHA256", secret, "#{timestamp}.#{body}")
request = Net::HTTP::Post.new(endpoint.request_uri)
request["Content-Type"] = "application/json"
request["X-OpenClaw-Timestamp"] = timestamp
request["X-OpenClaw-Signature"] = "sha256=#{signature}"
request.body = body
http = Net::HTTP.new(endpoint.host, endpoint.port)
http.use_ssl = endpoint.scheme == "https"
response = http.start { |connection| connection.request(request) }
redacted_body = response.body.to_s.gsub(secret, "[REDACTED]")
abort "OpenClaw live acceptance failed with HTTP #{response.code}: #{redacted_body}" unless response.code.to_i.between?(200, 299)
summary = JSON.parse(response.body)
abort "OpenClaw workflow did not complete: #{redacted_body}" unless summary.is_a?(Hash) && summary["status"] == "completed" && summary["run_id"].is_a?(String)
puts JSON.generate(
"provider" => "openclaw", "http_status" => response.code.to_i,
"run_id" => summary.fetch("run_id"), "status" => summary.fetch("status"),
"commit_sha" => summary["commit_sha"], "quality_gates" => summary["quality_gates"],
"note" => "Webhook secret is not included in this output."
)
|
The signed-ingress workflow boundary is also covered without credentials:
bundle exec ruby -I src tests/integration/openclaw_disposable_workflow_test.rb