Vana SDK - v4.1.0
    Preparing search index...

    Function askPersonalServer

    • Register a question, wait for it, and read the answer: the whole builder loop in one call.

      Parameters

      • params: AskPersonalServerParams

      Returns Promise<AskPersonalServerResult>

      The settled registration and the derived record.

      registerQuestion + waitForQuestion + readPersonalServerData on the derived scope, which is why the grant needs a bare read entry for derivedScope on top of write:<derivedScope> and the source reads. The read is the plain Web3Signed one; when the grant is priced, settle the 402 yourself with the escrow-aware read from @opendatalabs/vana-sdk/server and use registerQuestion and waitForQuestion directly.

      A question registered this way keeps recomputing after the call returns: every later change to a source scope refreshes the derived record, and the builder can read it again without registering anything.

      const { registration, record } = await askPersonalServer({
      personalServerUrl: "https://ps.example.com",
      signer,
      grantId,
      derivedScope: "coach.weekly",
      sourceScopes: ["oura.sleep"],
      question: "How did my sleep trend this week?",
      });
      console.log(record.data.answer, registration.questionId);

      The question settled as failed (details.error is the server's reason).

      Everything registerQuestion, waitForQuestion and the read path throw.