> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sweep

[View source](https://github.com/wandb/wandb/blob/main/wandb/apis/public/sweeps.py#L280)

## Class wandb.apis.public.Sweep

The set of runs associated with the sweep.

```python theme={"system"}
(service_api: 'ServiceApi',
entity: 'str',
project: 'str',
sweep_id: 'str',
attrs: 'Mapping[str, Any] | None' = None)
```

## Args

**service\_api** `ServiceApi`

No description provided.

**entity** `str`

No description provided.

**project** `str`

No description provided.

**sweep\_id** `str`

No description provided.

**attrs** `Mapping[str, Any] | None`

No description provided.

## Attributes

* `runs` (`Runs`): List of runs
* `id` (`str`): Sweep ID
* `project` (`str`): The name of the project the sweep belongs to
* `config` (`dict`): Dictionary containing the sweep configuration
* `state` (`str`): The state of the sweep. Can be "Finished", "Failed", "Crashed", or "Running".
* `expected_run_count` (`int`): The number of expected runs for the sweep

## Properties

**config**

The sweep configuration used for the sweep.

**entity** `str`

The entity associated with the sweep.

**expected\_run\_count** `int | None`

Return the number of expected runs in the sweep or None for infinite runs.

**name**

The name of the sweep.

Returns the first name that exists in the following priority order:

1. User-edited display name
2. Name configured at creation time
3. Sweep ID

**order**

Return the order key for the sweep.

**path**

Returns the path of the project.

The path is a list containing the entity, project name, and sweep ID.

**url**

The URL of the sweep.

The sweep URL is generated from the entity, project, the term
"sweeps", and the sweep ID.run\_id. For
SaaS users, it takes the form
of `https://forge.coreweave.com/wandb/entity/project/sweeps/sweeps_ID`.

**username** `str`

Deprecated. Use `Sweep.entity` instead.

## Methods

### method Sweep.agent()

```python theme={"system"}
self,
agent_id: 'str'
```

Query an agent by ID for this sweep.

##### Arguments

**agent\_id** `str`

The ID of the agent to look up.

### method Sweep.agents()

```python theme={"system"}
self
```

Query the list of all agents for this sweep.

### method Sweep.best\_run()

```python theme={"system"}
(self, order=None)
```

Return the best run sorted by the metric defined in config or the order passed in.

##### Arguments

**order** `_empty`

No description provided.

### method Sweep.enqueue\_run()

```python theme={"system"}
self,
config: 'dict',
display_name: 'str | None' = None
```

Enqueue a run for the sweep.

##### Arguments

**config** `dict`

The config for the run.

**display\_name** `str | None`

The optional display name for the run.

##### Raises

* `UnsupportedError`: If the server doesn't support enqueuing sweep runs.

### method Sweep.get()

```python theme={"system"}
(api: 'Api',
entity: 'str | None' = None,
project: 'str | None' = None,
sid: 'str | None' = None,
order: 'str | None' = None,
query: 'str | None' = None, **kwargs)
```

Execute a query against the cloud backend.

##### Arguments

**api** `Api`

The W\&B API instance.

**entity** `str | None`

The entity (username or team) that owns the project.

**project** `str | None`

The name of the project to fetch sweep from.

**sid** `str | None`

The sweep ID to query.

**order** `str | None`

The order in which the sweep's runs are returned.

**query** `str | None`

The query to use to execute the query.

**kwargs** `_empty`

No description provided.

### method Sweep.to\_html()

```python theme={"system"}
self,
height: 'int' = 420,
hidden: 'bool' = False
```

Generate HTML containing an iframe displaying this sweep.

##### Arguments

**height** `int`

No description provided.

**hidden** `bool`

No description provided.
