Waiting for External Input with Golem Promises (TypeScript)
SkillAI & modelsPauses your agent mid-task until an external event or human response arrives.
Use Waiting for External Input with Golem Promises (TypeScript) in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add Waiting for External Input with Golem Promises (TypeScript) and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the Waiting for External Input with Golem Promises (TypeScript) skill
Details
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; Ahel provides instructions and does not run this skill.
No other account needed.
Add Ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
About this skill
Waiting for external input using Golem promises in a TypeScript Golem project. Use when the user asks about promises, waiting for external events, human-in-the-loop workflows, pausing an agent until an external signal, or suspending execution until data arrives from outside.
What this skill tells your AI
The instructions your AI receives, as published by golemcloud/golem in golem-skills/skills/ts/golem-wait-for-external-input-ts/SKILL.md and read by Ahel’s review.
Overview
A Golem promise lets an agent suspend its execution until an external event completes it. The agent creates a promise, passes the promise ID to an external system (another agent, a webhook, a UI, an HTTP API call), and then awaits the result. The Golem runtime durably suspends the agent — consuming no resources — until the promise is fulfilled.
API
All functions are in @golemcloud/golem-ts-sdk:
| Function | Signature | Description |
|---|---|---|
createPromise | () => PromiseId | Creates a new promise and returns its ID |
awaitPromise | (id: PromiseId) => Promise<Uint8Array> | Awaits promise completion (non-blocking) |
completePromise | (id: PromiseId, data: Uint8Array) => boolean | Completes a promise with raw bytes |
Imports
import { createPromise, awaitPromise, completePromise } from '@golemcloud/golem-ts-sdk';
import type { PromiseId } from '@golemcloud/golem-ts-sdk';
Usage Pattern
1. Create a Promise and Wait
const promiseId = createPromise();
// Pass promiseId to an external system...
// Agent is durably suspended here until the promise is completed
const resultBytes = await awaitPromise(promiseId);
const result = new TextDecoder().decode(resultBytes);
2. Complete a Promise from Another Agent
const data = new TextEncoder().encode(JSON.stringify({ status: "approved" }));
completePromise(promiseId, data);
3. Decode JSON from a Completed Promise
const promiseId = createPromise();
const bytes = await awaitPromise(promiseId);
const decision = JSON.parse(new TextDecoder().decode(bytes));
PromiseId Structure
A PromiseId contains an agentId and an oplogIdx. To let an external system complete the promise via the Golem REST API, the agent must expose both fields. The external caller then sends:
POST /v1/components/{component_id}/workers/{agent_name}/complete
Content-Type: application/json
{"oplogIdx": <oplog_idx>, "data": [<bytes>]}
Full Example: Human-in-the-Loop Approval
import { z } from 'zod';
import { defineAgent, method, http, createPromise, awaitPromise } from '@golemcloud/golem-ts-sdk';
export const WorkflowAgent = defineAgent({
name: 'WorkflowAgent',
id: { name: z.string() },
http: http.mount('/workflows/{name}'),
methods: {
startApproval: method({ input: {}, returns: z.string(), http: http.post('/approve') }),
},
});
export const WorkflowAgentImpl = WorkflowAgent.implement({
init: ({ id }) => ({ name: id.name }),
methods: {
async startApproval() {
// 1. Create a promise
const promiseId = createPromise();
// 2. Pass promiseId.oplogIdx to an external system.
// The agent is now durably suspended.
// 3. Wait for external completion
const bytes = await awaitPromise(promiseId);
const decision = JSON.parse(new TextDecoder().decode(bytes));
return decision.status === 'approved'
? `Workflow ${this.name} approved ✅`
: `Workflow ${this.name} rejected ❌`;
},
},
});
Use Cases
- Human-in-the-loop: Pause a workflow until a human approves or rejects
- Webhook callbacks: Wait for an external HTTP callback to arrive
- Inter-agent synchronization: One agent creates a promise, another completes it
- External event ingestion: Suspend until an IoT sensor, payment gateway, or third-party API sends a signal
Signals
- GitHub stars
- 2k
- Forks
- 210
- Last commit
- Oct 2026
Advanced
- Item type
- skill
- Key
golem-wait-for-external-input-ts- Source
- github.com/golemcloud/golem
Related picks
Skill · mattpocock
The pick for TypeScripttypescript-pro
Skill · jeffallan
The pick for TypeScriptskill-creator
Skill · anthropics
More in AI & modelstriage
Skill · mattpocock
More in AI & modelsalgorithmic-art
Skill · anthropics
More in AI & modelscode-review-and-quality
Skill · addyosmani
More in AI & models