Context Layer Setup Guide Public Preview
Learn how to set up a context layer for your organization and connect it to your AI tools.
Prerequisites
To create and use a context layer, you need:
A Fivetran account with admin access.
Fivetran accounts for anyone who needs to query your context layer, if they don't already have one.
If someone only needs to query your organization's context layer and doesn't need access to other features in Fivetran, leave the Account Role field empty when you set up their account.
Admin access to the AI tool that you want to connect to your context layer. Popular tools include Claude, Cursor, ChatGPT, Codex, and Gemini.
At least one documentation source or analytical source. For better answer quality, we recommend connecting at least one source of each type.
Expand to see supported documentation sources
Documentation sources enrich your context layer with business definitions, policies, and operational records. Context Layer supports the following documentation sources:
- Confluence
- Google Drive
- SharePoint
- Notion
Expand to see supported analytical sources
Analytical sources provide information on how metrics are defined, which tables they depend on, and where definitions diverge across tools. Context Layer supports the following analytical sources:
- Hex
- Looker
- Power BI
- Sigma Computing
(Optional) At least one system of record. These systems provide additional context, such as operational details about your data.
Expand to see supported systems of record
Context Layer supports the following systems of record:
- Asana
- GitHub
- Gong.io
- HubSpot
- Intercom
- Jira
- Zendesk
Setup instructions
Get started
- Log in to the Fivetran dashboard.
- Navigate to the Context tab.
- Click Set up Context Layer.
Select a warehouse
Choose the data warehouse you want the Context Layer to read from. Fivetran builds an Agents Schema inside this warehouse so your AI tools can answer questions using your business data, semantic models, and metadata.
Add documentation or analytical source
Add at least one data source. We support two source types, documentation sources and analytical sources. For better answer quality, we recommend connecting at least one source of each type.
Learn more about source types in the Prerequisites section.
(Optional) Add systems of record
Add your organization's systems of record, if you want to include additional context about your data.
Build context layer
Review the context layer inputs, then click Build Context Layer.
Building your context layer typically takes about a day to complete.
During the build, we process your sources differently depending on their category:
For documentation sources and systems of record, Context Layer performs the following steps:
- Models your data: Converts key objects from your sources into OKF format to make your unstructured data AI-ready.
- Parses your files: Parses files, attachments, and other documents to make them AI-searchable.
- Builds a search index: Creates embeddings from your parsed content and builds a search index using those embeddings.
For analytical sources, Context Layer extracts metadata that shows how your data is organized in your destination and writes it to the Agents Schema.
Review organization fingerprint
Once the context layer finishes building, review the organization fingerprint and the assets connected to your context layer. When you're done reviewing, click Start exploring.
Try playground
Use the playground to try out different questions based on your built context layer and confirm it responds to your questions accurately.
Install in AI tools
Once your context layer is built, choose one of the following options to connect it to your organization's AI tools:
Fivetran's Agent Context MCP server enables you to connect your agent to your context layer. The MCP also caches context on Fivetran's infrastructure, which reduces the tokens your agent consumes and improves the accuracy of its responses.
Agent Context MCP is hosted at https://api.fivetran.ai/mcp. See the Agent Context MCP Setup Guide for client-specific instructions for Claude, Claude Code, ChatGPT, Codex, Cursor, Gemini, and popular agent SDKs.
Fivetran builds the entire context layer directly in the Agents Schema in your data warehouse. Connect your AI application straight to your data warehouse to use all the context Context Layer infers and the indices it builds, through an agent that operates on top of your data warehouse.
This approach gives you maximum control over how your users access the context layer, since you configure access using standard warehouse user permissions.
To set up connect directly to your data warehouse, do the following:
- Add the
agents-schema-searchskill to your agent's skill repository or system prompt. - Ensure your agent can connect to the warehouse using the
connect-warehouseskill.
If your organization uses Codex or Claude Code, install the agents-schema plugin from the agents-schema plugin marketplace to query the context layer directly from your terminal.
To enable semantic search for warehouse-connected agents, a warehouse administrator must complete one-time setup for your destination:
BigQuery
Fivetran uses gemini-embedding-001 for BigQuery. The model must use the project's default Cloud resource connection in the same location as the AGENTS dataset. Creating a remote model through CONNECTION DEFAULT as an administrator creates or configures that connection and grants its Google-managed service account the required Vertex AI access.
The AGENTS dataset must already exist. Run indexing once to create it, or create it in the same location as the destination data before continuing.
Replace <project_id> and <fivetran_worker_service_account> below. Run the commands as an administrator who can configure the BigQuery default connection and update project IAM. Ensure that the BigQuery Connection API and Vertex AI API are enabled in the project.
1. Enable the required APIs
gcloud services enable \
bigqueryconnection.googleapis.com \
aiplatform.googleapis.com \
--project=<project_id>
2. Bootstrap the default connection and remote model
bq query --project_id=<project_id> --nouse_legacy_sql \
'CREATE MODEL IF NOT EXISTS `<project_id>.AGENTS.ai_ready__emb__gemini_embedding_001`
REMOTE WITH CONNECTION DEFAULT
OPTIONS (ENDPOINT = "gemini-embedding-001")'
This is a safe no-op after the model and default connection have been configured successfully. The administrator running it typically needs BigQuery Admin and Project IAM Admin permissions; see BigQuery connection management for the exact permissions.
The initial model is a bootstrap vehicle for configuring the connection. The indexing pipeline owns its lifecycle after setup.
3. Let the Fivetran worker use the connection
Grant the Fivetran worker service account BigQuery Connection User. This project-level command lets the worker use Cloud resource connections in the project:
gcloud projects add-iam-policy-binding <project_id> \
--member="serviceAccount:<fivetran_worker_service_account>" \
--role="roles/bigquery.connectionUser" \
--condition=None
The worker also needs its normal destination permissions to create and inspect models in AGENTS. It does not need permission to read or change project IAM. After this bootstrap, the pipeline refers to the system-managed default connection explicitly and creates the model if it is missing.
For background, see BigQuery default connections and BigQuery text embedding generation.
Databricks
Fivetran uses OpenAI text-embedding-3-large. A customer administrator must expose that model through a Databricks external Model Serving endpoint so ai_query() can embed queries without routing them through Fivetran. The workspace must support Unity Catalog, serverless compute, AI Search, and ai_query().
Replace <secret_scope> and <secret_key> below. The endpoint must be named ai_ready__emb__text_embedding_3_large.
1. Store the OpenAI API key
databricks secrets create-scope <secret_scope> databricks secrets put-secret <secret_scope> <secret_key>
2. Create the external embedding endpoint
Run this in a Databricks notebook authenticated as an administrator:
%pip install "mlflow[genai]>=2.9.0"
import mlflow.deployments
client = mlflow.deployments.get_deploy_client("databricks")
client.create_endpoint(
name="ai_ready__emb__text_embedding_3_large",
config={
"served_entities": [{
"name": "ai_ready__emb__text_embedding_3_large",
"external_model": {
"name": "text-embedding-3-large",
"provider": "openai",
"task": "llm/v1/embeddings",
"openai_config": {
"openai_api_key": "{{secrets/<secret_scope>/<secret_key>}}"
},
},
}],
},
)
Grant the Fivetran destination principal CAN QUERY on this endpoint. It also needs its normal Unity Catalog write privileges, CREATE TABLE on each target schema, and permission to create or manage the fivetran_ai_search AI Search endpoint. The pipeline enables Change Data Feed on each vector table and creates a triggered Delta Sync index over the customer-provided embeddings.
For background, see Databricks external OpenAI model endpoints, Databricks ai_query, and Databricks AI Search setup.
Snowflake
Fivetran generates Snowflake document embeddings outside the warehouse with text-embedding-3-large. To let warehouse-connected agents embed query text with the same model, a Snowflake administrator must create customer-owned external-access objects. Creating only the external-access integration is insufficient because Snowflake requires it to reference an existing network rule and secret.
Replace <destination_database>, <destination_schema>, <destination_warehouse>, and <fivetran_destination_role> below. Supply the OpenAI API key through an approved secret-management workflow.
1. Create the network rule and secret
Run with a role that can create network rules and secrets in the AGENTS schema:
USE DATABASE <destination_database>;
CREATE SCHEMA IF NOT EXISTS AGENTS;
CREATE OR REPLACE NETWORK RULE AGENTS.FIVETRAN_OPENAI_NETWORK_RULE
MODE = EGRESS
TYPE = HOST_PORT
VALUE_LIST = ('api.openai.com');
CREATE OR REPLACE SECRET AGENTS.OPENAI_API_KEY
TYPE = GENERIC_STRING
SECRET_STRING = '<customer-owned OpenAI API key>';
2. Create the external-access integration
Run with a role that has the account-level CREATE INTEGRATION privilege:
CREATE OR REPLACE EXTERNAL ACCESS INTEGRATION FIVETRAN_OPENAI_EXTERNAL_ACCESS_INTEGRATION
ALLOWED_NETWORK_RULES = (<destination_database>.AGENTS.FIVETRAN_OPENAI_NETWORK_RULE)
ALLOWED_AUTHENTICATION_SECRETS = (<destination_database>.AGENTS.OPENAI_API_KEY)
ENABLED = TRUE;
3. Grant the destination role access
The role used by the Fivetran Snowflake destination must be able to create the UDF, read the secret, and use the integration:
GRANT USAGE ON DATABASE <destination_database> TO ROLE <fivetran_destination_role>;
GRANT USAGE ON SCHEMA <destination_database>.AGENTS TO ROLE <fivetran_destination_role>;
GRANT CREATE FUNCTION ON SCHEMA <destination_database>.AGENTS TO ROLE <fivetran_destination_role>;
GRANT CREATE CORTEX SEARCH SERVICE ON SCHEMA <destination_database>.<destination_schema>
TO ROLE <fivetran_destination_role>;
GRANT USAGE ON WAREHOUSE <destination_warehouse> TO ROLE <fivetran_destination_role>;
GRANT READ ON SECRET <destination_database>.AGENTS.OPENAI_API_KEY TO ROLE <fivetran_destination_role>;
GRANT USAGE ON INTEGRATION FIVETRAN_OPENAI_EXTERNAL_ACCESS_INTEGRATION
TO ROLE <fivetran_destination_role>;
If agents query Snowflake with a different role, grant that role USAGE on the database and schema. After the next indexing run creates the function, also grant function usage:
GRANT USAGE ON FUNCTION
<destination_database>.AGENTS.ai_ready__emb__text_embedding_3_large(VARCHAR)
TO ROLE <agent_query_role>;
For background, see Snowflake external network access setup, Snowflake CREATE SECRET, and OpenAI embeddings API.
Connecting your agent directly to the warehouse can increase token consumption, due to additional discovery steps, and reduce accuracy, due to token bloat.