Third-Party Integrations
Relevant source files
The following files were used as context for generating this wiki page:
- src/ipc/handlers/github_handlers.ts
- src/ipc/handlers/vercel_handlers.ts
- src/ipc/handlers/supabase_handlers.ts
- src/ipc/handlers/neon_handlers.ts
- src/components/GitHubConnector.tsx
- src/components/VercelConnector.tsx
- src/prompts/system_prompt.ts
- e2e-tests/snapshots/chat_mode.spec.ts_chat-mode-selector---ask-mode-1.txt
- e2e-tests/snapshots/local_agent_basic.spec.ts_local-agent---dump-request-1.txt
- e2e-tests/snapshots/local_agent_consent.spec.ts_local-agent---add-dependency-consent-decline-1.aria.yml
The Dyad system allows the AI assistant to augment a user's application with third-party services. This is primarily achieved when the user requests features that require backend functionality, such as authentication, databases, or server-side functions. The AI is instructed to identify these needs and suggest a relevant integration, which the user can then add to their app through a guided UI flow.
The core of this system revolves around the AI assistant generating a specific XML-like tag, <dyad-add-integration>, in its response. This tag acts as a trigger for the Dyad user interface to present an option to the user. If the user accepts, a corresponding tool is executed by the AI's agent to set up the integration. The primary integration provider explicitly mentioned is Supabase.
Sources: src/prompts/system_prompt.ts:449-478, e2e-tests/snapshots/chat_mode.spec.ts_chat-mode-selector---ask-mode-1.txt
Integration Flow
The process for adding a third-party integration is initiated by the AI based on the user's request. The flow follows these general steps:
- User Request: The user asks for a feature that implies a backend need (e.g., "I want to add auth to my app").
- AI Analysis: The AI, guided by its system prompt, recognizes that a third-party service is required.
- AI Suggestion: The AI responds with an explanation and includes the
<dyad-add-integration>tag, specifying the provider. - UI Trigger: The Dyad frontend parses this tag and displays a button or prompt to the user, allowing them to confirm the addition of the integration.
- Tool Execution: Upon user confirmation, the
add_integrationtool is called by the local agent, which handles the backend logic of setting up the integration.
The following diagram illustrates this high-level flow.
Core Mechanisms
The integration feature is implemented through a combination of system prompt directives and a dedicated agent tool.
<dyad-add-integration> Tag
The AI communicates the need for an integration to the frontend using a custom tag. The system prompt explicitly instructs the AI on how to use this tag.
- Tag:
<dyad-add-integration> - Attribute:
provider(e.g., "supabase") - Purpose: To signal to the UI that an integration option should be presented to the user.
Example from the system prompt:
If the user wants to use supabase or do something that requires auth, database or server-side functions (e.g. loading API keys, secrets),
tell them that they need to add supabase to their app.
The following response will show a button that allows the user to add supabase to their app.
<dyad-add-integration provider="supabase"></dyad-add-integration>
Sources: src/prompts/system_prompt.ts:449-456, e2e-tests/snapshots/chat_mode.spec.ts_chat-mode-selector---ask-mode-1.txt
add_integration Tool
For the local agent, there is a corresponding add_integration tool. This function is what gets executed after the user approves the integration. The tool's definition specifies its name, description, and parameters.
The following sequence diagram shows the interaction:
The tool has the following schema:
| Parameter | Type | Description | Required |
|---|---|---|---|
provider | string | The integration provider to add (e.g., 'supabase'). | Yes |
Sources: e2e-tests/snapshots/local_agent_basic.spec.ts_local-agent---dump-request-1.txt:130-153
The JSON schema for the tool is defined as follows:
{
"type": "function",
"function": {
"name": "add_integration",
"description": "Add an integration provider to the app (e.g., Supabase for auth, database, or server-side functions). Once you have called this tool, stop and do not call any more tools because you need to wait for the user to set up the integration.",
"parameters": {
"type": "object",
"properties": {
"provider": {
"type": "string",
"enum": [
"supabase"
],
"description": "The integration provider to add (e.g., 'supabase')"
}
},
"required": [
"provider"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
}
Sources: e2e-tests/snapshots/local_agent_basic.spec.ts_local-agent---dump-request-1.txt:130-153
Supported Providers
The provided source files indicate support for or the existence of several third-party integrations.
| Provider | Purpose & Evidence | Source Files |
|---|---|---|
| Supabase | Explicitly defined for adding auth, database, or server-side functions. The add_integration tool lists supabase as an enum value for the provider parameter. A related dependency @dyad-sh/supabase-management-js is also mentioned. | src/prompts/system_prompt.ts, e2e-tests/snapshots/local_agent_basic.spec.ts_local-agent---dump-request-1.txt, e2e-tests/snapshots/local_agent_consent.spec.ts_local-agent---add-dependency-consent-decline-1.aria.yml, src/ipc/handlers/supabase_handlers.ts |
| GitHub | The existence of github_handlers.ts and GitHubConnector.tsx strongly suggests an integration with GitHub, likely for source control, repository management, or deployment. | src/ipc/handlers/github_handlers.ts, src/components/GitHubConnector.tsx |
| Vercel | The existence of vercel_handlers.ts and VercelConnector.tsx suggests an integration with Vercel, likely for deployment and hosting management. | src/ipc/handlers/vercel_handlers.ts, src/components/VercelConnector.tsx |
| Neon | The existence of neon_handlers.ts suggests an integration with Neon, a serverless Postgres provider, likely for database services. | src/ipc/handlers/neon_handlers.ts |
Note: The specific functionalities of the GitHub, Vercel, and Neon integrations are inferred from file names, as their content was not available for analysis.