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

# Global Functions overview

> Global functions in the W&B Python SDK

Global functions in W\&B are top-level functions that you call directly, such as `wandb.init()` or `wandb.login()`. Unlike methods that belong to specific classes, these functions provide direct access to W\&B's core functionality without needing to instantiate objects first.

## Available functions

| Function                                                  | Description                                                                                                              |
| --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| [`init()`](/models/ref/python/functions/init)             | Start a new run to track and log to W\&B. This is typically the first function you'll call in your ML training pipeline. |
| [`login()`](/models/ref/python/functions/login)           | Set up W\&B login credentials to authenticate your machine with the platform.                                            |
| [`setup()`](/models/ref/python/functions/setup)           | Prepare W\&B for use in the current process and its children. Useful for multi-process applications.                     |
| [`teardown()`](/models/ref/python/functions/teardown)     | Clean up W\&B resources and shut down the backend process.                                                               |
| [`sweep()`](/models/ref/python/functions/sweep)           | Initialize a hyperparameter sweep to search for optimal model configurations.                                            |
| [`agent()`](/models/ref/python/functions/agent)           | Create a sweep agent to run hyperparameter optimization experiments.                                                     |
| [`controller()`](/models/ref/python/functions/controller) | Manage and control sweep agents and their execution.                                                                     |
| [`restore()`](/models/ref/python/functions/restore)       | Restore a previous run or experiment state for resuming work.                                                            |
| [`finish()`](/models/ref/python/functions/finish)         | Finish a run and clean up resources.                                                                                     |

## Example

The most common workflow begins with authenticating with W\&B, initializing a run, and logging values (such as accuracy and loss) from your training loop. The first steps are to import `wandb` and use the global functions `login()` and `init()`:

```python theme={null}
import wandb

# Authenticate with W&B
wandb.login()

# Hyperparameters and metadata
config = {
   "learning_rate": 0.01,
   "epochs": 10,
}

# Project that the run is recorded to
project = "my-awesome-project"

# Initialize a new run
with wandb.init(project=project, config=config) as run:
   # Your training code here...
   
   # Log values to W&B
   run.log({"accuracy": 0.9, "loss": 0.1})
```
