Implement robust RBAC for your AI agents using this specialized n8n workflow. Manage user permissions (tools and roles) via Airtable and restrict access over Telegram.
Download this n8n workflow template and start using it instantly.
Organizations deploying internal or external AI assistants that require differentiated access levels.
Developers looking for advanced LangChain integration, particularly tool filtering, within an n8n workflow.
System administrators who need a scalable way to manage user permissions for LLM tools using an n8n node structure.
Users seeking specialized n8n templates for secure, nested AI agent architecture.
This specialized n8n workflow provides a production-ready blueprint for implementing strong security boundaries around your AI agents. The primary challenge this n8n workflow solves is preventing unauthorized use of powerful tools (like database write access, file operations, or API calls) when an AI agent is exposed to multiple users via a platform like Telegram.
Instead of relying solely on the Large Language Model (LLM) to determine tool use, this n8n automation uses Airtable as a central access control list. When a user interacts with the system via the n8n trigger, the workflow retrieves their allowed tools. A crucial custom Code n8n node then dynamically wraps or disables unauthorized tools, ensuring the agent only interacts with approved functions. This approach significantly enhances the security and reliability of your AI services built with n8n templates.
The entire process relies on two connected sub-workflows—the main agent handler and the nested weather agent—both leveraging the same RBAC checking mechanism.
Telegram Trigger n8n node initiates the n8n workflow upon receiving a direct message.Get user permissions Airtable n8n node searches for the user's profile based on their Telegram username, retrieving fields like grantedroles and allowedtools.Unknown user If n8n node checks the results. If the user is not found, the workflow stops and the Reply: unknown user Telegram n8n node sends an unauthorized message.Set input n8n node maps the user and permission data into variables for the primary agent.Main Agent (an Agent n8n node) is configured with memory (Simple Memory) and an LLM (OpenAI Chat Model). The user's query is passed to it.Check permissions Code n8n node executes. This custom n8n node compares the available connected tools against the user's allowedtools array. If a tool is not permitted (e.g., calculator is denied), the script replaces that tool's functionality with a function that explicitly returns an 'unauthorized' message to the LLM.weatheragent Tool Workflow n8n node, passing the required inputs and the user's allowedtools list.When Executed by Another Workflow n8n trigger. The Weather Agent also runs its own permission check (Check permissions1) to ensure the user's permissions are respected for the sub-agent's specific tools (getcoordinates, get_weather).Main Agent is sent back to the user via the Reply with results Telegram n8n node.To deploy this comprehensive n8n workflow, follow these steps:
Get user permissions n8n node.Telegram Trigger and Telegram nodes (Requires a Telegram Bot API key).OpenAI Chat Model nodes (Requires an OpenAI API key).Get user permissions Airtable n8n node, select your copied base and table ('Users') and ensure the filter formula correctly uses the Telegram username: ={username} = '{{ $json.message.from.username }}'.weather_agent Tool Workflow n8n node, ensure that the selected workflow ID points to the current n8n workflow itself, allowing for the nested execution pattern. This is crucial for the recursive RBAC to function correctly.This n8n workflow utilizes advanced features from the LangChain integration and core n8n nodes:
Telegram Trigger (n8n trigger): Listens for incoming messages sent directly to the configured bot. Key configuration: updates: [message].
Airtable (n8n node): Get user permissions. Searches the 'Users' table based on the Telegram username to retrieve allowedtools and grantedroles. Uses search operation with a formula filter.
If (n8n node): Unknown user. A flow control node that checks if the Airtable query returned any data, effectively acting as an authentication gate.
Set (n8n node): Set input. Formats the user data, specifically extracting the allowedtools array, which is essential for the RBAC enforcement steps later in the n8n workflow.
Agent (n8n node): Main Agent. The primary LLM orchestrator. It uses GPT-4o and includes a customized system message based on dynamic user data.
Code (n8n node): Check permissions. This critical custom n8n node implements the RBAC logic. It iterates through all available tools and dynamically replaces unpermitted tools with a placeholder function that returns an 'unauthorized' message. This ensures the agent is confined strictly by the user's permissions defined in Airtable.
Tool Workflow (n8n node): weatheragent. Demonstrates nesting, calling the current n8n workflow as a sub-agent, and passing the required allowedtools list down for continued permission enforcement within the nested context.
Tool Code (n8n node): listallowedtools and listgranted_roles. Custom tools allowing the agent to inform the user of their own permissions, demonstrating self-awareness built into this n8n workflow.
Create a powerful, comprehensive n8n workflow that exposes 71 Marketcheck vehicle data API operations as manageable tools for your AI agent. Leverage this n8n template for deep automotive data automation.

Deploy this specialized n8n workflow to connect AI agents to the CarbonDoomsDay API. This n8n template uses the MCP trigger and tool nodes to fetch real-time CO2 measurement data programmatically.

Use this advanced n8n workflow template to search PubMed, ArXiv, Google Scholar, and more. It deduplicates, ranks results, and exports your findings into BibTeX, CSV, and JSON formats using the PDF Vector n8n node.

Learn how this extensive n8n workflow connects over 100 Rat Genome Database API operations via a powerful n8n trigger (MCP Server). Access complex biological data using specialized n8n templates for AI agents.

Build a powerful n8n workflow using LangChain and OpenAI to fetch real-time Binance spot market data via Telegram. Get instant, formatted crypto reports using this advanced n8n template.

Workflow Optimization Expert | Software Architect. Use my link to book an initial consultation for custom built workflows using n8n.







































