You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Per the Context & AgentState docs, (userId, sessionId) should be passed via RuntimeContext on each call. The Quickstart also shows userId / sessionId being set in the HTTP handler.
However, the AG-UI integration path seems different from the HarnessGateway / builder example (ChatController → MsgContext.userId → RuntimeContext).
What we observed
RC4 (AguiAgentAdapter): calls agent.stream(msgs, options) without RuntimeContext, so threadId is not mapped to sessionId.
Without userId, ReActAgent falls back to __anon__/{sessionId} slot keys, which breaks multi-user isolation when multiple logged-in users share the same AG-UI threadId namespace.
We understand userId should come from the integration layer (server auth), not from the frontend forwardedProps (untrusted).
Questions
Is there an official recommended pattern for passing server-side authenticated userId into RuntimeContext when using the AG-UI Spring Boot starter with HarnessAgent?
Should we wait for / contribute to the hook mechanism proposed in Feature Request: Support Custom Agent Hooks via forwardedProps #901 (AguiRequestHook + forwardedProps), or is there a better extension point (e.g. custom AguiRequestProcessor, RuntimeContextCustomizer)?
For production multi-tenant chat, do you recommend staying on AG-UI + starter, or switching to the builder-style HarnessGateway path (custom SSE, not AG-UI)?
Wrapping the registered Agent to inject SecurityContext → RuntimeContext.userId before delegating to HarnessAgent.stream(..., ctx). This works but feels like integration-layer logic placed at the wrong abstraction level.
Any guidance or planned API for this scenario would be appreciated. Happy to contribute a PR if there is a preferred design.
Environment: agentscope-java 2.0.0-RC4, Spring Boot 3.4, Java 17
Context
We are building a multi-user platform with:
HarnessAgent(singleton, stateless engine withAgentStateStore)agentscope-agui-spring-boot-starter(AguiRestController/AguiAgentAdapter)Per the Context & AgentState docs,
(userId, sessionId)should be passed viaRuntimeContexton each call. The Quickstart also showsuserId/sessionIdbeing set in the HTTP handler.However, the AG-UI integration path seems different from the
HarnessGateway/ builder example (ChatController→MsgContext.userId→RuntimeContext).What we observed
AguiAgentAdapter): callsagent.stream(msgs, options)withoutRuntimeContext, sothreadIdis not mapped tosessionId.buildRuntimeContext()setssessionId = threadIdand putsRunAgentInputinto context — but still nouserId.userId,ReActAgentfalls back to__anon__/{sessionId}slot keys, which breaks multi-user isolation when multiple logged-in users share the same AG-UIthreadIdnamespace.We understand
userIdshould come from the integration layer (server auth), not from the frontendforwardedProps(untrusted).Questions
userIdintoRuntimeContextwhen using the AG-UI Spring Boot starter with HarnessAgent?AguiRequestHook+forwardedProps), or is there a better extension point (e.g. customAguiRequestProcessor,RuntimeContextCustomizer)?HarnessGatewaypath (custom SSE, not AG-UI)?Related issues / PRs
forwardedProps(open)sessionId←threadId)Our current workaround
Wrapping the registered
Agentto injectSecurityContext→RuntimeContext.userIdbefore delegating toHarnessAgent.stream(..., ctx). This works but feels like integration-layer logic placed at the wrong abstraction level.Any guidance or planned API for this scenario would be appreciated. Happy to contribute a PR if there is a preferred design.
Environment:
agentscope-java2.0.0-RC4, Spring Boot 3.4, Java 17