A harness for an agent (design ยง4.37): file tools over a backend, optionally execute over a sandbox, and the middleware that plan, manage context, load skills and instructions and check permissions - assembled in a fixed order by AgentBuilder.withHarness. Start from HarnessProfile.deepAgents, or from HarnessProfile() (the file tools alone), and change it with the with* setters; org.llm4s.config.HarnessConfigLoader loads the preset's settings from llm4s.agent.harness.
build() installs, outermost first and before the builder's own middleware: a PermissionMiddleware over permissions (none when they are empty, since a PermissionMiddleware denies every call no rule matches), then summarisation, offload, skills, instructions and todos, each when set. The selected file tools run over backend, or over a CompositeBackend that also mounts OffloadBackend at /large_tool_results when offload is set; skills and instructions read through the same backend. execute is added only when sandbox is set. Each tool of the profile that declares no timeout is bounded by toolTimeout. The system prompt follows systemPrompt. After each turn, as it is admitted, the root agent prunes the thread to retention (RunConfig.withRetention), which bounds the full-snapshot checkpoints it keeps.
build() refuses an invalid setting (a limit a component refuses, a blank PromptMode.Replace), a tool name the selection does not know, execute selected without a sandbox, and withSystemPrompt beside a harness: set the prompt through systemPrompt.
Value parameters
- backend
-
where the file tools, skills and instructions read and write
- instructions
-
instruction memory (
AGENTS.md);Nonefor none - offload
-
offload of large tool results;
Nonefor none - permissions
-
permission rules, first match wins; empty for no permission checks
- retention
-
what a thread keeps of its checkpoints and events, applied as each turn is admitted
- sandbox
-
where
executeruns commands;Noneadds noexecutetool - skills
-
Agent Skills;
Nonefor none - summarization
-
summarisation of older messages;
Nonefor none - systemPrompt
-
the system prompt
- todos
-
the plan (
write_todos);Nonefor none - toolTimeout
-
the bound on each run of a profile tool that declares none
- tools
-
which of the file tools and
executethe agent gets
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass Any