aip_sdk.MetricConfig
aip_sdk.MetricConfig(*, id: str, workspace_id: str, config_name: str, config_version: str, metric_ref: MetricRef, params: dict[str, Any], prompts: dict[str, PromptConfig], created_by: str | None, created_at: datetime | None, updated_at: datetime | None, usage_count: int, client: APIClient, workspace_default_version: str | None = None)
A stored, versioned metric configuration.
Created once per (config_name, config_version). Editable via update() only
until a run pins this exact version — after that, create a new config_version
instead, so a run's score provenance never changes retroactively. There is no exception:
no version, name or scope stays overwritable once a run has pinned it.
Attributes
idstr: Row id.workspace_idstr: Owning workspace.config_namestr: Configuration name.config_versionstr: Version of this named configuration.metric_ref: The metric implementation this config parameterizes — aMetricRef, not a metric name string.paramsdict[str, Any]: Non-prompt parameters. Read at scoring time for every metric type.promptsdict[str, PromptConfig]: Named Jinja2 prompt templates, keyed by slot name. SeePromptConfig— only agentic trace metrics read this back at scoring time today.created_bystr | None: User id that created this config, if known.created_atdatetime | None: When this config version was created.updated_atdatetime | None: When this row was last modified.usage_countint: Number of runs whose scoring snapshot pins this row — seeMetricConfigSummary.usage_count.workspace_default_versionstr | None: SeeMetricConfigSummary.workspace_default_version.
Equality and hashing are on identity — (workspace_id, config_name, config_version)
— the same three fields a run pins by, not on params/prompts. Two objects for
the same stored row compare equal even if one reflects an older or newer revision (e.g.
one fetched before and one returned by .update()) — this answers "is this the same
row" and never "does this carry the same payload." id/workspace_id/
config_name/config_version are read-only for exactly this reason: reassigning
one after construction would silently change what the object hashes as.
params/prompts are a local snapshot, not a live view — read or reassign them
wholesale, but mutating either in place does not persist; call update() to write
a change back.
aip_sdk.MetricConfig.config_name
aip_sdk.MetricConfig.config_name: str
Configuration name.
aip_sdk.MetricConfig.config_version
aip_sdk.MetricConfig.config_version: str
Version of this named configuration.
aip_sdk.MetricConfig.created_at
aip_sdk.MetricConfig.created_at: datetime | None = created_at
No docstring is defined in the source.
aip_sdk.MetricConfig.created_by
aip_sdk.MetricConfig.created_by: str | None = created_by
No docstring is defined in the source.
aip_sdk.MetricConfig.delete
aip_sdk.MetricConfig.delete() -> None
Delete this config outright.
There is no soft-delete tier and no restore: once this call succeeds, the row is
gone and its (config_name, config_version) key is immediately free to reuse.
Refused (409) while any run's scoring snapshot still pins this config — removing
it would erase that run's only record of what scored it — the same protection
update() gives a pinned config, extended to removal. Check
usage_count beforehand to see whether a delete would currently be refused
(advisory only — this call re-checks at write time regardless).
Raises
MetricConfigNotFoundError: If this config no longer exists.MetricConfigReferencedByRunsError: If a run has already pinned this config — carriesusage_count.ForbiddenError: If the caller lacks a write-capable role for this config's scope.AuthError: If credentials are missing or invalid.APIError: If the deletion otherwise fails.
aip_sdk.MetricConfig.id
aip_sdk.MetricConfig.id: str
Row id.
aip_sdk.MetricConfig.metric_ref
aip_sdk.MetricConfig.metric_ref = metric_ref
No docstring is defined in the source.
aip_sdk.MetricConfig.override
aip_sdk.MetricConfig.override(*, metric_ref: MetricRef | None = None, params: dict[str, Any] | None = None, prompts: dict[str, PromptConfig] | None = None) -> MetricConfig
Create the next config_version of this config name, server-assigned.
Unlike update(), which mutates this exact row in place, override always
inserts a new row — the version is never caller-supplied or computed client-side,
so no caller can guess or collide on it. Omitted fields carry over from this
config's current payload.
Not idempotent — see override_metric_config()'s docstring for why a repeat
call (including one from the transport's own automatic retry) creates another
version rather than being a safe no-op.
Parameters
metric_refMetricRef | None: Metric reference for the new version; defaults to this config's.paramsdict[str, Any] | None: Non-prompt parameters for the new version; defaults to this config's.promptsdict[str, PromptConfig] | None: Prompt templates for the new version; defaults to this config's.
Returns
MetricConfigMetricConfig: the newly created version.
Raises
MetricConfigOverrideConflictError: Concurrent overrides of this config name kept colliding (retry — checkretryable, don't parse the message), orconfig_nameis already bound to a different metric in this workspace (use a different name; not retryable).MetricConfigValidationError: Existing versions of this config name exist but none parses as a numeric version to increment.NotFoundError: This workspace does not exist.ForbiddenError: The caller lacks a write-capable role in this workspace.AuthError: Credentials are missing or invalid.APIError: The request otherwise fails, or the response is malformed.
aip_sdk.MetricConfig.params
aip_sdk.MetricConfig.params: dict[str, Any] = dict(params)
No docstring is defined in the source.
aip_sdk.MetricConfig.prompts
aip_sdk.MetricConfig.prompts: dict[str, PromptConfig] = dict(prompts)
No docstring is defined in the source.
aip_sdk.MetricConfig.update
aip_sdk.MetricConfig.update(*, metric_ref: MetricRef | None = None, params: dict[str, Any] | None = None, prompts: dict[str, PromptConfig] | None = None) -> MetricConfig
Replace this config's stored payload.
Only the fields you pass are changed; omit a field to leave it as-is. Pass
params={} or prompts={} to clear one — an empty mapping is a meaningful
value, distinct from omitting the argument. Identity (config_name,
config_version) and workspace_id cannot be changed this way.
Parameters
metric_refMetricRef | None: New metric reference to parameterize.paramsdict[str, Any] | None: New non-prompt parameters (replaces the stored mapping wholesale).promptsdict[str, PromptConfig] | None: New prompt templates, keyed by slot name (replaces wholesale). SeePromptConfigfor which metrics read this back at scoring time.
Returns
MetricConfigMetricConfig: a new object reflecting the update. This instance's ownMetricConfig: attributes are left unchanged — reassign the return value to keep using it:MetricConfig:config = config.update(...).
Raises
MetricConfigNotFoundError: If this config no longer exists.MetricConfigReferencedByRunsError: If a run has already pinned this exact version — create a newconfig_versioninstead of editing this one.MetricConfigValidationError: If the merged document fails server-side validation.ForbiddenError: If the caller lacks a write-capable role for this config's scope.AuthError: If credentials are missing or invalid.APIError: If the update otherwise fails, or the response is malformed.
aip_sdk.MetricConfig.updated_at
aip_sdk.MetricConfig.updated_at: datetime | None = updated_at
No docstring is defined in the source.
aip_sdk.MetricConfig.usage_count
aip_sdk.MetricConfig.usage_count: int = usage_count
No docstring is defined in the source.
aip_sdk.MetricConfig.workspace_default_version
aip_sdk.MetricConfig.workspace_default_version: str | None = workspace_default_version
No docstring is defined in the source.
aip_sdk.MetricConfig.workspace_id
aip_sdk.MetricConfig.workspace_id: str
Owning workspace.