Build

Data access

On this page

Three ways to reach data

The tools you build can work on real data: your CRM, your tracker, or a database of their own. Valet gives a tool that data in three ways.

  • Connector. Access to another service's tools, such as HubSpot, Google Drive or an MCP server your company runs. Someone in your organization, usually an administrator, sets it up once. Your tool calls the service through Valet, and Valet adds the credential on the way, so your tool never holds it.
  • Resource. A database or an AI model that Valet runs for an app. The app reads its connection details from env vars.
  • Env var. A named value, such as an API key or a region, that an app or agent reads.

Most tools start with a connector. Use a resource when an app needs to store its own records. Use an env var for a setting, or for a key to a service that has no connector.

Which tools can use which

Connectors

Artifact
Yes
App
No
Agent
Yes

Resources

Artifact
No
App
Yes
Agent
No

Env vars

Artifact
No
App
Yes
Agent
Yes
  • An artifact calls a connector from the page's own JavaScript. It can use an organization connector that reaches a service over the web, and the artifact must not be public. Everyone who can open the page can call every tool the connector has, with the organization's credential.
  • An app can't hold connectors. It gets resources and env vars as ordinary environment variables, secrets included.
  • An agent can hold any kind of connector. It reads plain env vars directly. Secret env vars stay out of its environment: Valet hands a secret only to the connector that uses it.

Connectors

Use a connector when the data lives in a service your company already uses. Ask your agent to build on it:

Build a page that shows this quarter's open HubSpot deals by owner.
Use our org's HubSpot connector.

The agent looks for a connector the organization already has. If there isn't one, it looks in Valet's catalog. It can add an entry that takes an API key; for one that needs a browser sign-in, it sends you to the Integrations section of the dashboard. Before it attaches the connector to your artifact, it tells you what the page could do through it and asks you to confirm. Then it calls each tool once to see the real answers, and builds the page against them.

Finding and attaching a connector looks like this:

list_connectors
{ "name": "deals" }

attach_connector
{ "name": "deals", "connector": "hubspot-mcp" }

See Connectors for the kinds of connectors, how Valet holds their credentials, and how to add one.

Resources

Use a resource when an app needs to keep its own records, such as requests, approvals or survey answers. Ask your agent:

Give my expense-requests app a PostgreSQL database and store the
requests there.

The agent creates a resource, attaches it to the app, and writes code that reads the connection details from env vars. Attaching restarts the app. Name a resource for what it holds, such as expenses-db, so another app can share it later.

list_catalog_resources

attach_resource
{
  "name": "expense-requests",
  "resource": "expenses-db",
  "provider": "valet-postgresql",
  "plan": "dev"
}

An app can get an AI model the same way, as an inference resource. See Resources for the kinds and the env vars each sets.

Env vars

Use an env var for a setting, or for a key to a service with no connector. An env var belongs to the whole organization or to one app or agent. It is a secret unless you make it plain. Valet encrypts both kinds; list_env_vars and valet env show plain values and mask secrets. Ask your agent:

Add an OPENWEATHER_API_KEY secret to my weather app.
set_env_vars
{ "name": "weather", "vars": { "OPENWEATHER_API_KEY": "..." } }

set_env_vars
{ "name": "weather", "vars": { "REGION": "us-east-1" }, "secret": false }

list_env_vars
{ "name": "weather" }

A key set over MCP passes through your chat. To keep it out, run the CLI command yourself or enter the key in the dashboard.

Setting or unsetting an app's or agent's own env var restarts it.

Is Snowflake a connector or a resource?

A connector, if there's an MCP server for it. A connector reaches a system your company already has. A resource is a new database that Valet creates and runs for an app; it isn't a way into an existing one.

To check, ask your agent:

Is there a Valet connector for Snowflake?

If the catalog has no entry, someone in your organization can add the service's MCP server as a connector of their own. Valet must be able to reach that server over the network. See Add your own MCP server and What leaves the installation.