Skip to main content
A POST to /agents/<name>/<conversation>/rpc/<method> calls one method on the conversation’s instance. mountAgents resolves the address to the instance and hands the POST to the class’s fetch(), and only a method marked @rpc answers. Who may call is decided by authorize(), which The Streams shows with fetch. The class marks five methods.

receive()

invoke, chat and rpc … receive post ["text"] to …/rpc/receive:
The reply is not returned from this call. It arrives through the task the harness queues and is read back on the state stream as lastReply, which is what invoke waits for. It is never sent out on a channel. key makes a redelivered message a no-op, answered with duplicate: true. Admit is the next step. receive carries @rpc, as @rpc({ description: "Deliver one inbound message; the reply is produced off the request path" }).
  • Only a method that carries it dispatches over the mount. Every other method of the class is private there.
  • description is what rpcSurface() reports for the method.

Approvals and Runs

approve, deny, inspectApproval, pendingApproval and run are reached the same way, and through telnyx-acp rpc:
Each reads or writes the harness’s own ledger, which holds the pending approvals and the status of every run. A run paused on an ask continues on its own task once approve grants its approval. pendingApproval names the approval a paused run waits on, read from the ledger on that later call; telnyx-acp invoke asks for it when the state stream has not named it. approvals.grant(), approvals.deny() and approvals.inspect() are the harness’s approvals ledger, and get(runId) is the harness’s get().
  • approvalId names an approval, and each of the three returns its HarnessApproval.
  • deny() also continues the run. The call is not executed, and the model is told it was denied.
  • Each of the three is checked against the authorization port for its required action. The constructor registers that port from the host’s authorization, as The Harness shows.
  • runId names a run, and get() returns its HarnessRun, or undefined for an unknown id.
  • Each method calls ready() first, so the runs a restart interrupted are recovered before anything is read or decided.