Package net.thevpc.naru.impl.engine
Class NaruAgentImpl
java.lang.Object
net.thevpc.naru.impl.engine.NaruAgentImpl
- All Implemented Interfaces:
NaruAgent
The core agent loop.
- Adds a system prompt + user task to the conversation history.
- Calls the model.
- If the model returns
tool_calls: dispatches each call viaNaruRegistry, appends the results, and loops. - If the model returns plain text: that is the final answer.
- Stops after
maxStepsiterations regardless.
This class is pure Java — no Nuts dependency — so it can be extracted into a standalone library later.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondirectiveFilter(Predicate<NaruDirective> directiveFilter) env()voidlog(NaruLogMode mode, net.thevpc.nuts.text.NMsg message) logger(net.thevpc.nuts.log.NLogger logger) <T> Future<T>postAction(net.thevpc.nuts.concurrent.NCallable<T> action) net.thevpc.nuts.io.NPathprojectDirectory(net.thevpc.nuts.io.NPath projectDirectory) net.thevpc.nuts.util.NOptional<NaruSession>sessions()A snapshot, not a window: a host iterating the result cannot be broken by, or break, a session starting at the same moment.tagFilter(Predicate<NaruToolTag> tagFilter) toolFilter(Predicate<NaruTool> toolFilter)
-
Constructor Details
-
NaruAgentImpl
public NaruAgentImpl()
-
-
Method Details
-
directiveFilter
- Specified by:
directiveFilterin interfaceNaruAgent
-
directiveFilter
- Specified by:
directiveFilterin interfaceNaruAgent
-
toolFilter
- Specified by:
toolFilterin interfaceNaruAgent
-
toolFilter
- Specified by:
toolFilterin interfaceNaruAgent
-
tagFilter
-
tagFilter
-
postAction
-
projectDirectory
public net.thevpc.nuts.io.NPath projectDirectory()- Specified by:
projectDirectoryin interfaceNaruAgent
-
projectDirectory
- Specified by:
projectDirectoryin interfaceNaruAgent
-
env
-
getModelAliases
-
logger
-
newSession
- Specified by:
newSessionin interfaceNaruAgent
-
sessions
A snapshot, not a window: a host iterating the result cannot be broken by, or break, a session starting at the same moment. -
session
-
log
-