HarnessAgent
public class HarnessAgent implements Agent, AutoCloseable
io/agentscope/harness/agent/HarnessAgent.java:169–2971Harness 智能体,承载智能体的部署、调度与服务化运行。位于 io.agentscope.harness.agent 包,实现 Agent、AutoCloseable。核心成员包括 getWorkspaceManager、workspaceFor、getCompactionHook、getSkillRepositories、getSkillUsageStore、queryAudit。
HarnessAgent is the user-facing harness API that wraps a ReActAgent with workspace /
filesystem / sandbox / subagent / skill / plan-mode / MCP orchestration.
Use #builder() to configure. For plain ReAct usage without any of the above, use
ReActAgent#builder() directly.
Capabilities added on top of the inner ReActAgent:
-
Workspace-based context loading (AGENTS.md, MEMORY.md, KNOWLEDGE.md)
-
Pluggable file-system backend (local, sandbox, remote/composite)
-
Subagent orchestration via
task/task_outputtools (sync + background) -
Skill loading via
AgentSkillRepository, including the self-learning loop -
Memory flush + message offload before context compression
-
Workspace-managed
tools.json(MCP servers + allow/deny filter) -
Plan mode (read-only design phase) with
plan_enter/plan_write/plan_exittools -
Context-overflow emergency compaction via
CompactionMiddleware
Thread Safety: HarnessAgent is stateless between calls and safe to use as a
singleton serving multiple users/sessions concurrently. Each call() uses the
io.agentscope.core.agent.RuntimeContext's (userId, sessionId) to isolate state.
Calls targeting the same session are serialized automatically; different sessions run in parallel.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | `HarnessAgent`的构建器。 Builder for `HarnessAgent`. |
方法摘要Method Summary
方法详情Method Detail
getWorkspaceManager
public WorkspaceManager getWorkspaceManager()
获取工作区管理器。
Returns the workspace manager bound to this agent, or null if not configured.
WorkspaceManagerio/agentscope/harness/agent/HarnessAgent.java:246–248workspaceFor
public WorkspaceManager workspaceFor(String userId, String sessionId)
执行工作区用于相关操作。
Returns a WorkspaceManager view whose filesystem and namespace are bound to the given (userId, sessionId) for the duration of the returned view's IO.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
WorkspaceManagerio/agentscope/harness/agent/HarnessAgent.java:256–261getCompactionHook
public CompactionMiddleware getCompactionHook()
获取压缩钩子。
Returns the CompactionMiddleware instance if compaction was configured, or null.
CompactionMiddlewareio/agentscope/harness/agent/HarnessAgent.java:264–266getSkillRepositories
public List<AgentSkillRepository> getSkillRepositories()
获取 getSkillRepositories。
Returns the ordered list of AgentSkillRepository instances bound to this agent (low to high priority).
List<AgentSkillRepository>io/agentscope/harness/agent/HarnessAgent.java:272–274getSkillUsageStore
public SkillUsageStore getSkillUsageStore()
获取技能用量存储。
Access to the sidecar telemetry store.
SkillUsageStoreio/agentscope/harness/agent/HarnessAgent.java:278–280queryAudit
public List<SkillAuditLog.Entry> queryAudit(String dayUtc, java.util.function.Predicate<SkillAuditLog.Entry> filter)
查询 queryAudit。
Query the audit log for a given UTC day.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
dayUtc | String | day Utc(类型 `String`)。The day utc. |
filter | java.util.function.Predicate<SkillAuditLog.Entry> | 过滤条件(类型 `java.util.function.Predicate`)。The filter. |
List<SkillAuditLog.Entry>io/agentscope/harness/agent/HarnessAgent.java:286–292runCuratorOnce
public Mono<SkillCurator.CuratorRunReport> runCuratorOnce()
运行 runCuratorOnce。
Force-run the skill curator immediately, bypassing the idle-and-interval gate.
Mono<SkillCurator.CuratorRunReport>io/agentscope/harness/agent/HarnessAgent.java:298–303promoteSkill
public Mono<SkillPromoter.PromotionResult> promoteSkill(String name, String reviewerId, RuntimeContext ctx)
执行 promoteSkill 方法。
Promote a draft skill for the explicitly supplied request context.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 名称(类型 `String`)。The name. |
reviewerId | String | reviewer 标识(类型 `String`)。The reviewer id. |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
Mono<SkillPromoter.PromotionResult>io/agentscope/harness/agent/HarnessAgent.java:312–321enterPlanMode
public void enterPlanMode(RuntimeContext ctx)
设置该参数。
Enters plan mode for the session identified by the given RuntimeContext.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
io/agentscope/harness/agent/HarnessAgent.java:327–329exitPlanMode
public void exitPlanMode(RuntimeContext ctx)
设置该参数。
Exits plan mode for the session identified by the given RuntimeContext.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
io/agentscope/harness/agent/HarnessAgent.java:332–334isPlanModeActive
public boolean isPlanModeActive(RuntimeContext ctx)
判断是否 isPlanModeActive。
Returns whether the plan mode active.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
booleanio/agentscope/harness/agent/HarnessAgent.java:337–339clearContext
public void clearContext(RuntimeContext ctx)
清空上下文。
Clears the model-visible conversation context for the session identified by ctx.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。runtime context identifying the session |
io/agentscope/harness/agent/HarnessAgent.java:349–351clearContext
public void clearContext(String userId, String sessionId)
清空上下文。
Clears the model-visible conversation context for one (userId, sessionId) session.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。user identity for the slot (`null` = anonymous / single-tenant) |
sessionId | String | 会话标识(类型 `String`)。session identity; `null` or blank uses the default session id |
io/agentscope/harness/agent/HarnessAgent.java:362–364clearStateCache
public void clearStateCache()
清空状态缓存。
Clears all locally cached per-session state and permission engines held by the wrapped ReActAgent.
io/agentscope/harness/agent/HarnessAgent.java:370–372clearStateCache
public void clearStateCache(RuntimeContext ctx)
清空状态缓存。
Clears the locally cached state and permission engine for the session identified by ctx.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。runtime context identifying the session |
io/agentscope/harness/agent/HarnessAgent.java:380–382clearStateCache
public void clearStateCache(String userId, String sessionId)
清空状态缓存。
Clears the locally cached state and permission engine for one (userId, sessionId) slot.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。user identity for the slot (`null` = anonymous / single-tenant) |
sessionId | String | 会话标识(类型 `String`)。session identity; `null` or blank uses the default session id |
io/agentscope/harness/agent/HarnessAgent.java:391–393enterPlanMode
public void enterPlanMode(String userId, String sessionId)
执行 enterPlanMode 方法。
Enters plan mode for the given (userId, sessionId) session, independent of which slot is currently active.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
io/agentscope/harness/agent/HarnessAgent.java:400–408exitPlanMode
public void exitPlanMode(String userId, String sessionId)
执行 exitPlanMode 方法。
Exits plan mode for the given (userId, sessionId) session and persists the change.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
io/agentscope/harness/agent/HarnessAgent.java:411–419isPlanModeActive
public boolean isPlanModeActive(String userId, String sessionId)
判断是否 isPlanModeActive。
Returns whether the plan mode active.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
booleanio/agentscope/harness/agent/HarnessAgent.java:422–425setPermissionMode
public void setPermissionMode(RuntimeContext ctx, io.agentscope.core.permission.PermissionMode mode)
设置权限模式。
Switches the io.agentscope.core.permission.PermissionMode for the session identified by the given RuntimeContext at runtime.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
mode | io.agentscope.core.permission.PermissionMode | 模式(类型 `io.agentscope.core.permission.PermissionMode`)。The mode. |
io/agentscope/harness/agent/HarnessAgent.java:432–435setPermissionMode
public void setPermissionMode(String userId, String sessionId, io.agentscope.core.permission.PermissionMode mode)
设置权限模式。
Switches the io.agentscope.core.permission.PermissionMode for the given (userId, sessionId) session at runtime, preserving configured rules and rebuilding the cached permission engine.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
mode | io.agentscope.core.permission.PermissionMode | 模式(类型 `io.agentscope.core.permission.PermissionMode`)。The mode. |
io/agentscope/harness/agent/HarnessAgent.java:442–445getPermissionMode
public io.agentscope.core.permission.PermissionMode getPermissionMode(String userId, String sessionId)
获取权限模式。
Returns the permission mode.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
io.agentscope.core.permission.PermissionModeio/agentscope/harness/agent/HarnessAgent.java:448–451close
public void close()
关闭连接并释放相关资源。
Releases resources and connections.
io/agentscope/harness/agent/HarnessAgent.java:453–475getDelegate
public ReActAgent getDelegate()
获取委托。
Returns the wrapped ReActAgent.
ReActAgentio/agentscope/harness/agent/HarnessAgent.java:492–494getModel
public Model getModel()
获取模型。
Returns the model.
Modelio/agentscope/harness/agent/HarnessAgent.java:496–498getMaxIters
public int getMaxIters()
获取最大迭代次数。
Returns the max iters.
intio/agentscope/harness/agent/HarnessAgent.java:500–502getStateStore
public AgentStateStore getStateStore()
获取状态存储。
Returns the state store.
AgentStateStoreio/agentscope/harness/agent/HarnessAgent.java:504–506getDistributedStore
public DistributedStore getDistributedStore()
获取分布式存储。
The distributed store configured on this agent, or null for local deployments.
DistributedStoreio/agentscope/harness/agent/HarnessAgent.java:514–516getSubagentAgentManager
public io.agentscope.harness.agent.subagent.DefaultAgentManager getSubagentAgentManager()
获取子智能体智能体管理器。
The internal io.agentscope.harness.agent.subagent.DefaultAgentManager able to re-materialize this agent's subagents, or null when none is owned (e.g.
io.agentscope.harness.agent.subagent.DefaultAgentManagerio/agentscope/harness/agent/HarnessAgent.java:523–531getTaskRepository
public TaskRepository getTaskRepository()
获取任务仓库。
Background subagent TaskRepository owned by the subagent middleware, or null when subagents are not configured.
TaskRepositoryio/agentscope/harness/agent/HarnessAgent.java:537–545getDefaultSessionId
public String getDefaultSessionId()
获取默认会话标识。
Returns the default session id.
Stringio/agentscope/harness/agent/HarnessAgent.java:548–550getAgentState
public AgentState getAgentState()
获取智能体状态。
Returns the agent state.
AgentStateio/agentscope/harness/agent/HarnessAgent.java:556–560getName
public String getName()
获取名称。
Returns the name.
Stringio/agentscope/harness/agent/HarnessAgent.java:562–565getAgentId
public String getAgentId()
获取智能体标识。
Returns the agent id.
Stringio/agentscope/harness/agent/HarnessAgent.java:567–570getDescription
public String getDescription()
获取 getDescription。
Returns the description.
Stringio/agentscope/harness/agent/HarnessAgent.java:572–575interrupt
public void interrupt()
请求中断当前执行。
Returns the interrupt.
io/agentscope/harness/agent/HarnessAgent.java:577–580interrupt
public void interrupt(Msg msg)
请求中断当前执行。
Performs the interrupt operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msg | Msg | 消息(类型 `Msg`)。The msg. |
io/agentscope/harness/agent/HarnessAgent.java:582–585interrupt
public void interrupt(RuntimeContext ctx)
请求中断当前执行。
Interrupts the in-flight call for the session identified by ctx.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。runtime context identifying the session to interrupt |
io/agentscope/harness/agent/HarnessAgent.java:592–594interrupt
public void interrupt(RuntimeContext ctx, Msg msg)
请求中断当前执行。
Interrupts the in-flight call for the session identified by ctx with an associated user message.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。runtime context identifying the session to interrupt |
msg | Msg | 消息(类型 `Msg`)。optional user message to attach to the interrupt signal |
io/agentscope/harness/agent/HarnessAgent.java:603–605interrupt
public void interrupt(String userId, String sessionId)
请求中断当前执行。
Interrupts the in-flight call for a specific (userId, sessionId) session.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。user identity for the slot (`null` = anonymous / single-tenant) |
sessionId | String | 会话标识(类型 `String`)。session identity; `null` or blank uses the default session id |
io/agentscope/harness/agent/HarnessAgent.java:613–615interrupt
public void interrupt(String userId, String sessionId, Msg msg)
请求中断当前执行。
Interrupts the in-flight call for a specific (userId, sessionId) session with an associated user message.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
msg | Msg | 消息(类型 `Msg`)。The msg. |
io/agentscope/harness/agent/HarnessAgent.java:621–623channel
public T extends Channel T channel(T channel)
设置渠道。
Returns a channel bound to this agent's internal gateway.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channel | T | 渠道(类型 `T`)。the channel instance to bind (e.g. `ChatUiChannel.perPeer()`) |
Tio/agentscope/harness/agent/HarnessAgent.java:646–650gateway
public HarnessGateway gateway()
返回网关。
Returns the internal gateway backing #channel.
HarnessGatewayio/agentscope/harness/agent/HarnessAgent.java:656–659call
public Mono<Msg> call(List<Msg> msgs)
向智能体发送输入并返回最终回复。
Performs the call operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
Mono<Msg>io/agentscope/harness/agent/HarnessAgent.java:707–711call
public Mono<Msg> call(List<Msg> msgs, Class<?> structuredModel)
向智能体发送输入并返回最终回复。
Performs the call operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
structuredModel | Class<?> | 结构化模型(类型 `Class`)。The structured model. |
Mono<Msg>io/agentscope/harness/agent/HarnessAgent.java:716–721call
public Mono<Msg> call(List<Msg> msgs, JsonNode schema)
向智能体发送输入并返回最终回复。
Performs the call operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
schema | JsonNode | 模式定义(类型 `JsonNode`)。The schema. |
Mono<Msg>io/agentscope/harness/agent/HarnessAgent.java:726–730call
public Mono<Msg> call(Msg msg, RuntimeContext ctx)
向智能体发送输入并返回最终回复。
Performs the call operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msg | Msg | 消息(类型 `Msg`)。The msg. |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
Mono<Msg>io/agentscope/harness/agent/HarnessAgent.java:732–734call
public Mono<Msg> call(String text, RuntimeContext ctx)
向智能体发送输入并返回最终回复。
Calls the agent with a plain text input and per-call RuntimeContext.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
text | String | 文本(类型 `String`)。input text (wrapped into a `UserMessage`) |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。per-call runtime context |
Mono<Msg>io/agentscope/harness/agent/HarnessAgent.java:743–745call
public Mono<Msg> call(List<Msg> msgs, RuntimeContext ctx)
向智能体发送输入并返回最终回复。
Performs the call operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
Mono<Msg>io/agentscope/harness/agent/HarnessAgent.java:747–751call
public Mono<Msg> call(List<Msg> msgs, Class<?> structuredModel, RuntimeContext ctx)
向智能体发送输入并返回最终回复。
Performs the call operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
structuredModel | Class<?> | 结构化模型(类型 `Class`)。The structured model. |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
Mono<Msg>io/agentscope/harness/agent/HarnessAgent.java:753–757call
public Mono<Msg> call(List<Msg> msgs, JsonNode schema, RuntimeContext ctx)
向智能体发送输入并返回最终回复。
Performs the call operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
schema | JsonNode | 模式定义(类型 `JsonNode`)。The schema. |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
Mono<Msg>io/agentscope/harness/agent/HarnessAgent.java:759–763stream
public Flux<Event> stream(List<Msg> msgs, StreamOptions options)
执行流相关操作。
Performs the stream operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
options | StreamOptions | 选项(类型 `StreamOptions`)。The options. |
Flux<Event>io/agentscope/harness/agent/HarnessAgent.java:769–773stream
public Flux<Event> stream(List<Msg> msgs, StreamOptions options, Class<?> structuredModel)
执行流相关操作。
Performs the stream operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
options | StreamOptions | 选项(类型 `StreamOptions`)。The options. |
structuredModel | Class<?> | 结构化模型(类型 `Class`)。The structured model. |
Flux<Event>io/agentscope/harness/agent/HarnessAgent.java:779–784stream
public Flux<Event> stream(List<Msg> msgs, StreamOptions options, JsonNode schema)
执行流相关操作。
Performs the stream operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
options | StreamOptions | 选项(类型 `StreamOptions`)。The options. |
schema | JsonNode | 模式定义(类型 `JsonNode`)。The schema. |
Flux<Event>io/agentscope/harness/agent/HarnessAgent.java:790–794stream
public Flux<Event> stream(Msg msg, RuntimeContext ctx)
执行流相关操作。
Performs the stream operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msg | Msg | 消息(类型 `Msg`)。The msg. |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
Flux<Event>io/agentscope/harness/agent/HarnessAgent.java:799–802stream
public Flux<Event> stream(List<Msg> msgs, RuntimeContext ctx)
执行流相关操作。
Performs the stream operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
Flux<Event>io/agentscope/harness/agent/HarnessAgent.java:807–810stream
public Flux<Event> stream(List<Msg> msgs, StreamOptions options, RuntimeContext ctx)
执行流相关操作。
Performs the stream operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
options | StreamOptions | 选项(类型 `StreamOptions`)。The options. |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
Flux<Event>io/agentscope/harness/agent/HarnessAgent.java:815–820stream
public Flux<Event> stream(List<Msg> msgs, StreamOptions options, Class<?> structuredModel, RuntimeContext ctx)
执行流相关操作。
Performs the stream operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
options | StreamOptions | 选项(类型 `StreamOptions`)。The options. |
structuredModel | Class<?> | 结构化模型(类型 `Class`)。The structured model. |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
Flux<Event>io/agentscope/harness/agent/HarnessAgent.java:825–832stream
public Flux<Event> stream(List<Msg> msgs, StreamOptions options, JsonNode schema, RuntimeContext ctx)
执行流相关操作。
Performs the stream operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
options | StreamOptions | 选项(类型 `StreamOptions`)。The options. |
schema | JsonNode | 模式定义(类型 `JsonNode`)。The schema. |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
Flux<Event>io/agentscope/harness/agent/HarnessAgent.java:837–843prepareRun
public AgentRun<AgentEvent> prepareRun(List<Msg> msgs, RuntimeContext ctx)
执行 prepareRun 方法。
Prepare a cancellable execution covering the complete harness/sandbox lifecycle.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
AgentRun<AgentEvent>io/agentscope/harness/agent/HarnessAgent.java:846–848prepareCall
public AgentRun<Msg> prepareCall(List<Msg> msgs, RuntimeContext ctx)
执行 prepareCall 方法。
Prepare a cancellable reply execution covering the complete harness/sandbox lifecycle.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
io/agentscope/harness/agent/HarnessAgent.java:851–853streamEvents
public Flux<AgentEvent> streamEvents(Msg msg)
执行事件。
Streams the events.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msg | Msg | 消息(类型 `Msg`)。The msg. |
Flux<AgentEvent>io/agentscope/harness/agent/HarnessAgent.java:860–863streamEvents
public Flux<AgentEvent> streamEvents(List<Msg> msgs)
执行事件。
Streams the events.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
Flux<AgentEvent>io/agentscope/harness/agent/HarnessAgent.java:868–871streamEvents
public Flux<AgentEvent> streamEvents(Msg msg, RuntimeContext ctx)
执行事件。
Stream fine-grained AgentEvents for a single message with a caller-supplied RuntimeContext.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msg | Msg | 消息(类型 `Msg`)。input message |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。runtime context to propagate into the call |
Flux<AgentEvent>io/agentscope/harness/agent/HarnessAgent.java:881–883streamEvents
public Flux<AgentEvent> streamEvents(String text)
执行事件。
Streams the events.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
text | String | 文本(类型 `String`)。The text. |
Flux<AgentEvent>io/agentscope/harness/agent/HarnessAgent.java:888–891streamEvents
public Flux<AgentEvent> streamEvents(String text, RuntimeContext ctx)
执行事件。
Stream fine-grained AgentEvents for a plain text input with a caller-supplied RuntimeContext.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
text | String | 文本(类型 `String`)。input text (wrapped into a `UserMessage`) |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。runtime context to propagate into the call |
Flux<AgentEvent>io/agentscope/harness/agent/HarnessAgent.java:901–903streamEvents
public Flux<AgentEvent> streamEvents(List<Msg> msgs, RuntimeContext ctx)
执行事件。
Stream fine-grained AgentEvents for a list of messages with a caller-supplied RuntimeContext.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。input messages |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。runtime context to propagate into the call |
Flux<AgentEvent>io/agentscope/harness/agent/HarnessAgent.java:920–924observe
public Mono<Void> observe(Msg msg)
接收外部观察消息并写入上下文。
Performs the observe operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msg | Msg | 消息(类型 `Msg`)。The msg. |
Mono<Void>io/agentscope/harness/agent/HarnessAgent.java:926–929observe
public Mono<Void> observe(List<Msg> msgs)
接收外部观察消息并写入上下文。
Performs the observe operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
Mono<Void>io/agentscope/harness/agent/HarnessAgent.java:931–934getToolkit
public Toolkit getToolkit()
获取工具包。
Returns the toolkit.
Toolkitio/agentscope/harness/agent/HarnessAgent.java:936–938builder
public static Builder builder()
返回构建器实例。
Returns the builder.
Builderio/agentscope/harness/agent/HarnessAgent.java:1118–1120嵌套类详情Nested Class Detail
Builder
public static class BuilderHarnessAgent的构建器。位于 io.agentscope.harness.agent 包。核心成员包括 teamsMode、fromAgent、name、description、sysPrompt、checkRunning。
Builder for HarnessAgent. Owns the harness orchestration: workspace + filesystem +
sandbox + hooks/middlewares + tools + skills + subagents + tools.json + plan-mode.