Repository navigation
Workspaces phase 2b: the agent runtime keeps to the workspace (#277) - #317
Merged
Merged
Conversation
The RBAC check (RBACMiddleware.check_agent_access, used by the ADK callback, the LangGraph hook and MCP) takes the agent's workspace from its project and asks workspaces.caller_access whether the caller may use it: a platform administrator, or an owner or admin of the workspace, passes allowed_for_roles; a member is matched on agent_roles; a widget visitor only reaches their key's workspace, and trigger_runner any. Anyone else gets "This agent is not available". A user the check creates joins the agent's workspace rather than the default one, so an end user an API client runs through /run_sse, an A2A or a Slack user lands where the agent is. The member sync leaves such users out of the default workspace, and until phase 3 every membership's agent_roles follow users.roles. Entry points: - the proxy refuses a non-admin an agent of a workspace they can't use, and /list-apps answers with the request's workspace's agents (plain and detailed); - a personal access token works in its own workspace: /v1/models, chat completions (404 for another workspace's agent) and MCP. A token whose owner left its workspace is refused; - the Work Room lists the current workspace's root agents the caller may use. With one workspace the clients' calls answer as before; test_client_contract.py is unchanged. Administrators now pass every agent's allowed_for_roles, as the plan decided, and the guides say so.
This was referenced Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second of the five PRs of phase 2 (
documents/design/2.0-plan.md). It follows #316.What changes
RBACMiddleware.check_agent_access(the ADK callback, the LangGraph hook, MCP) takes the agent's workspace from its project and asksworkspaces.caller_accesswhether the caller may use it:allowed_for_roles;agent_roles;widget_<key id>_…) may in their key's workspace only, andtrigger_runnerin any, both onusers.roles;get_or_create_user(user_id, workspace_id)), so an end user an API client runs through/run_sse, an A2A or a Slack user becomes a member where the agent is:sync_default_membersand the listeners leave a user who is a member of another workspace only out of Default;agent_rolesfollowusers.roles._workspace_refusal), before the agent server is reached./list-appsanswers with the request's workspace's agents, plain and?detailed=true. An app with no config is listed to platform admins in the default workspace./v1/modelslists that workspace's agents, and a completion for another workspace's agent is a 404.GET /mcpand the agent MCP routes keep to it too.get_pat_userrecords the workspace, and routes take it from thepat_workspacedependency.Behaviour on a 1.x installation
test_client_contract.pyis unchanged./run_sseas an end user: the new user joins Default, as before.allowed_for_roles. Before,["user"]refused someone who had onlyadmin. This widens access, and only for admins.docs/user/agents.mdanddocs/user/users-and-roles.mdare updated;Checked
test_cross_workspace.pygains RBAC, OpenAI API, MCP, proxy and Work Room cases over two workspaces._workspace_refusal: 1 fails;/v1/modelsunfiltered: 1 fails./list-appsthrough the proxy lists the same 49 apps as the agent server, plain and detailed;/v1/modelsanswers;/run_ssewith Basic auth as a new end user runs the agent, which answers "ok", and the user becomes a member of Default. The probe user was removed afterwards.Docs
docs/dev/auth-and-access.md: proxy, agent check, tokens.docs/dev/database-and-migrations.md: home workspace, sync.docs/dev/openai-api-and-mcp.mdanddocs/dev/mcp-servers.md: the token's workspace.docs/user/work-room.md,docs/user/personal-access-tokens.md,docs/user/agents.md,docs/user/users-and-roles.md.