An agent under construction, from Llm4s.agentBuilder (#2476): its system prompt, tools, guardrails, context window and streaming, set from Java with Java types only.
LlmResult<JAgent> agent = Llm4s.agentBuilder("support", client)
.systemPrompt("You are a support assistant.")
.tools(tools)
.inputGuardrails(List.of(JGuardrails.length(1, 10_000)))
.outputGuardrails(List.of(JGuardrails.json()))
.contextWindow(JContextWindow.lastMessages(20))
.streaming(true)
.build();
Immutable: every method returns a new builder, and each setting replaces the one set before. No method throws: a null argument, and anything build cannot make an agent of, is a failed result of build().
The agent, or a failed result naming the first problem: a null id, client or setting, a blank or invalid id, a null element in a list, two tools with one name, an invalid guardrail or context window, or tools the agent cannot offer together.
The agent, or a failed result naming the first problem: a null id, client or setting, a blank or invalid id, a null element in a list, two tools with one name, an invalid guardrail or context window, or tools the agent cannot offer together.