# Console, system metrics, and integrations

Turn on console capture, tune automatic system-metrics sampling, control source-metadata collection, and wire framework adapters — each feature is explicit and enabled per run.

## Capture console logs

Log individual lines directly:

```python
run.log_stdout("epoch=1 loss=0.42")
run.log_stderr(["warning: entropy dipped", "retrying evaluation"])
```

Or let the SDK wrap stdout and stderr:

```python
import instantml as im

run = im.init(
    project="train-loop",
    name="seed-7",
    capture_console=True,
)
```

Captured console lines are written through to the original stream and also sent to InstantML as text-series attributes named `console/stdout` and `console/stderr`. They appear in the Run Detail Logs section, which only fetches log rows when you open it.

## Sample system metrics

System metrics are collected automatically: `im.init()` samples CPU, memory, disk, network, and GPU stats every 15 seconds by default. Pass `system_metrics=False` to disable, or `system_metrics_interval=<seconds>` to change the cadence.

```python
run = im.init(
    project="train-loop",
    name="seed-7",
    system_metrics_interval=30.0,
)
```

System metrics log under `system/...` at the current step without incrementing the run's implicit step counter. Install the `system` extra for the optional system dependencies:

```bash
python3 -m pip install "instantml[system]"
```

## Keep a local audit store

The local SQLite audit store records attempted SDK events before submit:

```python
run = im.init(
    project="train-loop",
    local_store=True,
    local_store_dir=".instantml/local",
)
```

> **Note:** The audit store is not replay and is not proof that the server accepted an event. Use it when you want local evidence of what the SDK attempted during debugging.

## Control source metadata

By default, the SDK captures privacy-safe reproducibility context when it can:

- Python version.
- Platform.
- Git availability, commit, and dirty state.
- Entrypoint basename when available.

Hostname, process ID, current working directory, full command argv, branch, and git diff metadata are opt-in:

```python
run = im.init(
    project="train-loop",
    source_tracking=im.SourceTracking(
        command=True,
        paths=True,
        branch=True,
        hostname=True,
        pid=True,
        git_diff=True,
    ),
)
```

Disable source capture entirely for sensitive jobs:

```python
run = im.init(project="private-run", source_tracking=False)
```

SDK-owned source metadata is reserved and cannot be overwritten by user-provided metadata.

## Use framework adapters

Adapters stay deliberately thin. They help common frameworks call the same public SDK methods rather than adding a second integration model.

```python
run.watch(model, log="gradients", log_freq=100)
trainer.add_callback(im.TransformersCallback(run=run))
logger = im.LightningLogger(project="cartpole")
```

Prefer direct `run.log(...)` calls for custom loops. Use adapters when a framework already owns the training lifecycle — see the per-framework guides for setup details.

## Next steps

- [Integrations overview](/docs/integrations/overview.md)
- [PyTorch Lightning](/docs/integrations/pytorch-lightning.md)
- [Hugging Face Transformers](/docs/integrations/huggingface-transformers.md)
- [Buffering, offline mode, and reliability](/docs/sdk/reliability.md)
- [Explore logs and system charts in Run Detail](/docs/dashboard/run-detail.md)

## Agent navigation

- [Docs index](/llms.txt)
- [Full docs bundle](/llms-full.txt)

### Get Started

- [Overview](/docs/index.md)
- [Quickstart](/docs/quickstart.md)
- [Core Concepts](/docs/concepts/core-concepts.md)
- [Pricing](/docs/pricing.md)
- [Benchmarks](/docs/benchmarks.md)
- [Examples](/docs/guides/examples.md)
- [Troubleshooting](/docs/troubleshooting.md)

### SDK

- [Installation Auth](/docs/sdk/installation-auth.md)
- [Logging](/docs/sdk/logging.md)
- [Tracing](/docs/sdk/tracing.md)
- [Metrics Steps](/docs/sdk/metrics-steps.md)
- [Config Tags Notes](/docs/sdk/config-tags-notes.md)
- [Artifacts Checkpoints](/docs/sdk/artifacts-checkpoints.md)
- [Rich Objects](/docs/sdk/rich-objects.md)
- [Distributed Training](/docs/sdk/distributed-training.md)
- [Console System Integrations](/docs/sdk/console-system-integrations.md) (current page)
- [Reliability](/docs/sdk/reliability.md)
- [Cli Login](/docs/sdk/cli-login.md)
- [Querying Data](/docs/sdk/querying-data.md)
- [Agent Mcp](/docs/sdk/agent-mcp.md)
- [Examples Patterns](/docs/sdk/examples-patterns.md)

### Integrations

- [Overview](/docs/integrations/overview.md)
- [Pytorch Lightning](/docs/integrations/pytorch-lightning.md)
- [Huggingface Transformers](/docs/integrations/huggingface-transformers.md)
- [Keras](/docs/integrations/keras.md)
- [Wandb](/docs/integrations/wandb.md)

### Dashboard

- [Tour](/docs/dashboard/tour.md)
- [Organizations Workspaces](/docs/dashboard/organizations-workspaces.md)
- [Runs Workspace](/docs/dashboard/runs-workspace.md)
- [Metrics Charts](/docs/dashboard/metrics-charts.md)
- [Run Detail](/docs/dashboard/run-detail.md)
- [Traces](/docs/dashboard/traces.md)
- [Compare Runs](/docs/dashboard/compare-runs.md)
- [Research Dashboards](/docs/dashboard/research-dashboards.md)
- [Artifacts Files](/docs/dashboard/artifacts-files.md)
- [Run Health](/docs/dashboard/alerts.md)
- [Datasets](/docs/dashboard/datasets.md)
- [Checkpoints](/docs/dashboard/checkpoints.md)
- [Reports](/docs/dashboard/reports.md)
- [Settings Api Keys](/docs/dashboard/settings-api-keys.md)
- [Api Tab](/docs/dashboard/api-tab.md)
- [Onboarding Team Billing](/docs/dashboard/onboarding-team-billing.md)

### Data

- [Imports](/docs/guides/imports.md)
- [W&B alternative](/docs/guides/wandb-alternative.md)
- [InstantML vs MLflow](/docs/guides/instantml-vs-mlflow.md)
- [W&B import guide](/docs/guides/wandb-import-guide.md)
- [W&B and Neptune imports](/docs/guides/wandb-neptune-imports.md)
- [Export Usage Limits](/docs/guides/export-usage-limits.md)
- [Pricing Limits Billing](/docs/guides/pricing-limits-billing.md)
- [Auth Billing Storage](/docs/guides/auth-billing-storage.md)
- [Customer Owned Clickhouse](/docs/guides/customer-owned-clickhouse.md)
- [Observability](/docs/guides/observability.md)

### API

**Practical API guides**

- [Authentication](/docs/api/authentication.md)
- [Errors And Limits](/docs/api/errors-and-limits.md)
- [Health Observability](/docs/api/health-observability.md)
- [Projects Runs](/docs/api/projects-runs.md)
- [Metrics Series](/docs/api/metrics-series.md)
- [Attributes Objects](/docs/api/attributes-objects.md)
- [Artifacts](/docs/api/artifacts.md)
- [Reports](/docs/api/reports.md)
- [Iframe Embeds](/docs/api/iframe-embeds.md)
- [Import Export Usage](/docs/api/import-export-usage.md)
- [Dashboard Control State](/docs/api/dashboard-control-state.md)
**Architecture**

- [System Overview](/docs/architecture/system-overview.md)
- [Service Planes](/docs/architecture/service-planes.md)
- [Storage Model](/docs/architecture/storage-model.md)
- [Google Clickhouse](/docs/architecture/google-clickhouse.md)
- [Auth Tenancy](/docs/architecture/auth-tenancy.md)
- [Schema Reference](/docs/architecture/schema-reference.md)

### API Reference

- [API Reference](/docs/api-reference.md)
