airbyte.agents.workspaces

Airbyte Agents workspaces.

⚠️ Experimental Interface

The Airbyte Agents Python interfaces are experimental. Class names, method signatures, and result models may change or be removed without notice between minor versions of PyAirbyte. Pin an exact PyAirbyte version if you depend on them.

  1# Copyright (c) 2026 Airbyte, Inc., all rights reserved.
  2"""Airbyte Agents workspaces.
  3
  4> ## ⚠️ Experimental Interface
  5>
  6> **The Airbyte Agents Python interfaces are experimental.** Class names, method signatures,
  7> and result models may change or be removed without notice between minor versions of
  8> PyAirbyte. Pin an exact PyAirbyte version if you depend on them.
  9"""
 10
 11from __future__ import annotations
 12
 13from typing import TYPE_CHECKING
 14
 15from airbyte.agents import _api_util
 16from airbyte.agents.connectors import AgentConnector, _resolve_connector_lookup
 17from airbyte.agents.models import AgentConnectorInfo, AgentWorkspaceInfo
 18from airbyte.cloud._credentials import _AirbyteCredentials
 19from airbyte.cloud.workspaces import CloudWorkspace
 20from airbyte.exceptions import AirbyteError, PyAirbyteInputError
 21
 22
 23if TYPE_CHECKING:
 24    from airbyte.secrets.base import SecretString
 25
 26
 27class AgentWorkspace:
 28    """A workspace on the Airbyte Agents platform.
 29
 30    Airbyte Cloud credentials authenticate against the Agents API, so this class reads the
 31    same `AIRBYTE_CLOUD_*` environment variables as `airbyte.cloud.CloudWorkspace`.
 32
 33    ```python
 34    from airbyte import agents
 35
 36    workspace = agents.AgentWorkspace.from_env()
 37    for connector in workspace.list_connectors():
 38        print(connector.name)
 39    ```
 40    """
 41
 42    def __init__(
 43        self,
 44        *,
 45        workspace_id: str | None = None,
 46        organization_id: str | None = None,
 47        name: str | None = None,
 48        client_id: str | SecretString | None = None,
 49        client_secret: str | SecretString | None = None,
 50        bearer_token: str | SecretString | None = None,
 51    ) -> None:
 52        """Initialize an `AgentWorkspace`.
 53
 54        Credentials fall back to the `AIRBYTE_CLOUD_*` environment variables when they are
 55        not passed explicitly.
 56        """
 57        credentials = _AirbyteCredentials.from_auth(
 58            workspace_id=workspace_id,
 59            organization_id=organization_id,
 60            client_id=client_id,
 61            client_secret=client_secret,
 62            bearer_token=bearer_token,
 63            # Mirrors `CloudWorkspace.__init__`: any explicit credential disables env
 64            # fallback, since an env bearer token plus explicit client creds is rejected
 65            # as mutually exclusive auth.
 66            env_vars=not (client_id or client_secret or bearer_token),
 67        )
 68        if not credentials.workspace_id:
 69            raise PyAirbyteInputError(
 70                message="Workspace ID is required.",
 71                guidance=(
 72                    "Provide `workspace_id`, or set the `AIRBYTE_CLOUD_WORKSPACE_ID` "
 73                    "environment variable."
 74                ),
 75            )
 76
 77        self._credentials = credentials
 78
 79        self.workspace_id: str = credentials.workspace_id
 80        """The workspace ID."""
 81
 82        self.organization_id: str | None = credentials.organization_id
 83        """The organization ID, sent to the Agents API when it is known."""
 84
 85        self.name: str | None = name
 86        """The workspace name, when known. Use `get_info()` to fetch it from the API."""
 87
 88    @classmethod
 89    def from_env(
 90        cls,
 91        workspace_id: str | None = None,
 92        *,
 93        organization_id: str | None = None,
 94    ) -> AgentWorkspace:
 95        """Create an `AgentWorkspace` from the `AIRBYTE_CLOUD_*` environment variables.
 96
 97        The variables used are `AIRBYTE_CLOUD_BEARER_TOKEN` or the
 98        `AIRBYTE_CLOUD_CLIENT_ID` and `AIRBYTE_CLOUD_CLIENT_SECRET` pair, along with
 99        `AIRBYTE_CLOUD_WORKSPACE_ID` and `AIRBYTE_CLOUD_ORGANIZATION_ID`.
100        """
101        return cls(workspace_id=workspace_id, organization_id=organization_id)
102
103    def get_info(self) -> AgentWorkspaceInfo:
104        """Fetch this workspace from the Agents API.
105
106        A successful call is authoritative proof that the workspace is reachable through
107        the Agents API with these credentials.
108        """
109        return AgentWorkspaceInfo.model_validate(
110            _api_util.get_agent_workspace(
111                workspace_id=self.workspace_id,
112                credentials=self._credentials,
113                organization_id=self.organization_id,
114            )
115        )
116
117    def list_connectors(self) -> list[AgentConnector]:
118        """List the connectors configured in this workspace."""
119        return [
120            AgentConnector(
121                connector_id=info.id,
122                name=info.name,
123                credentials=self._credentials,
124            )
125            for info in (
126                AgentConnectorInfo.model_validate(record)
127                for record in _api_util.list_agent_connectors(
128                    workspace_id=self.workspace_id,
129                    credentials=self._credentials,
130                    organization_id=self.organization_id,
131                )
132            )
133        ]
134
135    def get_connector(
136        self,
137        id_or_name: str | None = None,
138        /,
139        *,
140        id: str | None = None,  # noqa: A002  # Shadows `id` deliberately, as a short alias.
141        connector_id: str | None = None,
142        name: str | None = None,
143    ) -> AgentConnector:
144        """Get a connector in this workspace, by ID or by name.
145
146        Pass a single positional value to look the connector up by either its ID or its
147        name, or name the argument to be explicit: `id` and `connector_id` are synonyms,
148        so pass whichever reads better.
149
150        Lookup by an explicit ID does not call the Agents API. Every other form lists the
151        workspace's connectors and matches on ID first, then on an exact name, then on a
152        unique substring, so `name="GitHub"` finds a connector named
153        `GitHub - <workspace_id>`. Name matching is case-insensitive.
154        """
155        lookup = _resolve_connector_lookup(
156            id_or_name,
157            id=id,
158            connector_id=connector_id,
159            name=name,
160        )
161
162        if lookup.connector_id and not lookup.name:
163            return AgentConnector(connector_id=lookup.connector_id, credentials=self._credentials)
164
165        connectors = self.list_connectors()
166        if lookup.connector_id:
167            id_matches = [
168                connector
169                for connector in connectors
170                if connector.connector_id == lookup.connector_id
171            ]
172            if id_matches:
173                return id_matches[0]
174
175        name_lower = (lookup.name or "").lower()
176        matches = [
177            connector
178            for connector in connectors
179            if connector.name and connector.name.lower() == name_lower
180        ] or [
181            connector
182            for connector in connectors
183            if connector.name and name_lower in connector.name.lower()
184        ]
185        if not matches:
186            raise AirbyteError(
187                message="No connector found with the given ID or name.",
188                guidance="Use `list_connectors()` to see the available connectors.",
189                context={"lookup": lookup.name, "workspace_id": self.workspace_id},
190            )
191        if len(matches) > 1:
192            raise AirbyteError(
193                message="Multiple connectors matched the given name.",
194                guidance="Pass `connector_id`, or a name that matches only one connector.",
195                context={
196                    "name": lookup.name,
197                    "matched_names": [connector.name for connector in matches],
198                },
199            )
200        return matches[0]
201
202    def as_cloud_workspace(self) -> CloudWorkspace:
203        """Return this workspace as an `airbyte.cloud.CloudWorkspace`.
204
205        Every Agents workspace is also a Cloud workspace, so this conversion always
206        succeeds without calling either API.
207        """
208        return CloudWorkspace(
209            workspace_id=self.workspace_id,
210            client_id=self._credentials.client_id,
211            client_secret=self._credentials.client_secret,
212            bearer_token=self._credentials.bearer_token,
213            api_root=self._credentials.public_api_root,
214            config_api_root=self._credentials.config_api_root,
215        )
216
217    @classmethod
218    def from_cloud_workspace(
219        cls,
220        cloud_workspace: CloudWorkspace,
221        *,
222        organization_id: str | None = None,
223        verify: bool = True,
224    ) -> AgentWorkspace:
225        """Return a Cloud workspace as an `AgentWorkspace`.
226
227        Cloud workspace IDs are also Agents workspace IDs, but not every Cloud workspace is
228        reachable through the Agents API: the organization needs an Airbyte Agents
229        subscription. By default this is verified by fetching the workspace from the Agents
230        API, which raises `AirbyteError` when it is not eligible. Pass `verify=False` to
231        skip that call.
232
233        Raises `PyAirbyteInputError` when the Cloud workspace uses non-public Cloud API
234        roots, since an `AgentWorkspace` cannot carry them.
235        """
236        _api_util.check_public_cloud_api_roots(
237            cloud_workspace._credentials,  # noqa: SLF001  # Same-domain conversion.
238        )
239        workspace = cls(
240            workspace_id=cloud_workspace.workspace_id,
241            organization_id=organization_id,
242            client_id=cloud_workspace.client_id,
243            client_secret=cloud_workspace.client_secret,
244            bearer_token=cloud_workspace.bearer_token,
245        )
246        if verify:
247            workspace.get_info()
248        return workspace
class AgentWorkspace:
 28class AgentWorkspace:
 29    """A workspace on the Airbyte Agents platform.
 30
 31    Airbyte Cloud credentials authenticate against the Agents API, so this class reads the
 32    same `AIRBYTE_CLOUD_*` environment variables as `airbyte.cloud.CloudWorkspace`.
 33
 34    ```python
 35    from airbyte import agents
 36
 37    workspace = agents.AgentWorkspace.from_env()
 38    for connector in workspace.list_connectors():
 39        print(connector.name)
 40    ```
 41    """
 42
 43    def __init__(
 44        self,
 45        *,
 46        workspace_id: str | None = None,
 47        organization_id: str | None = None,
 48        name: str | None = None,
 49        client_id: str | SecretString | None = None,
 50        client_secret: str | SecretString | None = None,
 51        bearer_token: str | SecretString | None = None,
 52    ) -> None:
 53        """Initialize an `AgentWorkspace`.
 54
 55        Credentials fall back to the `AIRBYTE_CLOUD_*` environment variables when they are
 56        not passed explicitly.
 57        """
 58        credentials = _AirbyteCredentials.from_auth(
 59            workspace_id=workspace_id,
 60            organization_id=organization_id,
 61            client_id=client_id,
 62            client_secret=client_secret,
 63            bearer_token=bearer_token,
 64            # Mirrors `CloudWorkspace.__init__`: any explicit credential disables env
 65            # fallback, since an env bearer token plus explicit client creds is rejected
 66            # as mutually exclusive auth.
 67            env_vars=not (client_id or client_secret or bearer_token),
 68        )
 69        if not credentials.workspace_id:
 70            raise PyAirbyteInputError(
 71                message="Workspace ID is required.",
 72                guidance=(
 73                    "Provide `workspace_id`, or set the `AIRBYTE_CLOUD_WORKSPACE_ID` "
 74                    "environment variable."
 75                ),
 76            )
 77
 78        self._credentials = credentials
 79
 80        self.workspace_id: str = credentials.workspace_id
 81        """The workspace ID."""
 82
 83        self.organization_id: str | None = credentials.organization_id
 84        """The organization ID, sent to the Agents API when it is known."""
 85
 86        self.name: str | None = name
 87        """The workspace name, when known. Use `get_info()` to fetch it from the API."""
 88
 89    @classmethod
 90    def from_env(
 91        cls,
 92        workspace_id: str | None = None,
 93        *,
 94        organization_id: str | None = None,
 95    ) -> AgentWorkspace:
 96        """Create an `AgentWorkspace` from the `AIRBYTE_CLOUD_*` environment variables.
 97
 98        The variables used are `AIRBYTE_CLOUD_BEARER_TOKEN` or the
 99        `AIRBYTE_CLOUD_CLIENT_ID` and `AIRBYTE_CLOUD_CLIENT_SECRET` pair, along with
100        `AIRBYTE_CLOUD_WORKSPACE_ID` and `AIRBYTE_CLOUD_ORGANIZATION_ID`.
101        """
102        return cls(workspace_id=workspace_id, organization_id=organization_id)
103
104    def get_info(self) -> AgentWorkspaceInfo:
105        """Fetch this workspace from the Agents API.
106
107        A successful call is authoritative proof that the workspace is reachable through
108        the Agents API with these credentials.
109        """
110        return AgentWorkspaceInfo.model_validate(
111            _api_util.get_agent_workspace(
112                workspace_id=self.workspace_id,
113                credentials=self._credentials,
114                organization_id=self.organization_id,
115            )
116        )
117
118    def list_connectors(self) -> list[AgentConnector]:
119        """List the connectors configured in this workspace."""
120        return [
121            AgentConnector(
122                connector_id=info.id,
123                name=info.name,
124                credentials=self._credentials,
125            )
126            for info in (
127                AgentConnectorInfo.model_validate(record)
128                for record in _api_util.list_agent_connectors(
129                    workspace_id=self.workspace_id,
130                    credentials=self._credentials,
131                    organization_id=self.organization_id,
132                )
133            )
134        ]
135
136    def get_connector(
137        self,
138        id_or_name: str | None = None,
139        /,
140        *,
141        id: str | None = None,  # noqa: A002  # Shadows `id` deliberately, as a short alias.
142        connector_id: str | None = None,
143        name: str | None = None,
144    ) -> AgentConnector:
145        """Get a connector in this workspace, by ID or by name.
146
147        Pass a single positional value to look the connector up by either its ID or its
148        name, or name the argument to be explicit: `id` and `connector_id` are synonyms,
149        so pass whichever reads better.
150
151        Lookup by an explicit ID does not call the Agents API. Every other form lists the
152        workspace's connectors and matches on ID first, then on an exact name, then on a
153        unique substring, so `name="GitHub"` finds a connector named
154        `GitHub - <workspace_id>`. Name matching is case-insensitive.
155        """
156        lookup = _resolve_connector_lookup(
157            id_or_name,
158            id=id,
159            connector_id=connector_id,
160            name=name,
161        )
162
163        if lookup.connector_id and not lookup.name:
164            return AgentConnector(connector_id=lookup.connector_id, credentials=self._credentials)
165
166        connectors = self.list_connectors()
167        if lookup.connector_id:
168            id_matches = [
169                connector
170                for connector in connectors
171                if connector.connector_id == lookup.connector_id
172            ]
173            if id_matches:
174                return id_matches[0]
175
176        name_lower = (lookup.name or "").lower()
177        matches = [
178            connector
179            for connector in connectors
180            if connector.name and connector.name.lower() == name_lower
181        ] or [
182            connector
183            for connector in connectors
184            if connector.name and name_lower in connector.name.lower()
185        ]
186        if not matches:
187            raise AirbyteError(
188                message="No connector found with the given ID or name.",
189                guidance="Use `list_connectors()` to see the available connectors.",
190                context={"lookup": lookup.name, "workspace_id": self.workspace_id},
191            )
192        if len(matches) > 1:
193            raise AirbyteError(
194                message="Multiple connectors matched the given name.",
195                guidance="Pass `connector_id`, or a name that matches only one connector.",
196                context={
197                    "name": lookup.name,
198                    "matched_names": [connector.name for connector in matches],
199                },
200            )
201        return matches[0]
202
203    def as_cloud_workspace(self) -> CloudWorkspace:
204        """Return this workspace as an `airbyte.cloud.CloudWorkspace`.
205
206        Every Agents workspace is also a Cloud workspace, so this conversion always
207        succeeds without calling either API.
208        """
209        return CloudWorkspace(
210            workspace_id=self.workspace_id,
211            client_id=self._credentials.client_id,
212            client_secret=self._credentials.client_secret,
213            bearer_token=self._credentials.bearer_token,
214            api_root=self._credentials.public_api_root,
215            config_api_root=self._credentials.config_api_root,
216        )
217
218    @classmethod
219    def from_cloud_workspace(
220        cls,
221        cloud_workspace: CloudWorkspace,
222        *,
223        organization_id: str | None = None,
224        verify: bool = True,
225    ) -> AgentWorkspace:
226        """Return a Cloud workspace as an `AgentWorkspace`.
227
228        Cloud workspace IDs are also Agents workspace IDs, but not every Cloud workspace is
229        reachable through the Agents API: the organization needs an Airbyte Agents
230        subscription. By default this is verified by fetching the workspace from the Agents
231        API, which raises `AirbyteError` when it is not eligible. Pass `verify=False` to
232        skip that call.
233
234        Raises `PyAirbyteInputError` when the Cloud workspace uses non-public Cloud API
235        roots, since an `AgentWorkspace` cannot carry them.
236        """
237        _api_util.check_public_cloud_api_roots(
238            cloud_workspace._credentials,  # noqa: SLF001  # Same-domain conversion.
239        )
240        workspace = cls(
241            workspace_id=cloud_workspace.workspace_id,
242            organization_id=organization_id,
243            client_id=cloud_workspace.client_id,
244            client_secret=cloud_workspace.client_secret,
245            bearer_token=cloud_workspace.bearer_token,
246        )
247        if verify:
248            workspace.get_info()
249        return workspace

A workspace on the Airbyte Agents platform.

Airbyte Cloud credentials authenticate against the Agents API, so this class reads the same AIRBYTE_CLOUD_* environment variables as airbyte.cloud.CloudWorkspace.

from airbyte import agents

workspace = agents.AgentWorkspace.from_env()
for connector in workspace.list_connectors():
    print(connector.name)
AgentWorkspace( *, workspace_id: str | None = None, organization_id: str | None = None, name: str | None = None, client_id: str | airbyte.secrets.SecretString | None = None, client_secret: str | airbyte.secrets.SecretString | None = None, bearer_token: str | airbyte.secrets.SecretString | None = None)
43    def __init__(
44        self,
45        *,
46        workspace_id: str | None = None,
47        organization_id: str | None = None,
48        name: str | None = None,
49        client_id: str | SecretString | None = None,
50        client_secret: str | SecretString | None = None,
51        bearer_token: str | SecretString | None = None,
52    ) -> None:
53        """Initialize an `AgentWorkspace`.
54
55        Credentials fall back to the `AIRBYTE_CLOUD_*` environment variables when they are
56        not passed explicitly.
57        """
58        credentials = _AirbyteCredentials.from_auth(
59            workspace_id=workspace_id,
60            organization_id=organization_id,
61            client_id=client_id,
62            client_secret=client_secret,
63            bearer_token=bearer_token,
64            # Mirrors `CloudWorkspace.__init__`: any explicit credential disables env
65            # fallback, since an env bearer token plus explicit client creds is rejected
66            # as mutually exclusive auth.
67            env_vars=not (client_id or client_secret or bearer_token),
68        )
69        if not credentials.workspace_id:
70            raise PyAirbyteInputError(
71                message="Workspace ID is required.",
72                guidance=(
73                    "Provide `workspace_id`, or set the `AIRBYTE_CLOUD_WORKSPACE_ID` "
74                    "environment variable."
75                ),
76            )
77
78        self._credentials = credentials
79
80        self.workspace_id: str = credentials.workspace_id
81        """The workspace ID."""
82
83        self.organization_id: str | None = credentials.organization_id
84        """The organization ID, sent to the Agents API when it is known."""
85
86        self.name: str | None = name
87        """The workspace name, when known. Use `get_info()` to fetch it from the API."""

Initialize an AgentWorkspace.

Credentials fall back to the AIRBYTE_CLOUD_* environment variables when they are not passed explicitly.

workspace_id: str

The workspace ID.

organization_id: str | None

The organization ID, sent to the Agents API when it is known.

name: str | None

The workspace name, when known. Use get_info() to fetch it from the API.

@classmethod
def from_env( cls, workspace_id: str | None = None, *, organization_id: str | None = None) -> AgentWorkspace:
 89    @classmethod
 90    def from_env(
 91        cls,
 92        workspace_id: str | None = None,
 93        *,
 94        organization_id: str | None = None,
 95    ) -> AgentWorkspace:
 96        """Create an `AgentWorkspace` from the `AIRBYTE_CLOUD_*` environment variables.
 97
 98        The variables used are `AIRBYTE_CLOUD_BEARER_TOKEN` or the
 99        `AIRBYTE_CLOUD_CLIENT_ID` and `AIRBYTE_CLOUD_CLIENT_SECRET` pair, along with
100        `AIRBYTE_CLOUD_WORKSPACE_ID` and `AIRBYTE_CLOUD_ORGANIZATION_ID`.
101        """
102        return cls(workspace_id=workspace_id, organization_id=organization_id)

Create an AgentWorkspace from the AIRBYTE_CLOUD_* environment variables.

The variables used are AIRBYTE_CLOUD_BEARER_TOKEN or the AIRBYTE_CLOUD_CLIENT_ID and AIRBYTE_CLOUD_CLIENT_SECRET pair, along with AIRBYTE_CLOUD_WORKSPACE_ID and AIRBYTE_CLOUD_ORGANIZATION_ID.

def get_info(self) -> airbyte.agents.AgentWorkspaceInfo:
104    def get_info(self) -> AgentWorkspaceInfo:
105        """Fetch this workspace from the Agents API.
106
107        A successful call is authoritative proof that the workspace is reachable through
108        the Agents API with these credentials.
109        """
110        return AgentWorkspaceInfo.model_validate(
111            _api_util.get_agent_workspace(
112                workspace_id=self.workspace_id,
113                credentials=self._credentials,
114                organization_id=self.organization_id,
115            )
116        )

Fetch this workspace from the Agents API.

A successful call is authoritative proof that the workspace is reachable through the Agents API with these credentials.

def list_connectors(self) -> list[airbyte.agents.AgentConnector]:
118    def list_connectors(self) -> list[AgentConnector]:
119        """List the connectors configured in this workspace."""
120        return [
121            AgentConnector(
122                connector_id=info.id,
123                name=info.name,
124                credentials=self._credentials,
125            )
126            for info in (
127                AgentConnectorInfo.model_validate(record)
128                for record in _api_util.list_agent_connectors(
129                    workspace_id=self.workspace_id,
130                    credentials=self._credentials,
131                    organization_id=self.organization_id,
132                )
133            )
134        ]

List the connectors configured in this workspace.

def get_connector( self, id_or_name: str | None = None, /, *, id: str | None = None, connector_id: str | None = None, name: str | None = None) -> airbyte.agents.AgentConnector:
136    def get_connector(
137        self,
138        id_or_name: str | None = None,
139        /,
140        *,
141        id: str | None = None,  # noqa: A002  # Shadows `id` deliberately, as a short alias.
142        connector_id: str | None = None,
143        name: str | None = None,
144    ) -> AgentConnector:
145        """Get a connector in this workspace, by ID or by name.
146
147        Pass a single positional value to look the connector up by either its ID or its
148        name, or name the argument to be explicit: `id` and `connector_id` are synonyms,
149        so pass whichever reads better.
150
151        Lookup by an explicit ID does not call the Agents API. Every other form lists the
152        workspace's connectors and matches on ID first, then on an exact name, then on a
153        unique substring, so `name="GitHub"` finds a connector named
154        `GitHub - <workspace_id>`. Name matching is case-insensitive.
155        """
156        lookup = _resolve_connector_lookup(
157            id_or_name,
158            id=id,
159            connector_id=connector_id,
160            name=name,
161        )
162
163        if lookup.connector_id and not lookup.name:
164            return AgentConnector(connector_id=lookup.connector_id, credentials=self._credentials)
165
166        connectors = self.list_connectors()
167        if lookup.connector_id:
168            id_matches = [
169                connector
170                for connector in connectors
171                if connector.connector_id == lookup.connector_id
172            ]
173            if id_matches:
174                return id_matches[0]
175
176        name_lower = (lookup.name or "").lower()
177        matches = [
178            connector
179            for connector in connectors
180            if connector.name and connector.name.lower() == name_lower
181        ] or [
182            connector
183            for connector in connectors
184            if connector.name and name_lower in connector.name.lower()
185        ]
186        if not matches:
187            raise AirbyteError(
188                message="No connector found with the given ID or name.",
189                guidance="Use `list_connectors()` to see the available connectors.",
190                context={"lookup": lookup.name, "workspace_id": self.workspace_id},
191            )
192        if len(matches) > 1:
193            raise AirbyteError(
194                message="Multiple connectors matched the given name.",
195                guidance="Pass `connector_id`, or a name that matches only one connector.",
196                context={
197                    "name": lookup.name,
198                    "matched_names": [connector.name for connector in matches],
199                },
200            )
201        return matches[0]

Get a connector in this workspace, by ID or by name.

Pass a single positional value to look the connector up by either its ID or its name, or name the argument to be explicit: id and connector_id are synonyms, so pass whichever reads better.

Lookup by an explicit ID does not call the Agents API. Every other form lists the workspace's connectors and matches on ID first, then on an exact name, then on a unique substring, so name="GitHub" finds a connector named GitHub - <workspace_id>. Name matching is case-insensitive.

def as_cloud_workspace(self) -> airbyte.cloud.CloudWorkspace:
203    def as_cloud_workspace(self) -> CloudWorkspace:
204        """Return this workspace as an `airbyte.cloud.CloudWorkspace`.
205
206        Every Agents workspace is also a Cloud workspace, so this conversion always
207        succeeds without calling either API.
208        """
209        return CloudWorkspace(
210            workspace_id=self.workspace_id,
211            client_id=self._credentials.client_id,
212            client_secret=self._credentials.client_secret,
213            bearer_token=self._credentials.bearer_token,
214            api_root=self._credentials.public_api_root,
215            config_api_root=self._credentials.config_api_root,
216        )

Return this workspace as an airbyte.cloud.CloudWorkspace.

Every Agents workspace is also a Cloud workspace, so this conversion always succeeds without calling either API.

@classmethod
def from_cloud_workspace( cls, cloud_workspace: airbyte.cloud.CloudWorkspace, *, organization_id: str | None = None, verify: bool = True) -> AgentWorkspace:
218    @classmethod
219    def from_cloud_workspace(
220        cls,
221        cloud_workspace: CloudWorkspace,
222        *,
223        organization_id: str | None = None,
224        verify: bool = True,
225    ) -> AgentWorkspace:
226        """Return a Cloud workspace as an `AgentWorkspace`.
227
228        Cloud workspace IDs are also Agents workspace IDs, but not every Cloud workspace is
229        reachable through the Agents API: the organization needs an Airbyte Agents
230        subscription. By default this is verified by fetching the workspace from the Agents
231        API, which raises `AirbyteError` when it is not eligible. Pass `verify=False` to
232        skip that call.
233
234        Raises `PyAirbyteInputError` when the Cloud workspace uses non-public Cloud API
235        roots, since an `AgentWorkspace` cannot carry them.
236        """
237        _api_util.check_public_cloud_api_roots(
238            cloud_workspace._credentials,  # noqa: SLF001  # Same-domain conversion.
239        )
240        workspace = cls(
241            workspace_id=cloud_workspace.workspace_id,
242            organization_id=organization_id,
243            client_id=cloud_workspace.client_id,
244            client_secret=cloud_workspace.client_secret,
245            bearer_token=cloud_workspace.bearer_token,
246        )
247        if verify:
248            workspace.get_info()
249        return workspace

Return a Cloud workspace as an AgentWorkspace.

Cloud workspace IDs are also Agents workspace IDs, but not every Cloud workspace is reachable through the Agents API: the organization needs an Airbyte Agents subscription. By default this is verified by fetching the workspace from the Agents API, which raises AirbyteError when it is not eligible. Pass verify=False to skip that call.

Raises PyAirbyteInputError when the Cloud workspace uses non-public Cloud API roots, since an AgentWorkspace cannot carry them.