Repository navigation
docs: clarify component vs access roles and add custom node roles recipe - #985
roonakyadav wants to merge 2 commits into
Conversation
- Distinguish component roles (mesh:role:node, mesh:role:router) from custom access roles (caller, developer, analyst). - Clarify that bootstrap tokens only enroll component identities and cannot enroll arbitrary access roles. - Add practical step-by-step guide under guides/custom-node-roles.md demonstrating token creation, enrollment, PeerID lookup, policy binding via node:<peer-id>, and call verification. - Document policy propagation timing within the sync jitter window (0-90s by default). - Clarify that effective permissions come from policy evaluation rather than the roles printed in a node's Biscuit credential. - Update policy, headless enrollment, control-plane, agentmesh-one, and agentmesh-node references. Closes google#957
There was a problem hiding this comment.
Code Review
This pull request introduces a new guide on granting custom access roles to a node and updates existing documentation to clarify the distinction between component roles and access roles. The review feedback points out two important improvements for the new guide: first, adding a step to pre-create the API token file to prevent startup failures, and second, adding a warning to ensure users merge policy changes rather than overwriting their entire mesh policy.
| Once joined, start the node: | ||
|
|
||
| ```bash | ||
| agentmesh-node run \ | ||
| --control-plane https://mesh.example.com \ | ||
| --data-dir ./n1 \ | ||
| --bind-addr 127.0.0.1:8080 \ | ||
| --api-token-path ./n1/api-token | ||
| ``` |
There was a problem hiding this comment.
Since agentmesh-node run is executed in the foreground (without --daemonize), it expects the file specified by --api-token-path to already exist and contain a valid token. If ./n1/api-token does not exist, the command will fail to start.\n\nPlease add a step to generate or create this token file before running the node, for example:\nbash\necho "some-secure-token" > ./n1/api-token\n\nor use openssl rand -hex 16 > ./n1/api-token.
There was a problem hiding this comment.
Fixed in commit 0759ad4: Added an explicit step to generate ./n1/api-token before running agentmesh-node run in the foreground.
| Add your custom access role under `roles` and bind it to the node's PeerID | ||
| under `bindings`. For example, to grant a role named `caller` that allows | ||
| invoking `mcp://calculator` and any inference model: | ||
|
|
||
| ```json |
There was a problem hiding this comment.
Since POST /policies replaces the entire mesh policy rather than patching it, posting this example JSON directly will overwrite and remove any other existing roles (such as mesh:role:router) and bindings, which can break router enrollment and other mesh functions.\n\nPlease add a warning note advising the user to merge these new roles and bindings into their existing policy.json fetched in the previous step, rather than replacing the file entirely with this example.
There was a problem hiding this comment.
Fixed in commit 0759ad4: Added a warning note explaining that POST /policies replaces the full document and provided a jq example showing how to merge new roles and bindings into the existing policy.json.
- Pre-create ./n1/api-token before running agentmesh-node in foreground. - Add warning note that POST /policies replaces the whole policy and provide jq merge example to prevent dropping existing roles.
| | Command | Flags | Effect | | ||
| |---|---|---| | ||
| | `token create` | `--role` (`mesh:role:node`), `--ttl-hours` (24), `--max-usages` (1), `--description`, `--autonomous-recovery` | Mint a token. Prints it once on stdout. | | ||
| | `token create` | `--role` (`mesh:role:node`), `--ttl-hours` (24), `--max-usages` (1), `--description`, `--autonomous-recovery` | Mint a component enrollment token (`mesh:role:node` or `mesh:role:router`). Prints it once on stdout. | |
There was a problem hiding this comment.
we need to add validation on the flags to ensure the value of role is allowed , see my original comment
|
|
||
| ## Roles | ||
|
|
||
| Agent Mesh distinguishes between **component roles** and **access roles**: |
Closes #957
Problem
In Agent Mesh, the word "role" is used across two distinct architectural layers:
mesh:role:node,mesh:role:router), which describe infrastructure binary identities fixed at enrollment.caller,developer,analyst), which describe what services a member may call or publish.Because both concepts are named "role", users attempting to create a node bootstrap token with an access role (e.g.
agentmesh-one token create --role caller) hit unexpected failures during enrollment:agentmesh-nodealways requestsmesh:role:node(RequiredRole: api.RoleNode), and the control plane requires the requested role to match the bootstrap token's role. Furthermore, users who correctly switch to policy bindings are often confused when inspecting the enrolled node's Biscuit credential (/mesh/identityorX-Mesh-Roles), which still displays onlymesh:role:nodebecause custom roles are evaluated dynamically via distributed Datalog rules rather than baked into the Biscuit.Documentation Changes
This PR implements the immediate documentation improvements outlined by @aojea in #957:
mesh:role:node,mesh:role:router) and custom access roles (caller,developer,analyst) in the policy reference, concepts, and guides.mesh:role:nodeormesh:role:router), not arbitrary access roles.guides/custom-node-roles.md) explaining how to:mesh:role:node.agentmesh-node.12D3KooW...) from startup logs, debug CLI (agentmesh-node debug mesh-info), or the local API (GET /debug/mesh-info).{"role": "caller", "members": ["node:<peer-id>"]}to policy bindings and posting toPOST /policies.call_remote_tooland the HTTP proxy path.policy.md,headless-enrollment.md,control-plane.md,agentmesh-one.md, andagentmesh-node.mdto reference the component role requirements and cross-link to the new guide.Files Changed
site/content/docs/guides/custom-node-roles.md(new step-by-step recipe)site/content/docs/guides/_index.md(guides directory index)site/content/docs/guides/headless-enrollment.md(bootstrap token minting role clarification)site/content/docs/reference/policy.md(roles & bindings reference, evaluation, sync jitter window)site/content/docs/reference/control-plane.md(bootstrap tokens endpoint description)site/content/docs/reference/agentmesh-one.md(token create command description)site/content/docs/reference/agentmesh-node.md(bootstrap-token-path flag description)site/content/docs/concepts/identity.md(bootstrap token role and policy binding clarification)Scope & Runtime Behavior
Validation Performed
agentmesh-one token create,agentmesh-node join,agentmesh-node run,/debug/mesh-info,/mesh/identity,POST /policies,/mcp,/mesh/...) against the codebase.git diff --check).go test ./... -run TestSyncMeshPolicyUsesDatalogRules).