Client and Protocol API
July 22, 2026 ยท View on GitHub
createTaskyonClient(port) exposes nested protocol services and convenience operations over a
Taskyon port. initializeTaskyon(...) creates that connection for an iframe host.
const result = await client.runTasks([[toolCall({ name: 'entryNode', arguments: {} })]], 'return', {
timeoutMs: 60_000,
show: true,
})
runTasks accepts task chains, a quit condition, and execution options. It returns the matched task
or throws on error, abort, or timeout. Use processTasksDetailed(port) when the caller needs the
settlement status and observed tasks.
Common execution options are:
timeoutMsandsignalfor bounded execution;display: 'activeChat' | 'background'or the legacyshowflag;throwOnError: falsewhen the caller wants an error task as a normal settlement;interruptOnSettlewhen the host must stop remaining work after a match, timeout, abort, or error.
Quit conditions can be a task content type, an array of content types, or a predicate. Waiting for
return detects explicit workflow completion; waiting for structured is useful for typed data.
The client also exposes:
task,tools,files,archive, andpeerprotocol services;callTool(name, args, options)for RPC tool execution;sendFiles(files)for file registration;waitUntilReady(options)for explicit startup coordination.
createTaskChainFromMarkdown(client, markdown, options) imports portable Taskyon Markdown and
returns the new leaf ID. Import does not execute by default.
Tool RPC
registerToolRpcTools(...) registers host functions on a port. callTool(name, args, options)
invokes a registered tool without creating a task tree. Use task execution when the call should be
auditable as workflow state; use direct tool RPC for host control paths that are already recorded
elsewhere.
Remote calls support timeouts, abort signals, and function cancellation. A host-provided
createContext supplies only the task-chain and other capabilities needed by that client tool.
Readiness
Clients defer commands until Taskyon emits its ready lifecycle event or answers peer.ping.
createTaskyonClient(port, { deferUntilReady: false }) disables that gate only when the caller
already owns startup ordering.
Iframe client
initializeTaskyon(...) finds the configured iframe, transfers a message channel, sends partial
profile configuration, registers host tools, and returns a TyClient. Reconfiguration can change
the profile, persistence, binding key, and tool set without giving Taskyon ambient access to the
host page.
Use exports from @taskyon/taskyon/api and @taskyon/tyclient. Internal relative imports are not a
supported integration contract.