类的使用
io.agentscope.core.agent.RuntimeContext
使用RuntimeContext的程序包
程序包
说明
-
io.agentscope.core中RuntimeContext的使用
参数类型为RuntimeContext的io.agentscope.core中的方法修饰符和类型方法说明protected ObjectReActAgent.beforeAgentExecution(List<Msg> msgs, RuntimeContext rc) reactor.core.publisher.Mono<Msg> ReActAgent.call(String text, RuntimeContext context) Calls the agent with a plain text input and per-callRuntimeContext.reactor.core.publisher.Mono<Msg> ReActAgent.call(String text, Class<?> structuredOutputClass, RuntimeContext context) Calls the agent with a plain text input, structured output class, and per-callRuntimeContext.reactor.core.publisher.Mono<Msg> ReActAgent.call(List<Msg> msgs, com.fasterxml.jackson.databind.JsonNode outputSchema, RuntimeContext context) reactor.core.publisher.Mono<Msg> ReActAgent.call(List<Msg> msgs, RuntimeContext context) Calls the agent with a per-callRuntimeContext(metadata for hooks and tools, not persisted).reactor.core.publisher.Mono<Msg> ReActAgent.call(List<Msg> msgs, Class<?> structuredOutputClass, RuntimeContext context) protected reactor.core.publisher.Mono<Msg> ReActAgent.callInternal(List<Msg> msgs, RuntimeContext context, Function<List<Msg>, reactor.core.publisher.Mono<Msg>> doCallFn) Overrides the base-class hook so that everycall()variant — including structured output and context-bearing overloads — runs through the sameReActAgent.buildAgentStream(java.util.List<io.agentscope.core.message.Msg>, io.agentscope.core.agent.RuntimeContext, java.util.function.Function<java.util.List<io.agentscope.core.message.Msg>, reactor.core.publisher.Mono<io.agentscope.core.message.Msg>>)core asstreamEvents().protected ObjectReActAgent.callSerializationKey(RuntimeContext rc) ReActAgent.getAgentState(RuntimeContext ctx) Returns theAgentStatefor the session identified by the givenRuntimeContext.voidReActAgent.interrupt(RuntimeContext ctx) Interrupts the in-flight call identified by the givenRuntimeContext.voidReActAgent.interrupt(RuntimeContext ctx, Msg msg) Interrupts the in-flight call identified by the givenRuntimeContextwith an associated user message.voidReActAgent.saveAgentState(RuntimeContext ctx) Persists the cachedAgentStatefor the session identified by the givenRuntimeContext.voidReActAgent.setPermissionMode(RuntimeContext ctx, PermissionMode mode) Switches thePermissionModefor the session identified by the givenRuntimeContext.reactor.core.publisher.Flux<Event> ReActAgent.stream(List<Msg> msgs, StreamOptions options, com.fasterxml.jackson.databind.JsonNode schema, RuntimeContext context) 已过时, 待删除: 此 API 元素将从以后的版本中删除。since 2.0.0, for removal.reactor.core.publisher.Flux<Event> ReActAgent.stream(List<Msg> msgs, StreamOptions options, RuntimeContext context) 已过时, 待删除: 此 API 元素将从以后的版本中删除。since 2.0.0, for removal.reactor.core.publisher.Flux<Event> ReActAgent.stream(List<Msg> msgs, StreamOptions options, Class<?> structuredModel, RuntimeContext context) 已过时, 待删除: 此 API 元素将从以后的版本中删除。since 2.0.0, for removal.reactor.core.publisher.Flux<AgentEvent> ReActAgent.streamEvents(Msg msg, RuntimeContext context) Stream fine-grainedAgentEvents for a single input message with a caller-suppliedRuntimeContext.reactor.core.publisher.Flux<AgentEvent> ReActAgent.streamEvents(String text, RuntimeContext context) Stream fine-grainedAgentEvents for a plain text input with a caller-suppliedRuntimeContext.reactor.core.publisher.Flux<AgentEvent> ReActAgent.streamEvents(List<Msg> msgs, RuntimeContext context) Stream fine-grainedAgentEvents with a caller-suppliedRuntimeContext. -
io.agentscope.core.agent中RuntimeContext的使用
修饰符和类型方法说明RuntimeContext.Builder.build()static RuntimeContextRuntimeContext.empty()Shallow, mutable empty context (null session fields, empty attribute maps, no tool context).AgentBase.getRuntimeContext()Returns the current per-callRuntimeContext, ornullwhen the agent keeps no per-call scope.参数类型为RuntimeContext的io.agentscope.core.agent中的方法修饰符和类型方法说明protected ObjectAgentBase.beforeAgentExecution(List<Msg> msgs, RuntimeContext rc) Invoked at the start of acall/ stream-backed call, afterAgentBase.acquireExecution()and before any hooks.protected voidAgentBase.bindRuntimeContextToHooks(RuntimeContext ctx) Pushesctxto allRuntimeContextAwarehooks registered for this agent.static RuntimeContext.BuilderRuntimeContext.builder(RuntimeContext source) protected reactor.core.publisher.Mono<Msg> AgentBase.callInternal(List<Msg> msgs, RuntimeContext context, Function<List<Msg>, reactor.core.publisher.Mono<Msg>> doCallFn) Extension point called by everycall()overload, allowing subclasses to wrap the entire invocation in additional middleware (e.g. theonAgentchain inReActAgent).protected ObjectAgentBase.callSerializationKey(RuntimeContext rc) Returns a key that serializes concurrent calls sharing it: calls with an equal, non-null key run one-at-a-time in FIFO order, while calls with different keys (or anullkey) run concurrently.RuntimeContext.Builder.from(RuntimeContext source) static AgentStateRuntimeContext.resolveAgentState(RuntimeContext ctx, Agent fallbackAgent) Resolves the liveAgentStatefor the current call, preferring the call-scoped state carried onctx(concurrency-safe) and falling back tofallbackAgent's state only when the context carries none.default reactor.core.publisher.Flux<Event> StreamableAgent.stream(List<Msg> msgs, StreamOptions options, RuntimeContext context) 已过时, 待删除: 此 API 元素将从以后的版本中删除。since 2.0.0, for removal. -
io.agentscope.core.hook中RuntimeContext的使用
参数类型为RuntimeContext的io.agentscope.core.hook中的方法修饰符和类型方法说明voidRuntimeContextAware.setRuntimeContext(RuntimeContext context) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Injects the runtime context for the current call, ornullwhen not executing or when clearing after a call. -
io.agentscope.core.middleware中RuntimeContext的使用
修饰符和类型方法说明reactor.core.publisher.Flux<AgentEvent> MiddlewareChain.MiddlewareMethod.apply(MiddlewareBase mw, Agent agent, RuntimeContext ctx, I input, Function<I, reactor.core.publisher.Flux<AgentEvent>> next) static <I> Function<I, reactor.core.publisher.Flux<AgentEvent>> MiddlewareChain.build(List<? extends MiddlewareBase> middlewares, Agent agent, RuntimeContext ctx, MiddlewareChain.MiddlewareMethod<I> method, Function<I, reactor.core.publisher.Flux<AgentEvent>> core) Build a middleware chain that producesFlux<AgentEvent>.default reactor.core.publisher.Flux<AgentEvent> MiddlewareBase.onActing(Agent agent, RuntimeContext ctx, ActingInput input, Function<ActingInput, reactor.core.publisher.Flux<AgentEvent>> next) Intercept the tool-call execution phase.default reactor.core.publisher.Flux<AgentEvent> MiddlewareBase.onAgent(Agent agent, RuntimeContext ctx, AgentInput input, Function<AgentInput, reactor.core.publisher.Flux<AgentEvent>> next) Intercept the entire agent invocation.default reactor.core.publisher.Flux<AgentEvent> MiddlewareBase.onModelCall(Agent agent, RuntimeContext ctx, ModelCallInput input, Function<ModelCallInput, reactor.core.publisher.Flux<AgentEvent>> next) Intercept the raw model API call.default reactor.core.publisher.Flux<AgentEvent> MiddlewareBase.onReasoning(Agent agent, RuntimeContext ctx, ReasoningInput input, Function<ReasoningInput, reactor.core.publisher.Flux<AgentEvent>> next) Intercept the reasoning phase (LLM call + streaming output parsing).reactor.core.publisher.Flux<AgentEvent> TaskReminderMiddleware.onReasoning(Agent agent, RuntimeContext ctx, ReasoningInput input, Function<ReasoningInput, reactor.core.publisher.Flux<AgentEvent>> next) default reactor.core.publisher.Mono<String> MiddlewareBase.onSystemPrompt(Agent agent, RuntimeContext ctx, String currentPrompt) Transform the system prompt string (pipeline pattern).reactor.core.publisher.Mono<String> TaskReminderMiddleware.onSystemPrompt(Agent agent, RuntimeContext ctx, String currentPrompt) -
io.agentscope.core.rag中RuntimeContext的使用
参数类型为RuntimeContext的io.agentscope.core.rag中的方法修饰符和类型方法说明KnowledgeRetrievalTools.retrieveKnowledge(String query, Integer limit, Agent agent, RuntimeContext ctx) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Retrieves relevant documents from the knowledge base. -
io.agentscope.core.shutdown中RuntimeContext的使用
修饰符和类型方法说明reactor.core.publisher.Flux<AgentEvent> GracefulShutdownMiddleware.onActing(Agent agent, RuntimeContext ctx, ActingInput input, Function<ActingInput, reactor.core.publisher.Flux<AgentEvent>> next) reactor.core.publisher.Flux<AgentEvent> GracefulShutdownMiddleware.onReasoning(Agent agent, RuntimeContext ctx, ReasoningInput input, Function<ReasoningInput, reactor.core.publisher.Flux<AgentEvent>> next) -
io.agentscope.core.skill中RuntimeContext的使用
参数类型为RuntimeContext的io.agentscope.core.skill中的方法修饰符和类型方法说明protected List<AgentSkill> DynamicSkillMiddleware.filterVisible(List<AgentSkill> raw, RuntimeContext ctx) Hook for subclasses to drop skills that should not be visible in the current request (canary releases, allow-lists, environment gates, …).reactor.core.publisher.Mono<String> DynamicSkillMiddleware.onSystemPrompt(Agent agent, RuntimeContext ctx, String currentPrompt) -
io.agentscope.core.tool中RuntimeContext的使用
参数类型为RuntimeContext的io.agentscope.core.tool中的方法修饰符和类型方法说明reactor.core.publisher.Mono<List<ToolResultBlock>> Toolkit.callTools(List<ToolUseBlock> toolCalls, ExecutionConfig agentExecutionConfig, Agent agent, RuntimeContext agentRuntimeContext) Execute multiple tools asynchronously with agent-level context (internal use by ReActAgent).ToolCallParam.Builder.runtimeContext(RuntimeContext runtimeContext) Sets the runtime context for the tool call. -
io.agentscope.core.tracing中RuntimeContext的使用
参数类型为RuntimeContext的io.agentscope.core.tracing中的方法修饰符和类型方法说明reactor.core.publisher.Flux<AgentEvent> OtelTracingMiddleware.onActing(Agent agent, RuntimeContext ctx, ActingInput input, Function<ActingInput, reactor.core.publisher.Flux<AgentEvent>> next) reactor.core.publisher.Flux<AgentEvent> OtelTracingMiddleware.onAgent(Agent agent, RuntimeContext ctx, AgentInput input, Function<AgentInput, reactor.core.publisher.Flux<AgentEvent>> next) reactor.core.publisher.Flux<AgentEvent> OtelTracingMiddleware.onModelCall(Agent agent, RuntimeContext ctx, ModelCallInput input, Function<ModelCallInput, reactor.core.publisher.Flux<AgentEvent>> next)