Class WorkspaceContextMiddleware
java.lang.Object
io.agentscope.harness.agent.middleware.WorkspaceContextMiddleware
- All Implemented Interfaces:
io.agentscope.core.middleware.MiddlewareBase,HarnessRuntimeMiddleware
Appends workspace context (session info, AGENTS.md, MEMORY.md, knowledge) to the
system prompt via
onSystemPrompt(Agent, RuntimeContext, String).
Runs once per call() (just like the previous WorkspaceContextHook
fired on PreCallEvent).
Memory-related guidance and <memory_context> injection are gated by the same
builder flags as Harness memory tools/hooks (disableMemoryTools /
disableMemoryHooks) so the model is not instructed to use capabilities that are
turned off.
-
Constructor Summary
ConstructorsConstructorDescriptionWorkspaceContextMiddleware(WorkspaceManager workspaceManager) WorkspaceContextMiddleware(WorkspaceManager workspaceManager, int maxContextTokens) WorkspaceContextMiddleware(WorkspaceManager workspaceManager, String agentName, String environmentMemory, int maxContextTokens) WorkspaceContextMiddleware(WorkspaceManager workspaceManager, String agentName, String environmentMemory, int maxContextTokens, boolean disableMemoryTools, boolean disableMemoryHooks) -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether memory hooks are disabled for this middleware (affects prompt guidance).booleanWhether memory tools are disabled for this middleware (affects prompt guidance).reactor.core.publisher.Mono<String>onSystemPrompt(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, String currentPrompt) voidsetAdditionalContextFiles(List<String> files) voidsetArtifactDeliveryEnabled(boolean artifactDeliveryEnabled) Whether anArtifactDeliveryTargetis configured and thedeliver_artifacttool is exposed.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.agentscope.core.middleware.MiddlewareBase
onActing, onAgent, onModelCall, onReasoning, order
-
Constructor Details
-
WorkspaceContextMiddleware
-
WorkspaceContextMiddleware
-
WorkspaceContextMiddleware
public WorkspaceContextMiddleware(WorkspaceManager workspaceManager, String agentName, String environmentMemory, int maxContextTokens) -
WorkspaceContextMiddleware
public WorkspaceContextMiddleware(WorkspaceManager workspaceManager, String agentName, String environmentMemory, int maxContextTokens, boolean disableMemoryTools, boolean disableMemoryHooks)
-
-
Method Details
-
setAdditionalContextFiles
-
isDisableMemoryTools
public boolean isDisableMemoryTools()Whether memory tools are disabled for this middleware (affects prompt guidance). -
isDisableMemoryHooks
public boolean isDisableMemoryHooks()Whether memory hooks are disabled for this middleware (affects prompt guidance). -
setArtifactDeliveryEnabled
public void setArtifactDeliveryEnabled(boolean artifactDeliveryEnabled) Whether anArtifactDeliveryTargetis configured and thedeliver_artifacttool is exposed. Whentrue, the sandbox branch of the workspace paragraph tells the model to use that tool; whenfalse, it states that files cannot leave the sandbox. -
onSystemPrompt
public reactor.core.publisher.Mono<String> onSystemPrompt(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, String currentPrompt) - Specified by:
onSystemPromptin interfaceio.agentscope.core.middleware.MiddlewareBase
-