airbyte.agents.models
Response models for the Airbyte Agents API.
⚠️ 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.
All models allow extra fields, because the Agents API returns rich connector-specific payloads that PyAirbyte deliberately does not attempt to model exhaustively.
1# Copyright (c) 2026 Airbyte, Inc., all rights reserved. 2"""Response models for the Airbyte Agents API. 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 10All models allow extra fields, because the Agents API returns rich connector-specific 11payloads that PyAirbyte deliberately does not attempt to model exhaustively. 12""" 13 14from __future__ import annotations 15 16from typing import Any 17 18from pydantic import BaseModel, ConfigDict, Field 19 20from airbyte.exceptions import PyAirbyteInputError 21 22 23class AgentWorkspaceInfo(BaseModel): 24 """Summary information about a workspace, as returned by the Agents API.""" 25 26 model_config = ConfigDict(extra="allow") 27 28 id: str 29 """The workspace ID.""" 30 31 name: str | None = None 32 """The workspace name.""" 33 34 organization_id: str | None = None 35 """The ID of the organization the workspace belongs to.""" 36 37 status: str | None = None 38 """The workspace status, for example `active`.""" 39 40 41class AgentConnectorInfo(BaseModel): 42 """Summary information about a connector, as returned by the Agents API.""" 43 44 model_config = ConfigDict(extra="allow") 45 46 id: str 47 """The connector ID.""" 48 49 name: str | None = None 50 """The connector name, for example `GitHub - <workspace_id>`.""" 51 52 53class AgentContextStoreEntity(BaseModel): 54 """An entity that a connector supports caching in the Airbyte Context Store.""" 55 56 model_config = ConfigDict(extra="allow") 57 58 entity: str 59 """The entity name, for example `issues`.""" 60 61 suggested: bool | None = None 62 """Whether Airbyte suggests caching this entity.""" 63 64 65class AgentContextStoreReadiness(BaseModel): 66 """Context Store readiness information for a connector.""" 67 68 model_config = ConfigDict(extra="allow") 69 70 supported_context_store_entities: list[AgentContextStoreEntity] = Field(default_factory=list) 71 """The entities this connector can cache in the Context Store.""" 72 73 configured_cache_entities: list[dict[str, Any]] = Field(default_factory=list) 74 """The entities currently configured for caching, with their sync status.""" 75 76 77class AgentConnectorDetails(BaseModel): 78 """Connector metadata returned by the Agents API `inspect` endpoint.""" 79 80 model_config = ConfigDict(extra="allow") 81 82 connector_id: str 83 """The connector ID.""" 84 85 name: str | None = None 86 """The connector name.""" 87 88 workspace_id: str | None = None 89 """The ID of the workspace the connector belongs to.""" 90 91 organization_id: str | None = None 92 """The ID of the organization the connector belongs to.""" 93 94 source_definition_id: str | None = None 95 """The ID of the underlying Airbyte source definition.""" 96 97 source_definition_name: str | None = None 98 """The name of the underlying Airbyte source definition, for example `GitHub`.""" 99 100 context_store_readiness: AgentContextStoreReadiness | None = None 101 """Context Store readiness information, when reported.""" 102 103 warnings: list[Any] = Field(default_factory=list) 104 """Warnings reported by the Agents API, for example degraded capabilities.""" 105 106 @property 107 def context_store_entities(self) -> list[str]: 108 """The entity names this connector can cache in the Context Store. 109 110 Note that this lists Context Store-supported entities specifically. The Agents API 111 does not publish an exhaustive list of executable entity and action pairs, so an 112 entity may be executable via `AgentConnector.execute()` without appearing here. 113 """ 114 if self.context_store_readiness is None: 115 return [] 116 return [ 117 entity.entity 118 for entity in self.context_store_readiness.supported_context_store_entities 119 ] 120 121 122class AgentExecutionMetadata(BaseModel): 123 """Metadata describing how an Agents connector action was executed.""" 124 125 model_config = ConfigDict(extra="allow") 126 127 connector_instance_id: str | None = None 128 """The connector instance that served the request.""" 129 130 execution_time_ms: int | None = None 131 """The server-side execution time, in milliseconds.""" 132 133 134class AgentConnectorMetadata(BaseModel): 135 """Connector-reported metadata about a single action's result, including pagination.""" 136 137 model_config = ConfigDict(extra="allow") 138 139 has_next_page: bool | None = None 140 """Whether more entities are available after this page, when the connector reports it.""" 141 142 end_cursor: str | None = None 143 """The cursor to pass as `cursor` to fetch the next page, when one is available.""" 144 145 146class AgentExecuteResult(BaseModel): 147 """The result of executing a single action against an Airbyte Agents connector.""" 148 149 model_config = ConfigDict(extra="allow") 150 151 status: str 152 """The execution status reported by the Agents API, for example `success`.""" 153 154 result: Any = None 155 """The action's payload. Entity-returning actions put a list of entities here.""" 156 157 connector_metadata: AgentConnectorMetadata = Field(default_factory=AgentConnectorMetadata) 158 """Connector-reported metadata about the result, including pagination cursors.""" 159 160 execution_metadata: AgentExecutionMetadata = Field(default_factory=AgentExecutionMetadata) 161 """Metadata describing how the action was executed.""" 162 163 warning: dict[str, Any] | None = None 164 """A warning reported alongside an otherwise successful result.""" 165 166 @property 167 def entities(self) -> list[dict[str, Any]]: 168 """The result as a list of entities. 169 170 Raises `PyAirbyteInputError` if the action did not return a list of entities. Use 171 `result` for actions whose payload is not a list of entities. 172 """ 173 if not isinstance(self.result, list): 174 raise PyAirbyteInputError( 175 message="This action did not return a list of entities.", 176 guidance="Use the `result` attribute to read non-entity result payloads.", 177 context={"result_type": type(self.result).__name__}, 178 ) 179 180 invalid_types = sorted( 181 {type(entity).__name__ for entity in self.result if not isinstance(entity, dict)} 182 ) 183 if invalid_types: 184 raise PyAirbyteInputError( 185 message="This action returned a list that is not a list of entities.", 186 guidance="Use the `result` attribute to read non-entity result payloads.", 187 context={"unexpected_item_types": invalid_types}, 188 ) 189 return self.result 190 191 @property 192 def has_next_page(self) -> bool: 193 """Whether the connector reported more entities after this page.""" 194 return bool(self.connector_metadata.has_next_page) 195 196 @property 197 def end_cursor(self) -> str | None: 198 """The cursor for the next page, or `None` when there is no next page.""" 199 return self.connector_metadata.end_cursor
24class AgentWorkspaceInfo(BaseModel): 25 """Summary information about a workspace, as returned by the Agents API.""" 26 27 model_config = ConfigDict(extra="allow") 28 29 id: str 30 """The workspace ID.""" 31 32 name: str | None = None 33 """The workspace name.""" 34 35 organization_id: str | None = None 36 """The ID of the organization the workspace belongs to.""" 37 38 status: str | None = None 39 """The workspace status, for example `active`."""
Summary information about a workspace, as returned by the Agents API.
42class AgentConnectorInfo(BaseModel): 43 """Summary information about a connector, as returned by the Agents API.""" 44 45 model_config = ConfigDict(extra="allow") 46 47 id: str 48 """The connector ID.""" 49 50 name: str | None = None 51 """The connector name, for example `GitHub - <workspace_id>`."""
Summary information about a connector, as returned by the Agents API.
54class AgentContextStoreEntity(BaseModel): 55 """An entity that a connector supports caching in the Airbyte Context Store.""" 56 57 model_config = ConfigDict(extra="allow") 58 59 entity: str 60 """The entity name, for example `issues`.""" 61 62 suggested: bool | None = None 63 """Whether Airbyte suggests caching this entity."""
An entity that a connector supports caching in the Airbyte Context Store.
66class AgentContextStoreReadiness(BaseModel): 67 """Context Store readiness information for a connector.""" 68 69 model_config = ConfigDict(extra="allow") 70 71 supported_context_store_entities: list[AgentContextStoreEntity] = Field(default_factory=list) 72 """The entities this connector can cache in the Context Store.""" 73 74 configured_cache_entities: list[dict[str, Any]] = Field(default_factory=list) 75 """The entities currently configured for caching, with their sync status."""
Context Store readiness information for a connector.
78class AgentConnectorDetails(BaseModel): 79 """Connector metadata returned by the Agents API `inspect` endpoint.""" 80 81 model_config = ConfigDict(extra="allow") 82 83 connector_id: str 84 """The connector ID.""" 85 86 name: str | None = None 87 """The connector name.""" 88 89 workspace_id: str | None = None 90 """The ID of the workspace the connector belongs to.""" 91 92 organization_id: str | None = None 93 """The ID of the organization the connector belongs to.""" 94 95 source_definition_id: str | None = None 96 """The ID of the underlying Airbyte source definition.""" 97 98 source_definition_name: str | None = None 99 """The name of the underlying Airbyte source definition, for example `GitHub`.""" 100 101 context_store_readiness: AgentContextStoreReadiness | None = None 102 """Context Store readiness information, when reported.""" 103 104 warnings: list[Any] = Field(default_factory=list) 105 """Warnings reported by the Agents API, for example degraded capabilities.""" 106 107 @property 108 def context_store_entities(self) -> list[str]: 109 """The entity names this connector can cache in the Context Store. 110 111 Note that this lists Context Store-supported entities specifically. The Agents API 112 does not publish an exhaustive list of executable entity and action pairs, so an 113 entity may be executable via `AgentConnector.execute()` without appearing here. 114 """ 115 if self.context_store_readiness is None: 116 return [] 117 return [ 118 entity.entity 119 for entity in self.context_store_readiness.supported_context_store_entities 120 ]
Connector metadata returned by the Agents API inspect endpoint.
The name of the underlying Airbyte source definition, for example GitHub.
Warnings reported by the Agents API, for example degraded capabilities.
107 @property 108 def context_store_entities(self) -> list[str]: 109 """The entity names this connector can cache in the Context Store. 110 111 Note that this lists Context Store-supported entities specifically. The Agents API 112 does not publish an exhaustive list of executable entity and action pairs, so an 113 entity may be executable via `AgentConnector.execute()` without appearing here. 114 """ 115 if self.context_store_readiness is None: 116 return [] 117 return [ 118 entity.entity 119 for entity in self.context_store_readiness.supported_context_store_entities 120 ]
The entity names this connector can cache in the Context Store.
Note that this lists Context Store-supported entities specifically. The Agents API
does not publish an exhaustive list of executable entity and action pairs, so an
entity may be executable via AgentConnector.execute() without appearing here.
123class AgentExecutionMetadata(BaseModel): 124 """Metadata describing how an Agents connector action was executed.""" 125 126 model_config = ConfigDict(extra="allow") 127 128 connector_instance_id: str | None = None 129 """The connector instance that served the request.""" 130 131 execution_time_ms: int | None = None 132 """The server-side execution time, in milliseconds."""
Metadata describing how an Agents connector action was executed.
135class AgentConnectorMetadata(BaseModel): 136 """Connector-reported metadata about a single action's result, including pagination.""" 137 138 model_config = ConfigDict(extra="allow") 139 140 has_next_page: bool | None = None 141 """Whether more entities are available after this page, when the connector reports it.""" 142 143 end_cursor: str | None = None 144 """The cursor to pass as `cursor` to fetch the next page, when one is available."""
Connector-reported metadata about a single action's result, including pagination.
147class AgentExecuteResult(BaseModel): 148 """The result of executing a single action against an Airbyte Agents connector.""" 149 150 model_config = ConfigDict(extra="allow") 151 152 status: str 153 """The execution status reported by the Agents API, for example `success`.""" 154 155 result: Any = None 156 """The action's payload. Entity-returning actions put a list of entities here.""" 157 158 connector_metadata: AgentConnectorMetadata = Field(default_factory=AgentConnectorMetadata) 159 """Connector-reported metadata about the result, including pagination cursors.""" 160 161 execution_metadata: AgentExecutionMetadata = Field(default_factory=AgentExecutionMetadata) 162 """Metadata describing how the action was executed.""" 163 164 warning: dict[str, Any] | None = None 165 """A warning reported alongside an otherwise successful result.""" 166 167 @property 168 def entities(self) -> list[dict[str, Any]]: 169 """The result as a list of entities. 170 171 Raises `PyAirbyteInputError` if the action did not return a list of entities. Use 172 `result` for actions whose payload is not a list of entities. 173 """ 174 if not isinstance(self.result, list): 175 raise PyAirbyteInputError( 176 message="This action did not return a list of entities.", 177 guidance="Use the `result` attribute to read non-entity result payloads.", 178 context={"result_type": type(self.result).__name__}, 179 ) 180 181 invalid_types = sorted( 182 {type(entity).__name__ for entity in self.result if not isinstance(entity, dict)} 183 ) 184 if invalid_types: 185 raise PyAirbyteInputError( 186 message="This action returned a list that is not a list of entities.", 187 guidance="Use the `result` attribute to read non-entity result payloads.", 188 context={"unexpected_item_types": invalid_types}, 189 ) 190 return self.result 191 192 @property 193 def has_next_page(self) -> bool: 194 """Whether the connector reported more entities after this page.""" 195 return bool(self.connector_metadata.has_next_page) 196 197 @property 198 def end_cursor(self) -> str | None: 199 """The cursor for the next page, or `None` when there is no next page.""" 200 return self.connector_metadata.end_cursor
The result of executing a single action against an Airbyte Agents connector.
The execution status reported by the Agents API, for example success.
A warning reported alongside an otherwise successful result.
167 @property 168 def entities(self) -> list[dict[str, Any]]: 169 """The result as a list of entities. 170 171 Raises `PyAirbyteInputError` if the action did not return a list of entities. Use 172 `result` for actions whose payload is not a list of entities. 173 """ 174 if not isinstance(self.result, list): 175 raise PyAirbyteInputError( 176 message="This action did not return a list of entities.", 177 guidance="Use the `result` attribute to read non-entity result payloads.", 178 context={"result_type": type(self.result).__name__}, 179 ) 180 181 invalid_types = sorted( 182 {type(entity).__name__ for entity in self.result if not isinstance(entity, dict)} 183 ) 184 if invalid_types: 185 raise PyAirbyteInputError( 186 message="This action returned a list that is not a list of entities.", 187 guidance="Use the `result` attribute to read non-entity result payloads.", 188 context={"unexpected_item_types": invalid_types}, 189 ) 190 return self.result
The result as a list of entities.
Raises PyAirbyteInputError if the action did not return a list of entities. Use
result for actions whose payload is not a list of entities.