Skip to content
Latest (currently 2026.7.0) has the newest features, bug fixes, and CVE patches of Solo Enterprise for agentregistry.

Restrict chat invocation

Page as Markdown

Extend your AccessPolicy to allow users to chat with a particular agent.

By default, chatting with an agent is not permitted, even if the AccessPolicy grants access to the registry runtime resource. To chat with an agent, you must add runtime:* rules to your AccessPolicy. For a conceptual overview of how AccessPolicy works across all access control layers, see About access control.

Before you begin

Follow one of the quickstart guides to install Solo Enterprise for agentregistry and deploy your first agent. The quickstart also sets up Keycloak as an OIDC provider and creates an admin user that you use to create AccessPolicies in this guide.

Step 1: Create a Keycloak group and user

Use the Keycloak Admin REST API to create a developers group and a user who belongs to it.

  1. Get an admin token for the Keycloak Admin REST API.

    export KEYCLOAK_ADMIN_TOKEN=$(curl -s \
      -d "client_id=admin-cli" -d "username=admin" -d "password=admin" \
      -d "grant_type=password" \
      "${KEYCLOAK_URL}/realms/master/protocol/openid-connect/token" \
      | jq -r .access_token)
  2. Create the developers group.

    curl -s -X POST \
      -H "Authorization: Bearer ${KEYCLOAK_ADMIN_TOKEN}" \
      -H "Content-Type: application/json" \
      "${KEYCLOAK_URL}/admin/realms/${KEYCLOAK_REALM}/groups" \
      -d '{"name": "developers"}'
  3. Create a dev-user account and assign it to the developers group.

    curl -s -X POST \
      -H "Authorization: Bearer ${KEYCLOAK_ADMIN_TOKEN}" \
      -H "Content-Type: application/json" \
      "${KEYCLOAK_URL}/admin/realms/${KEYCLOAK_REALM}/users" \
      -d '{
        "username": "dev-user",
        "email": "dev-user@example.com",
        "firstName": "Dev",
        "lastName": "User",
        "enabled": true,
        "credentials": [{"type": "password", "value": "password", "temporary": false}]
      }'
    
    export DEV_USER_ID=$(curl -s \
      -H "Authorization: Bearer ${KEYCLOAK_ADMIN_TOKEN}" \
      "${KEYCLOAK_URL}/admin/realms/${KEYCLOAK_REALM}/users?username=dev-user" \
      | jq -r '.[0].id')
    
    export DEVELOPERS_GROUP_ID=$(curl -s \
      -H "Authorization: Bearer ${KEYCLOAK_ADMIN_TOKEN}" \
      "${KEYCLOAK_URL}/admin/realms/${KEYCLOAK_REALM}/groups?search=developers" \
      | jq -r '.[0].id')
    
    curl -s -X PUT \
      -H "Authorization: Bearer ${KEYCLOAK_ADMIN_TOKEN}" \
      "${KEYCLOAK_URL}/admin/realms/${KEYCLOAK_REALM}/users/${DEV_USER_ID}/groups/${DEVELOPERS_GROUP_ID}"

Step 2: Chat with the agent

  1. Log in to Solo Enterprise for agentregistry as the dev-user user (dev-user/password).

    export OIDC_ISSUER=$KEYCLOAK_ISSUER
    export OIDC_CLIENT_ID=ar-cli
    arctl user login
  2. Inspect the JWT that is returned by Keycloak to confirm that the developers group claim is in the token.

    arctl user info --show-tokens \
      | jq -r '.access_token | split(".") | .[1] | @base64d | fromjson | {sub, email, Groups}'

    Example output:

    {
      "sub": "fbb5e028-4ef7-41de-8a6b-88365c26287d",
      "email": "dev-user@example.com",
      "Groups": [
        "developers"
      ]
    }
    
  3. Verify the user’s identity. In your CLI output, verify that the developers role has a status of configured. This setting means that the registry controller found a corresponding AccessPolicy for users with the developers claim value.

    arctl user whoami

    Example output:

    FIELD       VALUE
    Subject     fbb5e028-...
    Email       dev-user@example.com
    Issuer      http://172.18.0.15:8080/realms/agentregistry
    Superuser   false
    
    ROLE         STATUS
    developers   configured
    
  4. Open the Solo Enterprise for agentregistry UI and navigate to the myagent agent. In the Agent Details card, click Open Chat.

  5. Try chatting with the agent. For example, you can ask it what it can do for you. Then, hit Enter and wait for the agent to reply. Verify that access to the agent chat is forbidden.

Step 3: Enable invocation access

As the admin, create an AccessPolicy resource that allows chat invocation for the myagent agent in the Solo Enterprise for agentregistry UI when the user belongs to the developers user group.

  1. Log out and log back into the registry with the admin user (admin-user/password).

    arctl user logout
    arctl user login
  2. Create the AccessPolicy. The following example allows users that belong to the developers group to interact with agents and MCP servers via the Solo Enterprise for agentregistry UI. However, chat invocation is limited to the myagent agent.

    cat <<EOF | arctl apply -f -
    apiVersion: ar.dev/v1alpha1
    kind: AccessPolicy
    metadata:
      name: developers
    spec:
      description: "Invocation acccess for myagent agent"
      principals:
        - kind: Role
          name: developers
      rules:
        - actions:
            - "runtime:*"
          resources:
            - kind: agent
              name: myagent
        - actions:
            - "registry:*"
          resources:
            - kind: server
              name: "*"
            - kind: agent
              name: "*"
            - kind: runtime
              name: "*"
    EOF

    Example output:

    ✓ AccessPolicy/developers created
    
  3. Verify the policy was created.

    arctl get accesspolicies

    Example output:

    NAME         DESCRIPTION
    developers   Invocation acccess for myagent agent
    

Step 4: Verify invocation access

  1. Open the Solo Enterprise for agentregistry UI, logout, and log back in as the dev user with the dev-user username and password password.

  2. Navigate to the myagent agent. In the Agent Details card, click Open Chat.

  3. Chat with the agent. For example, you can ask it what it can do for you. Verify that this time, chatting with the agent is allowed and that you get a response back from your agent.