Interface AiContext.HarnessBuilder
- Enclosing interface:
AiContext
public static interface AiContext.HarnessBuilder
Platform-visible builder returned by
AiContext.newAgenticHarness(String, String, Agent.AgentFactory).-
Method Summary
Modifier and TypeMethodDescriptionSet who this harness runs for.build()Build the harness and register it with the owning context.events(Consumer<HarnessEvent> events) Human-readable description of what this harness is for, recorded on theHarnessInfosnapshot the owning context keeps and surfaced by any status UI built on it — on the gateway, the AI sessions page.mcpTools(McpToolSource source) Set theMcpToolSourcethis harness exposes.replyDecoder(ReplyDecoder decoder) Decode typed replies withdecoderinstead of the harness default, which handles records, collections, enums, andjava.time.transcript(TranscriptPolicy policy) Whether this harness writes a conversation transcript.
-
Method Details
-
events
-
mcpTools
Set theMcpToolSourcethis harness exposes. The harness starts with no MCP-derived tools — calling this method is how a caller opts in. On the gateway, compose withGatewayAiContext.mcpToolsFor(names)to scope by connection name, or pass a custom source for full control. -
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 theHarnessInfosnapshot the owning context keeps and surfaced by any status UI built on it — on the gateway, the AI sessions page. Defaults to the agent'sAgent.getName(). -
transcript
Whether this harness writes a conversation transcript. Defaults toTranscriptPolicy.ENABLED: on, into the directory the owning context chose, retained per that context's policy. PassTranscriptPolicy.DISABLEDto suppress it — nothing else about transcript logging is a caller's concern, including closing the file. -
replyDecoder
Decode typed replies withdecoderinstead of the harness default, which handles records, collections, enums, andjava.time. SeeReplyDecoderfor 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 mustcloseit.- Throws:
ProviderConfigException- if the target provider cannot resolve its credentials or model catalog at build time.
-