user-defined-ask.ts 388 B

1234567891011
  1. // A user object with its own `.ask` method must NOT register as an ask site:
  2. // site detection resolves the callee symbol to the facade, not by method name.
  3. const notAnAgent = {
  4. ask(question: string): string {
  5. return question.toUpperCase();
  6. },
  7. };
  8. const shouted = notAnAgent.ask("hello");
  9. const real = await agent("scanner").ask<string>(`Answer, given ${shouted}`);
  10. return real;