{
  "id": 9553964,
  "title": "How I Built an AI Assistant for My SaaS CRM with Scoped Agents",
  "url": "https://urgent.news/2026/09/24/how-i-built-an-ai-assistant-for-my-saas-crm-with-scoped-agents",
  "topic": "ai",
  "section": "AI",
  "published": "2026-09-24T12:27:18.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/jestscaledev/how-i-built-an-ai-assistant-for-my-saas-crm-with-scoped-agents-46i9"
  },
  "original_language": "en",
  "account": "When the author began integrating AI into their SaaS CRM, they initially thought creating an AI assistant would be a straightforward task. They envisioned the AI having access to the CRM data and allowing users to interact with it naturally. However, as they continued working on the project, they discovered that building a single AI assistant was not the optimal solution. Different users within the CRM, organizations, roles, private data, public documentation, and actions that could modify data required specific contexts for an effective AI assistant.\n\nInstead of developing a single AI assistant, the author created a system built around scoped agents, which allowed each agent to have only the necessary context, knowledge, and tools required for the task at hand. This modular approach addressed the authorization challenges and complexities associated with a single AI agent that had access to all data.\n\nThe main challenge with a single AI agent was determining what a user was asking for and what they were authorized to access. By breaking down the system into scoped agents, the author could define agents for different contexts - personal, organization, and CRM assistants. Each agent handled a specific aspect of the CRM, ensuring that users received appropriate responses based on their context and role.\n\nThe three agent contexts developed for uniThread are:\n1. Personal Assistant - this agent operates around an individual user's context, handling personal tasks, notes, user-specific information, and workflows.\n2. Organization Assistant - this agent works within an organization's context, considering the user's organization membership and role. It can access organization-level CRM capabilities while adhering to the application's authorization rules.\n3. CRM Assistant - this public-facing assistant answers questions about the platform itself using indexed knowledge and retrieval techniques, ensuring that it does not access customer data during the process.\n\nTo manage the context for each agent, the author created an AgentContext structure, including fields like profileId, orgId, memberId, role, accessToken, and isPublic. This structured approach allows the application to clearly communicate the required context for each agent request, ensuring that the AI system operates within the appropriate boundaries and maintains proper authorization.\n\nThe overall architecture of the AI system separates various components, such as Controller, AIAgentService, Orchestrator, Model Router, Agent/Model Adapter, Tools, Authorization, and Execution. Each layer in this hierarchy has a distinct responsibility in the AI request processing pipeline, promoting modularity, scalability, and maintainability.\n\nBy separating AI from authorization and utilizing scoped agents, the author created a robust and efficient system that could accurately handle various user contexts and maintain strict data access controls. This architecture has proven to be valuable as the AI functionality within uniThread continues to grow and evolve.",
  "summary": "How I Built an AI Assistant for My SaaS CRM with Scoped Agents When I first started adding AI to my SaaS CRM, the obvious idea was simple: Give the AI access to the CRM data and let users talk to it naturally. But the more I worked on it, the more I realized that \"an AI assistant for my CRM\" isn't really one problem. A CRM has different users, organizations, roles, private data, public…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}