bothy-sdk
    Preparing search index...

    Class AgentHandler

    The runtime side of an adapter; extend it and override AgentHandler.prepare and AgentHandler.execute.

    Every method that belongs to a run runs inside the run's SR9 binding: each request of the adapter's client carries the run's newest invocation token.

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Returns the billing mode the runtime uses for this run (unknown when unsure).

      Parameters

      Returns ActualBilling

      The actual mode; the default unknown refuses every run (fail closed).

    • Returns the tool class the runtime actually loaded (07 2.11).

      Returns "host" | "chat" | "scoped"

      The tool class; the default is chat.

    • Runs the runtime; called only after 200 on startRun.

      Returning ends the run completed unless the handler finished it or waits for input; RuntimeFailure ends it failed with runtime_error, any other error with adapter_error. After run.cancel_requested the adapter ends the run cancelled without waiting for this promise; watch run.cancelled to stop the runtime.

      Parameters

      Returns Promise<void>

      A promise that resolves when the runtime is done.

      Error unless overridden.

    • Returns choices for an autocomplete request before it expires.

      Never call a model here (R-AG-14): typing must cost nothing and never hang.

      Parameters

      Returns Promise<readonly {}[]>

      At most command.autocomplete_max_choices choices.

    • Handles a command invocation (command.invoked); it never starts, resumes or ends a run.

      Parameters

      • inv: Invocation

        The invocation.

      • run: RunHandle | undefined

        The adapter's run the command names, if it is running here.

      Returns Promise<void>

      A promise that resolves when handled.

    • Handles an event without an invocation token (for example agent.config_changed).

      Parameters

      Returns Promise<void>

      A promise that resolves when handled.

    • Handles a follow-up message of a running or resumed run.

      Parameters

      Returns Promise<void>

      A promise that resolves when handled.

    • Handles an interaction with a component of a running or resumed run.

      Parameters

      Returns Promise<void>

      A promise that resolves when handled.

    • Gets ready for a run before it starts (load context, pick a model); no runtime yet.

      Parameters

      Returns Promise<StartOptions>

      The options of startRun.

      Error unless overridden.