Class TeamsMiddleware
java.lang.Object
io.agentscope.harness.agent.middleware.TeamsMiddleware
- All Implemented Interfaces:
io.agentscope.core.middleware.MiddlewareBase,HarnessRuntimeMiddleware
Injects AgentTeams context into the system prompt and exposes a role-clipped
TeamTool.
Optional wireMessageBus(MessageBus, String) pushes mailbox wakeups into the session
inbox path used by InboxMiddleware.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbindSession(String sessionId) Registers this middleware under a runtime session id for TeamEvent delivery.getTools()Tools to register on the agent toolkit at build time.booleanReports whether the shared board still has non-terminal tasks, so blocking waits know that teammates are still working even when this session owns no background subagent tasks.voidnotifyWakeup(String sessionId) Notifies this teammate session that a team event arrived (message / task settled).voidnotifyWakeup(String sessionId, String notice) Notifies this teammate session, injectingnoticeso the woken turn starts with the event content instead of an empty prompt.reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>onAgent(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, io.agentscope.core.middleware.AgentInput input, Function<io.agentscope.core.middleware.AgentInput, reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>> next) Gives the lead the board as it stands when its turn starts, and settles a worker's tasks when its turn ends.reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>onReasoning(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, io.agentscope.core.middleware.ReasoningInput input, Function<io.agentscope.core.middleware.ReasoningInput, reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>> next) static voidregisterSession(String sessionId, TeamsMiddleware middleware) RegisterssessionIdagainst an already-built middleware instance.static StringRenders the system-prompt team section (also used by BYOteam_joinkickoff).static voidunregisterSession(String sessionId) Drops every registry entry for a session that is gone for good, so a later team reusing the same team and member names cannot wake this dead session.static booleanwakeupSession(String sessionId) Wakes the teammate bound tosessionId.static booleanwakeupSession(String sessionId, String notice) Wakes the teammate bound tosessionId, injectingnoticeinto its next turn.static booleanwakeupTeamMember(String teamName, String memberName) Wakes a teammate identified by team + member name.static booleanwakeupTeamMember(String teamName, String memberName, String notice) Wakes a teammate by team + member name, injectingnoticeinto its next turn.voidwireMessageBus(MessageBus messageBus, String agentId) Wires mailbox wakeups.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, onModelCall, onSystemPrompt, order
-
Constructor Details
-
TeamsMiddleware
-
-
Method Details
-
bindSession
Registers this middleware under a runtime session id for TeamEvent delivery. -
registerSession
RegisterssessionIdagainst an already-built middleware instance. -
unregisterSession
Drops every registry entry for a session that is gone for good, so a later team reusing the same team and member names cannot wake this dead session. Call it only when the session was deleted, not when it merely went idle.The member entry is removed only while it still points at this instance: a member that was rebuilt under a new session has already replaced it.
-
wakeupSession
Wakes the teammate bound tosessionId. Returns false when unknown. -
wakeupSession
Wakes the teammate bound tosessionId, injectingnoticeinto its next turn. -
wakeupTeamMember
Wakes a teammate identified by team + member name. Returns false when unknown. -
wakeupTeamMember
Wakes a teammate by team + member name, injectingnoticeinto its next turn. -
getTools
Tools to register on the agent toolkit at build time. -
teamContext
-
teamClient
-
wireMessageBus
Wires mailbox wakeups.agentIdis passed toMessageBus.enqueueWakeup(java.lang.String, java.lang.String, java.lang.String)so the gateway can route idle rounds. -
notifyWakeup
Notifies this teammate session that a team event arrived (message / task settled). -
notifyWakeup
Notifies this teammate session, injectingnoticeso the woken turn starts with the event content instead of an empty prompt. Safe to call from adapters or team client hooks.When no session is bound yet the notice is buffered and injected on the next reasoning step, so events that race session binding are not lost.
-
onAgent
public reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent> onAgent(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, io.agentscope.core.middleware.AgentInput input, Function<io.agentscope.core.middleware.AgentInput, reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>> next) Gives the lead the board as it stands when its turn starts, and settles a worker's tasks when its turn ends. The lead's tasks are left alone: it answers to a user who can pick the conversation back up, so its turn ending is not the end of its execution.- Specified by:
onAgentin interfaceio.agentscope.core.middleware.MiddlewareBase
-
onReasoning
public reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent> onReasoning(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, io.agentscope.core.middleware.ReasoningInput input, Function<io.agentscope.core.middleware.ReasoningInput, reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>> next) - Specified by:
onReasoningin interfaceio.agentscope.core.middleware.MiddlewareBase
-
hasOutstandingTeamWork
public boolean hasOutstandingTeamWork()Reports whether the shared board still has non-terminal tasks, so blocking waits know that teammates are still working even when this session owns no background subagent tasks. -
renderTeamSection
Renders the system-prompt team section (also used by BYOteam_joinkickoff).
-