How to Configure CrewAI SQL Server Approval
You set up crewai sql server approval by pairing human review steps with strict database roles. This dual setup stops autonomous agents from running bad queries on live data. Many teams start by giving agents a single shared login with broad rights. That fast path creates huge risks when an agent makes up a bad command. A single wrong query can wipe out tables or leak private rows. How crewai sql server approval works with native roles A safe setup starts inside the database before any agent
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You set up crewai sql server approval by pairing human review steps with strict database roles. This dual setup stops autonomous agents from running bad queries on live data. Many teams start by giving agents a single shared login with broad rights. That fast path creates huge risks when an agent makes up a bad command. A single wrong query can wipe out tables or leak private rows.
How crewai sql server approval works with native roles
A safe setup starts inside the database before any agent runs a task. In SQL Server, a database user is the identity of a login. When an agent needs many databases, teams make a SQL user with a master login. For one database, a contained user with its own password is an option. An admin must enable contained databases on the server and database first. SQL Server supports thirteen types of database users for different needs.
Once the user exists, you assign a fixed role to limit its actions. The fixed reader role lets the agent read all data from all user tables. It also reads all views in that database. The fixed writer role lets a user add, delete, or change table data. You can also assign deny roles to block reading or writing data. You cannot change the permissions built into these fixed database roles. Every role, including the public role, holds basic connection rights by default. Avoid the owner role, since it can change settings and drop the whole database.
On the agent side, you add a human review step to the workflow. When the agent drafts a query, it pauses and waits for a person. The reviewer reads the text and decides whether to let it run.
Why native roles and agent prompts fall short
Native roles and framework prompts solve only half of the safety problem. Database roles decide who can log in and which broad actions they can take. They do not inspect individual queries while they travel to the server. If an agent needs write rights for one table, the fixed writer role is too broad. It opens up every user table in the database to changes and deletes.
Framework prompts also have big blind spots in daily work. A prompt check happens inside the app code before the network call. If a builder turns off the prompt flag in code, the check vanishes. Also, an agent with the fixed reader role can still pull every column by default. It can read emails, phone numbers, card numbers, and national IDs from any table. The database does not rewrite those matched fields in results by default.
Approval Chains & Escalation + Kubernetes API Server Access: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What to check before approving agent queries
Reviewers need clear rules when they inspect queries from an agent crew. First, check which tables the query touches and why the agent needs them. Make sure the query asks for specific columns instead of pulling whole tables. Watch out for joins that link sensitive user tables to public logs.
Second, check the size of the result set before you let it run. An agent can freeze a server by asking for millions of rows at once. Every query should have a clear row limit to keep the server fast. Third, check any write statement to ensure it has a strict filter clause. A write or delete command without a filter will hit every row in the table. When you move checks out of app code, you enforce these rules every time.
Add runtime guardrails beside SQL Server
Role grants and network rules are needed setup for SQL Server. Still, an allowed user or agent tool can send a bad delete or read raw customer fields over a valid session. In practice, hoop.dev runs beside the database as a sidecar for your SQL Server and checks TDS traffic without changing how clients log in.
With hoop.dev SQL Server controls, rules refuse banned statements before they run and can hold risky queries for human review. Matched sensitive values in supported result columns are masked before they reach the client. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for HIPAA, PCI DSS, SOX, and GDPR audits. See the source on GitHub.
Frequently asked questions
Can I change the rights of fixed roles in SQL Server?
No, you cannot change the permissions assigned to fixed database roles in SQL Server. If you need custom table rules, you must build a custom role instead.
What is the difference between a standard login and a contained user?
A standard SQL user links to a login stored in the master database. A contained user lives inside one database and uses its own password without a master login.
Does the fixed reader role hide sensitive columns from CrewAI?
No, the fixed reader role lets the user read all data from all user tables. To protect emails or card numbers, you need a layer that rewrites matched fields in results.
Related guides
In this post