Interface AiContext.HarnessBuilder

Enclosing interface:
AiContext

public static interface AiContext.HarnessBuilder
  • Method Details

    • events

    • mcpTools

      Set the McpToolSource this harness exposes. The harness starts with no MCP-derived tools — calling this method is how a caller opts in. On the gateway, compose with GatewayAiContext.mcpToolsFor(names) to scope by connection name, or pass a custom source for full control.
    • actor

      AiContext.HarnessBuilder actor(Supplier<@Nullable AiActor> actor)
      Set who this harness runs for. The harness consults this supplier every turn and filters the tool list it offers the model, so a grant revoked mid-conversation takes effect on the caller's next message without a rebuild. Each tool's own gate is re-read on every call as well, which covers a gate tightened while a turn is in flight.

      Resolved per use rather than captured, which is what lets one long-lived harness follow a session whose security levels change. Defaults to AiActor.ANONYMOUS, and a supplier returning null means the same: a caller that names no actor keeps ungated tools and loses gated ones rather than gaining anything.

    • label

      Human-readable description of what this harness is for, recorded on the HarnessInfo snapshot the owning context keeps and surfaced by any status UI built on it — on the gateway, the AI sessions page. Defaults to the agent's Agent.getName().
    • transcript

      Whether this harness writes a conversation transcript. Defaults to TranscriptPolicy.ENABLED: on, into the directory the owning context chose, retained per that context's policy. Pass TranscriptPolicy.DISABLED to suppress it — nothing else about transcript logging is a caller's concern, including closing the file.
    • replyDecoder

      AiContext.HarnessBuilder replyDecoder(ReplyDecoder decoder)
      Decode typed replies with decoder instead of the harness default, which handles records, collections, enums, and java.time. See ReplyDecoder for when that is not enough — most callers never need this.
    • build

      Build the harness and register it with the owning context. The caller owns the result and must close it.
      Throws:
      ProviderConfigException - if the target provider cannot resolve its credentials or model catalog at build time.