Ready-to-run ClosedLoopOS examples live in the examples/ directory of the repository.
Path: examples/zero-human-company/
A minimal working company that operates autonomously with no human intervention required. It demonstrates the full ClosedLoopOS loop: a scheduled SOP dispatches work to an AI agent, which uses the SDK to read data, post progress, and write structured results.
| File | Purpose |
|---|---|
| sops/weekly-digest.yaml | Multi-step SOP with a cron schedule trigger |
| agents/digest-bot/index.ts | TypeScript agent using @closedloopos/sdk |
| agents/digest-bot/package.json | Standalone agent package |
# Navigate to the examples directory (from your Nextcloud sync)
cd ~/ClosedLoopOS/examples/zero-human-company
# Validate the SOP (no server required)
clos sop validate weekly-digest
# Dry-run the SOP (no server required)
clos sop run weekly-digest --dry-run
# Live run (requires a running ClosedLoopOS instance)
export CLOSEDLOOP_API_URL=http://localhost:3100
export CLOSEDLOOP_COMPANY_ID=<your-company-id>
clos sop run weekly-digest --input companyId=<your-company-id>
See the example README for full setup instructions.
AgentRuntime.fromEnv()Agents bootstrap from ClosedLoopOS environment variables automatically:
import { AgentRuntime } from "@closedloopos/sdk"
const runtime = AgentRuntime.fromEnv()
const task = await runtime.getCurrentTask()
After doing the work, an agent writes a step-result document to signal the SOP runner:
await runtime.completeStep({
status: "done",
outputs: { totalIssues: 12, doneCount: 5 },
startedAt,
completedAt: new Date().toISOString(),
})
If an agent cannot proceed, it blocks the step and escalates:
await runtime.blockStep({
code: "API_ERROR",
message: "Could not reach the issues API",
escalateTo: "ceo",
})
Have a ClosedLoopOS workflow worth sharing? See the contribution guidelines
and open a PR with your example in examples/<your-example-name>/.