Class wandb.Api
method Api.artifact()
Returns a single artifact.Arguments
str
The artifact’s name. The name of an artifact resembles a filepath that consists, at a minimum, the name of the project the artifact was logged to, the name of the artifact, and the artifact’s version or alias. Optionally append the entity that logged the artifact as a prefix followed by a forward slash. If no entity is specified in the name, the Run or API setting’s entity is used.
str | None
The type of artifact to fetch.
Returns
AnArtifact object.
Raises
If the artifact name is not specified.
If the artifact type is specified but does not match the type of the fetched artifact.
Examples
In the following code snippets “entity”, “project”, “artifact”, “version”, and “alias” are placeholders for your W&B entity, name of the project the artifact is in, the name of the artifact, and artifact’s version, respectively.method Api.artifact_collection()
Returns a single artifact collection by type. You can use the returnedArtifactCollection object to retrieve
information about specific artifacts in that collection, and more.
Arguments
str
The type of artifact collection to fetch.
str
An artifact collection name. Optionally append the entity that logged the artifact as a prefix followed by a forward slash.
Returns
AnArtifactCollection object.
Examples
In the proceeding code snippet “type”, “entity”, “project”, and “artifact_name” are placeholders for the collection type, your W&B entity, name of the project the artifact is in, and the name of the artifact, respectively.method Api.artifact_collection_exists()
Whether an artifact collection exists within a specified project and entity.Arguments
str
An artifact collection name. Optionally append the entity that logged the artifact as a prefix followed by a forward slash. If entity or project is not specified, infer the collection from the override params if they exist. Otherwise, entity is pulled from the user settings and project will default to “uncategorized”.
str
The type of artifact collection.
Returns
True if the artifact collection exists, False otherwise.Examples
In the proceeding code snippet “type”, and “collection_name” refer to the type of the artifact collection and the name of the collection, respectively.method Api.artifact_collections()
Returns a collection of matching artifact collections.Arguments
str
The name of the project to filter on.
str
The name of the artifact type to filter on.
str | None
Optional string to specify the order of the results. If prefixed with ’+’, sorts ascending (default). If prefixed with ’-’, sorts descending.
int
Sets the page size for query pagination. Usually there is no reason to change this.
str | None
Pagination cursor for resuming a past query, captured from a previous paginator’s
.cursor attribute.Returns
An iterableArtifactCollections object.
method Api.artifact_exists()
Whether an artifact version exists within the specified project and entity.Arguments
str
The name of artifact. Add the artifact’s entity and project as a prefix. Append the version or the alias of the artifact with a colon. If the entity or project is not specified, W&B uses override parameters if populated. Otherwise, the entity is pulled from the user settings and the project is set to “Uncategorized”.
str | None
The type of artifact.
Returns
True if the artifact version exists, False otherwise.Examples
In the proceeding code snippets “entity”, “project”, “artifact”, “version”, and “alias” are placeholders for your W&B entity, name of the project the artifact is in, the name of the artifact, and artifact’s version, respectively.method Api.artifact_type()
Returns the matchingArtifactType.
Arguments
str
The name of the artifact type to retrieve.
str | None
If given, a project name or path to filter on.
Returns
AnArtifactType object.
method Api.artifact_types()
Returns a collection of matching artifact types.Arguments
str | None
The project name or path to filter on.
str | None
Pagination cursor for resuming a past query, captured from a previous paginator’s
.cursor attribute.Returns
An iterableArtifactTypes object.
method Api.artifact_versions()
Deprecated. UseApi.artifacts(type_name, name) method instead.
Arguments
method Api.artifacts()
Return anArtifacts collection.
Arguments
str
The type of artifacts to fetch.
str
The artifact’s collection name. Optionally append the entity that logged the artifact as a prefix followed by a forward slash.
str | None
Optional string to specify the order of the results. If prefixed with ’+’, sorts ascending (default). If prefixed with ’-’, sorts descending.
int
Sets the page size for query pagination. Usually there is no reason to change this.
list[str] | None
Only return artifacts with all of these tags.
str | None
Pagination cursor for resuming a past query, captured from a previous paginator’s
.cursor attribute.Returns
An iterableArtifacts object.
Examples
In the proceeding code snippet, “type”, “entity”, “project”, and “artifact_name” are placeholders for the artifact type, W&B entity, name of the project the artifact was logged to, and the name of the artifact, respectively..cursor and passing it as start=:
method Api.automation()
Returns the only Automation matching the parameters.Arguments
str
The name of the automation to fetch.
str | None
The entity to fetch the automation for.
Raises
If zero or multiple Automations match the search criteria.
Examples
Get an existing automation named “my-automation”:method Api.automations()
Returns an iterator over all Automations that match the given parameters. If no parameters are provided, the returned iterator will contain all Automations that the user has access to.Arguments
str | None
The entity to fetch the automations for.
str | None
The name of the automation to fetch.
int
The number of automations to fetch per page. Defaults to 50. Usually there is no reason to change this.
str | None
Pagination cursor for resuming a past query, captured from a previous paginator’s
.cursor attribute.Returns
A list of automations.Examples
Fetch all existing automations for the entity “my-team”:method Api.create_automation()
Create a new Automation.Arguments
NewAutomation
The automation to create.
bool
If True, and a conflicting automation already exists, attempt to fetch the existing automation instead of raising an error.
Unpack[WriteAutomationsKwargs]
Returns
The saved Automation.Examples
Create a new automation named “my-automation” that sends a Slack notification when a run within a specific project logs a metric exceeding a custom threshold:method Api.create_custom_chart()
Create a custom chart preset and return its id.Arguments
str
The entity (user or team) that owns the chart
str
Unique identifier for the chart preset
str
Human-readable name shown in the UI
Literal['vega2']
Type of specification. Must be “vega2” for Vega-Lite v2 specifications.
Literal['private', 'public']
Access level for the chart:
- “private”: Chart is only accessible to the entity that created it
- “public”: Chart is publicly accessible
str | dict
The Vega/Vega-Lite specification as a dictionary or JSON string
Returns
The ID of the created chart preset in the format “entity/name”Raises
If chart creation fails
If the server doesn’t support custom charts
Examples
method Api.create_project()
Create a new project.Arguments
str
The name of the new project.
str
The entity of the new project.
method Api.create_registry()
Create a new registry.Arguments
str
The name of the registry. Name must be unique within the organization.
Literal['organization', 'restricted']
The visibility of the registry. organization: Anyone in the organization can view this registry. You can edit their roles later from the settings in the UI. restricted: Only invited members via the UI can access this registry. Public sharing is disabled.
str | None
The organization of the registry. If no organization is set in the settings, the organization will be fetched from the entity if the entity only belongs to one organization.
str | None
The description of the registry.
list[str] | None
The accepted artifact types of the registry. A type is no more than 128 characters and do not include characters
/ or :. If not specified, all types are accepted. Allowed types added to the registry cannot be removed later.Returns
A registry object.Examples
method Api.create_run()
Create a new run.Arguments
str | None
The ID to assign to the run. If not specified, W&B creates a random ID.
str | None
The project where to log the run to. If no project is specified, log the run to a project called “Uncategorized”.
str | None
The entity that owns the project. If no entity is specified, log the run to the default entity.
Returns
The newly createdRun.
method Api.create_run_queue()
Create a new run queue in W&B Launch.Arguments
str
Name of the queue to create
public.RunQueueResourceType
Type of resource to be used for the queue. One of “local-container”, “local-process”, “kubernetes”,“sagemaker”, or “gcp-vertex”.
str | None
Name of the entity to create the queue. If
None, use the configured or default entity.public.RunQueuePrioritizationMode | None
Version of prioritization to use. Either “V0” or
None.dict | None
Default resource configuration to be used for the queue. Use handlebars (eg.
{{var}}) to specify template variables.dict | None
A dictionary of template variable schemas to use with the config.
Returns
The newly createdRunQueue.
method Api.create_team()
Create a new team.Arguments
str
The name of the team
str | None
Username of the admin user of the team. Defaults to the current user.
Returns
ATeam object.
method Api.create_user()
Create a new user.Arguments
str
The email address of the user.
bool | None
Set user as a global instance administrator.
Returns
AUser object.
method Api.delete_automation()
Delete an automation.Arguments
Automation | str
The automation to delete, or its ID.
Returns
True if the automation was deleted successfully.method Api.flush()
Flush the local cache. The api object keeps a local cache of runs, so if the state of the run may change while executing your script you must clear the local cache withapi.flush() to get the latest values associated with the run.
method Api.from_path()
Return a run, sweep, project or report from a path.Arguments
str
The path to the project, run, sweep or report
Returns
AProject, Run, Sweep, or BetaReport instance.
Examples
In the proceeding code snippets “project”, “team”, “run_id”, “sweep_id”, and “report_name” are placeholders for the project, team, run ID, sweep ID, and the name of a specific report, respectively.method Api.integrations()
Return an iterator of all integrations for an entity.Arguments
str | None
The entity (e.g. team name) for which to fetch integrations. If not provided, the user’s default entity will be used.
int
Number of integrations to fetch per page. Defaults to 50. Usually there is no reason to change this.
str | None
method Api.job()
Return aJob object.
Arguments
str | None
The name of the job.
str | None
The root path to download the job artifact.
Returns
AJob object.
method Api.list_jobs()
Return a list of jobs, if any, for the given entity and project.Arguments
str
The entity for the listed jobs.
str
The project for the listed jobs.
Returns
A list of matching jobs.method Api.organization()
Return the matchingOrganization.
Arguments
str | None
The name of the organization. If omitted, this method will attempt to infer and return the current default organization.
Returns
AnOrganization object.
method Api.project()
Return theProject with the given name (and entity, if given).
Arguments
str
The project name.
str | None
Name of the entity requested. If None, will fall back to the default entity passed to
Api. If no default entity, will raise a ValueError.Returns
AProject object.
method Api.projects()
Get projects for a given entity.Arguments
str | None
Name of the entity requested. If None, will fall back to the default entity passed to
Api. If no default entity, will raise a ValueError.int
Sets the page size for query pagination. Usually there is no reason to change this.
Returns
AProjects object which is an iterable collection of Projectobjects.
method Api.queued_run()
Return a single queued run based on the path. Parses paths of the formentity/project/queue_id/run_queue_item_id.
Arguments
str
str
str
str
method Api.registries()
Returns a lazy iterator ofRegistry objects.
Use the iterator to search and filter registries, collections,
or artifact versions across your organization’s registry.
Arguments
str | None
The organization of the registry to fetch. If not specified, use the organization specified in the user’s settings.
dict[str, Any] | None
Optional MongoDB-style filter to apply to each object in the lazy registry iterator. Fields available to filter for registries are
name, description, created_at, updated_at. Fields available to filter for collections are name, tag, description, created_at, updated_at Fields available to filter for versions are tag, alias, created_at, updated_at, metadatastr | None
Optional string to specify the order of the results. If prefixed with ’+’, sorts ascending (default). If prefixed with ’-’, sorts descending.
int
Sets the page size for query pagination.
str | None
Pagination cursor for resuming a past query, captured from a previous paginator’s
.cursor attribute.Returns
A lazy iterator ofRegistry objects.
Examples
Find all registries with the names that contain “model”.cursor and passing it as start=:
method Api.registry()
Return a registry given a registry name.Arguments
str
The name of the registry. This is without the
wandb-registry- prefix.str | None
The organization of the registry. If no organization is set in the settings, the organization will be fetched from the entity if the entity only belongs to one organization.
Returns
A registry object.Examples
Fetch and update a registrymethod Api.reports()
Get reports for a given project path. Note:wandb.Api.reports() API is in beta and will likely change in
future releases.
Arguments
str
The path to the project the report resides in. Specify the entity that created the project as a prefix followed by a forward slash.
str | None
Name of the report requested.
int
Sets the page size for query pagination. Usually there is no reason to change this.
Returns
AReports object which is an iterable collection of BetaReport objects.
Examples
method Api.run()
Return a single run by parsing path in the formentity/project/run_id.
Arguments
Path to run in the form
entity/project/run_id. If api.entity is set, this can be in the form project/run_id and if api.project is set this can just be the run_id.Returns
ARun object.
Raises
If a run is not found, or run data is not able to be loaded.
method Api.run_queue()
Return the namedRunQueue for entity.
See Api.create_run_queue for more information on how to create a run queue.
Arguments
str
str
method Api.runs()
Returns aRuns object, which lazily iterates over Run objects.
Fields you can filter by include:
createdAt: The timestamp when the run was created. (in ISO 8601 format, e.g. “2023-01-01T12:00:00Z”)displayName: The human-readable display name of the run. (e.g. “eager-fox-1”)duration: The total runtime of the run in seconds.group: The group name used to organize related runs together.host: The hostname where the run was executed.jobType: The type of job or purpose of the run.name: The unique identifier of the run. (e.g. “a1b2cdef”)state: The current state of the run.tags: The tags associated with the run.username: The username of the user who initiated the run
config.experiment_name, summary_metrics.loss, etc.
For more complex filtering, you can use MongoDB query operators.
For details, see: https://docs.mongodb.com/manual/reference/operator/query
The following operations are supported:
$and$or$nor$eq$ne$gt$gte$lt$lte$in$nin$exists$regex
Arguments
str | None
(str) path to project, should be in the form: “entity/project”
dict[str, Any] | None
(dict) queries for specific runs using the MongoDB query language. You can filter by run properties such as config.key, summary_metrics.key, state, entity, createdAt, etc. For example:
{"config.experiment_name": "foo"} would find runs with a config entry of experiment name set to “foo”str
(str) Order can be
created_at, heartbeat_at, config.*.value, or summary_metrics.*. If you prepend order with a + order is ascending (default). If you prepend order with a - order is descending. The default order is run.created_at from oldest to newest.int
(int) Sets the page size for query pagination.
bool
(bool) Whether to eagerly fetch the sweep object in each run result.
bool
(bool) Whether to use lazy loading for faster performance. When True (default), only essential run metadata is loaded initially. Heavy fields like config, summaryMetrics, and systemMetrics are loaded on-demand when accessed. Set to False for full data upfront.
Returns
ARuns object, which is an iterable collection of Run objects.
Examples
method Api.slack_integrations()
Returns an iterator of Slack integrations for an entity.Arguments
str | None
The entity (e.g. team name) for which to fetch integrations. If not provided, the user’s default entity will be used.
int
Number of integrations to fetch per page. Defaults to 50. Usually there is no reason to change this.
str | None
Examples
Get all registered Slack integrations for the team “my-team”:method Api.sweep()
Return a sweep by parsing path in the formentity/project/sweep_id.
Arguments
Path to sweep in the form entity/project/sweep_id. If
api.entity is set, this can be in the form project/sweep_id and if api.project is set this can just be the sweep_id.Returns
ASweep object.
method Api.sync_tensorboard()
Sync a local directory containing tfevent files to wandb.Arguments
method Api.team()
Return the matchingTeam with the given name.
Arguments
str
The name of the team.
Returns
ATeam object.
method Api.update_automation()
Update an existing automation.Arguments
Automation
The automation to update. Must be an existing automation.
bool
If True, and the automation does not exist, create it.
Unpack[WriteAutomationsKwargs]
Returns
The updated automation.Examples
Disable and edit the description of an existing automation (“my-automation”):method Api.upsert_run_queue()
Upsert a run queue in W&B Launch.Arguments
str
Name of the queue to create
dict
Optional default resource configuration to be used for the queue. Use handlebars (eg.
{{var}}) to specify template variables.public.RunQueueResourceType
Type of resource to be used for the queue. One of “local-container”, “local-process”, “kubernetes”, “sagemaker”, or “gcp-vertex”.
str | None
Optional name of the entity to create the queue. If
None, use the configured or default entity.dict | None
A dictionary of template variable schemas to be used with the config.
dict | None
Optional dictionary of external links to be used with the queue.
public.RunQueuePrioritizationMode | None
Optional version of prioritization to use. Either “V0” or None
Returns
The upsertedRunQueue.
method Api.user()
Return a user from a username or email address. This function only works for local administrators. Useapi.viewer
to get your own user object.
Arguments
str
The username or email address of the user.
Returns
AUser object or None if a user is not found.
method Api.users()
Return all users from a partial username or email address query. This function only works for local administrators. Useapi.viewer
to get your own user object.
Arguments
str
The prefix or suffix of the user you want to find.
Returns
An array ofUser objects.
method Api.webhook_integrations()
Returns an iterator of webhook integrations for an entity.Arguments
str | None
The entity (e.g. team name) for which to fetch integrations. If not provided, the user’s default entity will be used.
int
Number of integrations to fetch per page. Defaults to 50. Usually there is no reason to change this.
str | None