Datastores#

This page presents all APIs and classes related to Datastores in PyAgentSpec.

Datastore base classes#

Datastore#

class pyagentspec.datastores.Datastore(*, id=<factory>, name, description=None, metadata=<factory>, min_agentspec_version=AgentSpecVersionEnum.v26_2_0, max_agentspec_version=AgentSpecVersionEnum.v26_2_0)#

Bases: Component

Base class for Datastores. Datastores configure how to store and retrieve data.

Parameters:
  • id (str) – A unique identifier for this Component

  • name (str) – Name of this Component

  • description (str | None) – Optional description of this Component

  • metadata (Dict[str, Any] | None) – Optional, additional metadata related to this Component

  • min_agentspec_version (AgentSpecVersionEnum) –

  • max_agentspec_version (AgentSpecVersionEnum) –

RelationalDatastore#

class pyagentspec.datastores.RelationalDatastore(*, id=<factory>, name, description=None, metadata=<factory>, min_agentspec_version=AgentSpecVersionEnum.v26_2_0, max_agentspec_version=AgentSpecVersionEnum.v26_2_0, datastore_schema)#

Bases: Datastore

A relational data store that supports querying data using SQL-like queries. As a consequence, it has a fixed schema.

Parameters:
  • id (str) – A unique identifier for this Component

  • name (str) – Name of this Component

  • description (str | None) – Optional description of this Component

  • metadata (Dict[str, Any] | None) – Optional, additional metadata related to this Component

  • min_agentspec_version (AgentSpecVersionEnum) –

  • max_agentspec_version (AgentSpecVersionEnum) –

  • datastore_schema (Dict[str, Property]) – Mapping of collection names to entity definitions used by this datastore.

datastore_schema: Dict[str, Property]#

Mapping of collection names to entity definitions used by this datastore.

InMemoryCollectionDatastore#

class pyagentspec.datastores.InMemoryCollectionDatastore(*, id=<factory>, name, description=None, metadata=<factory>, min_agentspec_version=AgentSpecVersionEnum.v26_2_0, max_agentspec_version=AgentSpecVersionEnum.v26_2_0, datastore_schema)#

Bases: Datastore

In-memory datastore for testing and development purposes.

Parameters:
  • id (str) – A unique identifier for this Component

  • name (str) – Name of this Component

  • description (str | None) – Optional description of this Component

  • metadata (Dict[str, Any] | None) – Optional, additional metadata related to this Component

  • min_agentspec_version (AgentSpecVersionEnum) –

  • max_agentspec_version (AgentSpecVersionEnum) –

  • datastore_schema (Dict[str, Property]) – Mapping of collection names to entity definitions used by this datastore.

datastore_schema: Dict[str, Property]#

Mapping of collection names to entity definitions used by this datastore.

Oracle datastore#

OracleDatabaseDatastore#

class pyagentspec.datastores.oracle.OracleDatabaseDatastore(*, id=<factory>, name, description=None, metadata=<factory>, min_agentspec_version=AgentSpecVersionEnum.v26_2_0, max_agentspec_version=AgentSpecVersionEnum.v26_2_0, datastore_schema, connection_config)#

Bases: RelationalDatastore

Datastore that uses Oracle Database as the storage mechanism.

Parameters:
  • id (str) – A unique identifier for this Component

  • name (str) – Name of this Component

  • description (str | None) – Optional description of this Component

  • metadata (Dict[str, Any] | None) – Optional, additional metadata related to this Component

  • min_agentspec_version (AgentSpecVersionEnum) –

  • max_agentspec_version (AgentSpecVersionEnum) –

  • datastore_schema (Dict[str, Property]) – Mapping of collection names to entity definitions used by this datastore.

  • connection_config (OracleDatabaseConnectionConfig) –

connection_config: OracleDatabaseConnectionConfig#

OracleDatabaseConnectionConfig#

class pyagentspec.datastores.oracle.OracleDatabaseConnectionConfig(*, id=<factory>, name, description=None, metadata=<factory>, min_agentspec_version=AgentSpecVersionEnum.v26_2_0, max_agentspec_version=AgentSpecVersionEnum.v26_2_0)#

Bases: Component

Base class used for configuring connections to Oracle Database.

Parameters:
  • id (str) – A unique identifier for this Component

  • name (str) – Name of this Component

  • description (str | None) – Optional description of this Component

  • metadata (Dict[str, Any] | None) – Optional, additional metadata related to this Component

  • min_agentspec_version (AgentSpecVersionEnum) –

  • max_agentspec_version (AgentSpecVersionEnum) –

TlsOracleDatabaseConnectionConfig#

class pyagentspec.datastores.oracle.TlsOracleDatabaseConnectionConfig(*, id=<factory>, name, description=None, metadata=<factory>, min_agentspec_version=AgentSpecVersionEnum.v26_2_0, max_agentspec_version=AgentSpecVersionEnum.v26_2_0, user, password, dsn, config_dir=None, protocol='tcps')#

Bases: OracleDatabaseConnectionConfig

TLS Connection Configuration to Oracle Database.

Parameters:
  • id (str) – A unique identifier for this Component

  • name (str) – Name of this Component

  • description (str | None) – Optional description of this Component

  • metadata (Dict[str, Any] | None) – Optional, additional metadata related to this Component

  • min_agentspec_version (AgentSpecVersionEnum) –

  • max_agentspec_version (AgentSpecVersionEnum) –

  • user (str) – User used to connect to the database

  • password (str) – Password for the provided user

  • dsn (str) – Connection string for the database (e.g., created using oracledb.make_dsn)

  • config_dir (str | None) – Configuration directory for the database connection. Set this if you are using an alias from your tnsnames.ora files as a DSN. Make sure that the specified DSN is appropriate for TLS connections (as the tnsnames.ora file in a downloaded wallet will only include DSN entries for mTLS connections)

  • protocol (Literal['tcp', 'tcps']) – ‘tcp’ or ‘tcps’ indicating whether to use unencrypted network traffic or encrypted network traffic (TLS)

config_dir: str | None#

Configuration directory for the database connection. Set this if you are using an alias from your tnsnames.ora files as a DSN. Make sure that the specified DSN is appropriate for TLS connections (as the tnsnames.ora file in a downloaded wallet will only include DSN entries for mTLS connections)

dsn: str#

Connection string for the database (e.g., created using oracledb.make_dsn)

password: str#

Password for the provided user

protocol: Literal['tcp', 'tcps']#

‘tcp’ or ‘tcps’ indicating whether to use unencrypted network traffic or encrypted network traffic (TLS)

user: str#

User used to connect to the database

MTlsOracleDatabaseConnectionConfig#

class pyagentspec.datastores.oracle.MTlsOracleDatabaseConnectionConfig(*, id=<factory>, name, description=None, metadata=<factory>, min_agentspec_version=AgentSpecVersionEnum.v26_2_0, max_agentspec_version=AgentSpecVersionEnum.v26_2_0, user, password, dsn, config_dir=None, protocol='tcps', wallet_location, wallet_password)#

Bases: TlsOracleDatabaseConnectionConfig

Mutual-TLS Connection Configuration to Oracle Database.

Parameters:
  • id (str) – A unique identifier for this Component

  • name (str) – Name of this Component

  • description (str | None) – Optional description of this Component

  • metadata (Dict[str, Any] | None) – Optional, additional metadata related to this Component

  • min_agentspec_version (AgentSpecVersionEnum) –

  • max_agentspec_version (AgentSpecVersionEnum) –

  • user (str) – User used to connect to the database

  • password (str) – Password for the provided wallet.

  • dsn (str) – Connection string for the database (e.g., created using oracledb.make_dsn)

  • config_dir (str | None) – Configuration directory for the database connection. Set this if you are using an alias from your tnsnames.ora files as a DSN. Make sure that the specified DSN is appropriate for TLS connections (as the tnsnames.ora file in a downloaded wallet will only include DSN entries for mTLS connections)

  • protocol (Literal['tcp', 'tcps']) – ‘tcp’ or ‘tcps’ indicating whether to use unencrypted network traffic or encrypted network traffic (TLS)

  • wallet_location (str) – Location where the Oracle Database wallet is stored.

  • wallet_password (str) – Password for the provided wallet.

wallet_location: str#

Location where the Oracle Database wallet is stored.

wallet_password: str#

Password for the provided wallet.

PostgreSQL datastore#

PostgresDatabaseDatastore#

class pyagentspec.datastores.postgres.PostgresDatabaseDatastore(*, id=<factory>, name, description=None, metadata=<factory>, min_agentspec_version=AgentSpecVersionEnum.v26_2_0, max_agentspec_version=AgentSpecVersionEnum.v26_2_0, datastore_schema, connection_config)#

Bases: RelationalDatastore

Datastore that uses PostgreSQL Database as the storage mechanism.

Parameters:
  • id (str) – A unique identifier for this Component

  • name (str) – Name of this Component

  • description (str | None) – Optional description of this Component

  • metadata (Dict[str, Any] | None) – Optional, additional metadata related to this Component

  • min_agentspec_version (AgentSpecVersionEnum) –

  • max_agentspec_version (AgentSpecVersionEnum) –

  • datastore_schema (Dict[str, Property]) – Mapping of collection names to entity definitions used by this datastore.

  • connection_config (PostgresDatabaseConnectionConfig) –

connection_config: PostgresDatabaseConnectionConfig#

PostgresDatabaseConnectionConfig#

class pyagentspec.datastores.postgres.PostgresDatabaseConnectionConfig(*, id=<factory>, name, description=None, metadata=<factory>, min_agentspec_version=AgentSpecVersionEnum.v26_2_0, max_agentspec_version=AgentSpecVersionEnum.v26_2_0)#

Bases: Component

Base class for a PostgreSQL connection.

Parameters:
  • id (str) – A unique identifier for this Component

  • name (str) – Name of this Component

  • description (str | None) – Optional description of this Component

  • metadata (Dict[str, Any] | None) – Optional, additional metadata related to this Component

  • min_agentspec_version (AgentSpecVersionEnum) –

  • max_agentspec_version (AgentSpecVersionEnum) –

TlsPostgresDatabaseConnectionConfig#

class pyagentspec.datastores.postgres.TlsPostgresDatabaseConnectionConfig(*, id=<factory>, name, description=None, metadata=<factory>, min_agentspec_version=AgentSpecVersionEnum.v26_2_0, max_agentspec_version=AgentSpecVersionEnum.v26_2_0, user, password, url, sslmode='require', sslcert=None, sslkey=None, sslrootcert=None, sslcrl=None)#

Bases: PostgresDatabaseConnectionConfig

Configuration for a PostgreSQL connection with TLS/SSL support.

Parameters:
  • id (str) – A unique identifier for this Component

  • name (str) – Name of this Component

  • description (str | None) – Optional description of this Component

  • metadata (Dict[str, Any] | None) – Optional, additional metadata related to this Component

  • min_agentspec_version (AgentSpecVersionEnum) –

  • max_agentspec_version (AgentSpecVersionEnum) –

  • user (str) – User of the postgres database

  • password (str) – Password of the postgres database

  • url (str) – URL to access the postgres database

  • sslmode (Literal['disable', 'allow', 'prefer', 'require', 'verify-ca', 'verify-full']) –

  • sslcert (str | None) – Path of the client SSL certificate, replacing the default ~/.postgresql/postgresql.crt. Ignored if an SSL connection is not made.

  • sslkey (str | None) – Path of the file containing the secret key used for the client certificate, replacing the default ~/.postgresql/postgresql.key. Ignored if an SSL connection is not made.

  • sslrootcert (str | None) – Path of the file containing SSL certificate authority (CA) certificate(s). Used to verify server identity.

  • sslcrl (str | None) – Path of the SSL server certificate revocation list (CRL). Certificates listed will be rejected while attempting to authenticate the server’s certificate.

password: str#

Password of the postgres database

sslcert: str | None#

Path of the client SSL certificate, replacing the default ~/.postgresql/postgresql.crt. Ignored if an SSL connection is not made.

sslcrl: str | None#

Path of the SSL server certificate revocation list (CRL). Certificates listed will be rejected while attempting to authenticate the server’s certificate.

sslkey: str | None#

Path of the file containing the secret key used for the client certificate, replacing the default ~/.postgresql/postgresql.key. Ignored if an SSL connection is not made.

sslmode: Literal['disable', 'allow', 'prefer', 'require', 'verify-ca', 'verify-full']#

SSL mode for the PostgreSQL connection.

sslrootcert: str | None#

Path of the file containing SSL certificate authority (CA) certificate(s). Used to verify server identity.

url: str#

URL to access the postgres database

user: str#

User of the postgres database