datarobot_genai.dragent.frontends.session
session
DRAgentUserManager
Bases: UserManager
Add DataRobot signed auth-context resolution to NAT's standard identity extractors.
NAT 1.6 replaced the extensible context-based user_id resolution with
UserManager.extract_user_from_connection() (#1775), which only supports
standard auth (Bearer JWT, cookies, API key). DataRobot passes user identity
via X-DataRobot-Authorization-Context (signed app-context JWT), which the
vanilla extractor does not understand. This subclass handles that header
first, then delegates to super().extract_user_from_connection() so
standard auth still works.
Source code in datarobot_genai/dragent/frontends/session.py
DRAgentAGUISessionManager
Bases: SessionManager
Source code in datarobot_genai/dragent/frontends/session.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
session
async
session(user_id: str | None = None, http_connection: HTTPConnection | None = None, user_message_id: str | None = None, conversation_id: str | None = None, user_input_callback: Callable[[InteractionPrompt], Awaitable[HumanResponse]] | None = None, user_authentication_callback: Callable[[AuthProviderBaseConfig, AuthFlowType], Awaitable[AuthenticatedContext | None]] | None = None) -> AsyncIterator[Session]
Bridge A2A preset, resolve DR headers, default for per-user, and inject A2A headers.
NAT 1.6+ assigns self._context_state.user_id from the explicit user_id
argument only. The A2A adapter calls session() with no arguments; our
executor sets context_id on the context var first, but the parent
session() would overwrite it with None. Copy any preset non-empty
value into user_id before delegating so per-user workflows work without
a Bearer JWT (local dev / message-only A2A).
Additionally, A2A HTTP request headers stored in the module-level
_a2a_headers ContextVar by :class:_PerUserCompatibleAgentExecutor are
injected into ContextState._metadata.
Source code in datarobot_genai/dragent/frontends/session.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |