feat: Add alwaysSkipCache flag to AgentContext and update BaseAgent to utilize it

This commit is contained in:
extio-de
2026-03-14 15:27:01 +01:00
parent afae2cb416
commit a26b076b5a
2 changed files with 12 additions and 1 deletions

View File

@@ -30,6 +30,8 @@ public final class AgentContext {
private volatile boolean skipCache;
private volatile boolean alwaysSkipCache;
private volatile Conversation conversation;
private final AgentRequestStatistic requestStatistic;
@@ -80,6 +82,7 @@ public final class AgentContext {
this.errorException = other.errorException;
this.skipNextCompletion = other.skipNextCompletion;
this.skipCache = other.skipCache;
this.alwaysSkipCache = other.alwaysSkipCache;
this.streaming = other.streaming;
synchronized (other.graph) {
this.graph.addAll(other.graph);
@@ -234,6 +237,14 @@ public final class AgentContext {
this.skipCache = skipCache;
}
public boolean isAlwaysSkipCache() {
return this.alwaysSkipCache;
}
public void setAlwaysSkipCache(final boolean alwaysSkipCache) {
this.alwaysSkipCache = alwaysSkipCache;
}
Consumer<AgentContext> getAgentContextUpdateConsumer() {
return agentContextUpdateConsumer;
}

View File

@@ -112,7 +112,7 @@ public interface BaseAgent {
split.context().getGraph().add(this.name());
if (!skipCompletion) {
final boolean skipCache = split.context().isSkipCache();
final boolean skipCache = split.context().isSkipCache() || split.context().isAlwaysSkipCache();
split.context().setSkipCache(false);
final var conversation = this.setupConversation(split);