Skip to main content
Deploy the integrations/bigeye FastAPI wrapper on any public HTTPS host, such as a TrueFoundry Service or a Docker container. The AI Gateway calls it on the MCP Tool Pre-Invoke hook through the Custom Guardrail contract. The wrapper asks Bigeye whether the tool call may touch the data it names and returns a verdict JSON body on HTTP 200.
Source repository: truefoundry/integrations-custom-guardrails/integrations/bigeye/. It contains the Dockerfile, deploy script, example gateway YAML, and tests referenced below.

What is Bigeye?

Bigeye is an AI Trust platform for the enterprise, built on its data observability and governance products. It maps which data your AI agents access and enforces policies that keep agents within approved data boundaries. Its Access Decision API takes the tables, columns or SQL statements an agent is about to access and returns a decision based on catalog signals, such as open data-quality issues and sensitive-data findings, and optional Bigeye policies: ALLOW, WARN, REQUIRE_CONFIRMATION or DENY. Bigeye records every decision in Agent Trust Hub, an auditable record of the data agents access.

What the integration does

Before an MCP tool call runs, the wrapper reads the SQL, table names and column names from the tool’s arguments and sends them to Bigeye’s Access Decision API. It blocks the call when Bigeye’s overall decision is in block_on, which defaults to DENY and REQUIRE_CONFIRMATION. MCP pre-invoke guardrails run before the tool, so a blocked tool never runs.
  • With the default block_on, ALLOW and WARN pass, and so do assets that are unresolved or UNSPECIFIED (see Table and column names). Add UNSPECIFIED to block_on to block them.
  • A guardrail can only allow or block a call, so REQUIRE_CONFIRMATION blocks the call by default. Remove it from block_on to let those calls through. To require human approval for specific tools, use MCP Tool Approvals.
  • The wrapper makes one Bigeye call per tool call and never retries.
  • If the arguments hold no SQL, table or column names, the wrapper doesn’t call Bigeye and allows the call. Set on_nothing_to_check to change this.

Architecture

The wrapper returns HTTP 200 for both allow and block and puts the decision in the JSON body. Errors return a non-2xx status, which the gateway handles according to the guardrail’s enforcing strategy. See Custom guardrail response contract.

Response contract

The wrapper never returns 429 or 503, because the gateway retries those. A 429 or 503 from Bigeye becomes 502. The bigeye object lands on the guardrail span in the gateway trace: {checked, span_external_id, overall_decision, assets: [{name, decision}], unresolved_count, assets_found, latency_ms}, or {checked: false, reason} when there was nothing to check. It never includes SQL text or data values; SQL assets are named <sql>.

Wrapper endpoints

The guardrail’s Bearer token is your Bigeye API key. The wrapper forwards it to Bigeye as Authorization: apikey <key> (set by auth_scheme) and stores nothing, so there’s no separate wrapper key.

Prerequisites

  • Bigeye API key: Bigeye recommends a service-account key scoped to the workspace. The key needs at least Edit access to the target workspace. See Using API Keys.
  • Bigeye workspace ID.
  • Data source name and warehouse type, as Bigeye shows them for the data source your MCP server queries, for example a Snowflake source.
  • Public HTTPS host for the wrapper that the AI Gateway can reach. The wrapper must also reach your Bigeye host over HTTPS.
  • The MCP server for that data source, registered in the AI Gateway.

Setup

1

Deploy the wrapper

The wrapper needs no secrets at deploy time: the Bigeye API key arrives with each request from the guardrail config.
Run it on any platform with a public HTTPS URL (ECS, Cloud Run, Kubernetes, on-prem) and put TLS in front of it. The AI Gateway must reach https://<wrapper-host>/mcp-pre-invoke.
Optional environment variables on the wrapper:Check the deployment:
2

Register a Custom guardrail

AI Gateway → Guardrails → Add New Guardrails Group → Custom. Name the group, for example bigeye, and add one config per Bigeye data source, because source_name and warehouse_type apply to every table, column and SQL statement in a call.Use Enforce But Ignore On Error while you pilot. For production access to regulated data, use Enforce, so calls are blocked when the check can’t run. Under Enforce, a wrapper outage blocks every tool the policy covers, not only SQL tools.
See Config reference for every key.The same group as YAML, for tfy apply:
3

Create a guardrail policy

In AI Gateway → Policies → Guardrails, add a guardrail policy that targets the data source’s MCP server and runs the guardrail on MCP Tool Pre-Invoke:
Listing only the server covers every tool on it. To cover a single tool, use <mcp-server-name>:<tool-name> as the value.
A guardrail policy is the only way to attach this guardrail. The X-TFY-GUARDRAILS header and guardrails pinned to a model don’t cover MCP hooks.

Config reference

The wrapper reads the guardrail’s Config JSON. Setting sql_keys, table_keys or column_keys replaces that list’s default; the other two keep theirs. Name values may be a list, a JSON-array string or a comma-separated string. For users, the caller’s username is sent to Bigeye for audit.

Table and column names

  • Use the names Bigeye’s catalog shows for the data source. Table and column arguments are sent to Bigeye as they are, so they must match the catalog. For some Snowflake sources that’s schema.table and schema.table.column, with no database prefix. Check the catalog for your source.
  • Unresolved and UNSPECIFIED assets are allowed by default. If Bigeye can’t resolve an object, for example because source_name doesn’t match a data source, it lists the object as unresolved. If it recognizes an asset that isn’t in its catalog, it returns the asset with decision UNSPECIFIED and a source name such as Unknown Snowflake. Neither counts toward the overall decision, so the call goes through. The trace’s bigeye output shows unresolved_count above 0, or the asset with UNSPECIFIED.
  • Add UNSPECIFIED to block_on to block them. The call is then blocked when any asset is unresolved or UNSPECIFIED, so agents only touch data Bigeye has decided on. Test it on your workspace first: the wrapper counts an asset that Bigeye returns without its own decision as UNSPECIFIED, so check that cataloged tables show a decision other than UNSPECIFIED in the trace’s assets list.
  • SQL is parsed by Bigeye. For SQL arguments, Bigeye parses the statement itself and resolves the tables and columns it references against the data source in source_name.

Policy mode

By default (evaluate_policy: false), the verdict comes from catalog signals such as open data-quality issues and sensitive-data findings. Bigeye still evaluates your workspace policies after the call and shows the results in Agent Trust Hub, but they don’t affect the verdict. Set evaluate_policy: true to enforce policies inline. The overall decision is then DENY if any policy matches and ALLOW otherwise, and catalog signals don’t affect it. Inline evaluation adds latency that grows with the number of workspace policies, so benchmark it against bigeye_timeout_ms, which must stay below the gateway’s guardrail timeout. Bigeye’s access.policy.always_evaluate_synchronously Advanced Setting forces inline evaluation on every request, so policy mode applies even when evaluate_policy is false. See Policy Evaluation in Bigeye’s Access Decision API docs.

Verify the integration

1

A query on a clean table runs

From an MCP client connected to the server’s gateway endpoint, call the SQL tool on a table with no open data-quality issues, for example SELECT * FROM <schema>.<clean-table> LIMIT 10. The tool runs and returns rows. In AI Gateway → Monitor → Request Traces, the guardrail span shows the check passed, with overall_decision: ALLOW in its bigeye output.
2

A query on a table with open issues is blocked

Call the same tool on a table with open data-quality issues in Bigeye, for example SELECT <column> FROM <schema>.<flagged-table> LIMIT 10. The gateway blocks the call and the tool doesn’t run. The guardrail span shows the check failed, with overall_decision: DENY.DENY is Bigeye’s default for open issues and sensitive-data findings. If your workspace has lowered either setting in Advanced Settings, you’ll see that decision instead, and WARN passes with the default block_on.
3

Check Bigeye

In Bigeye, open the Agent Registry (Agent Trust > Registry) and click the agent (agent_id, truefoundry-gateway by default). Agent Trust must be enabled for your workspace. The agent’s conversations list the decisions. Open a conversation to see each table with a status: a green check for no concerns, a yellow triangle for warnings, or a red triangle for a table that shouldn’t be accessed. See the AI Conversation Page.Bigeye stores each decision with the span_external_id from the trace’s bigeye output. To find the record for a span, filter the access decision list endpoint by span_external_id.

Limitations

  • No masking or redaction. The integration allows or blocks tool calls. It doesn’t change arguments or results.
  • One guardrail config per Bigeye data source. source_name and warehouse_type apply to every object in a call, so add a config and a policy for each data source.
  • Only top-level argument keys are read. Nested arguments such as {"params": {"query": ...}} aren’t read. Change the names with sql_keys, table_keys and column_keys.
  • MCP servers passed by URL in agent requests skip guardrails. Register the MCP server in the AI Gateway so the policy can match it.
  • Fails open under Enforce But Ignore On Error. If the wrapper or Bigeye errors or times out, the tool call goes through. Look for ignored_error on the guardrail span in traces. Use Enforce to block tool calls when the check can’t run.

Troubleshooting

The wrapper returns 502 with "error": "bigeye_error" when Bigeye rejects the key. If the wrapper logs say Bigeye returned 500 and couldn’t decode the key (a base64 error), auth_scheme is usually bearer for a personal API key, or the key was truncated. Set "auth_scheme": "apikey" (the default) and re-paste the key into Custom Bearer Auth.
The wrapper returns 500 with "error": "configuration_error" and bigeye_url is not an allowed Bigeye host when bigeye_url isn’t covered by BIGEYE_ALLOWED_HOSTS. The default allows *.bigeye.com. For another host, set BIGEYE_ALLOWED_HOSTS on the wrapper and redeploy. The wrapper only calls https hosts and doesn’t follow redirects.
The guardrail passes, but the trace’s bigeye output shows unresolved_count above 0 or assets with UNSPECIFIED, and overall_decision: UNSPECIFIED when nothing has a decision.
  • Unresolved: Bigeye couldn’t resolve the object. Check that source_name and warehouse_type match the data source, and use the names Bigeye’s catalog shows for it (see Table and column names).
  • UNSPECIFIED: Bigeye recognized the asset but it isn’t in the catalog. Check that the data source is cataloged in Bigeye and covers the asset.
The wrapper was unreachable, returned an error, or didn’t answer within the gateway’s guardrail timeout, so Enforce But Ignore On Error let the call through. Check https://<wrapper-host>/health, the wrapper logs and the error status (see Response contract), and keep bigeye_timeout_ms below the gateway’s timeout.

Reference