diff --git a/docs.json b/docs.json
index 7c87e009af..e5ac59f8cd 100644
--- a/docs.json
+++ b/docs.json
@@ -672,7 +672,6 @@
"weave/guides/tracking/costs",
"weave/guides/tools/saved-views",
"weave/guides/tracking/trace-plots",
- "weave/guides/tracking/trace-to-run",
"weave/guides/tools/weave-in-workspaces"
]
},
@@ -6406,6 +6405,10 @@
"destination": "/weave/agent-integration-quickstart",
"source": "/weave/guides/tracking/trace-agent-integrations"
},
+ {
+ "destination": "/weave/guides/tools/weave-in-workspaces",
+ "source": "/weave/guides/tracking/trace-to-run"
+ },
{
"destination": "/:slug*",
"source": "/_print/:slug*"
diff --git a/weave/guides/tools/weave-in-workspaces.mdx b/weave/guides/tools/weave-in-workspaces.mdx
index 7b4f05a341..a2bcb03718 100644
--- a/weave/guides/tools/weave-in-workspaces.mdx
+++ b/weave/guides/tools/weave-in-workspaces.mdx
@@ -1,7 +1,7 @@
---
title: "Use Weave with W&B training runs"
description: "Integrate Weave traces with W&B training runs to view function execution details alongside ML metrics in workspace dashboards."
-keywords: ["workspaces", "training runs", "traces", "wandb.run", "artifacts"]
+keywords: ["workspaces", "training runs", "traces", "wandb.run", "wandb.init", "trace linking", "experiment tracking", "artifacts"]
---
# Log traces during model training runs
@@ -88,6 +88,21 @@ To navigate to a workspace from the UI:
For more information about workspaces, see [View experiments results](https://docs.wandb.ai/models/track/workspaces).
+## View a linked run in the Traces table
+
+When you call a function decorated with `@weave.op` inside a `wandb.init()` context, Weave automatically associates the trace with the active [W&B run](/models/runs). The **Traces** table in the Weave UI links each trace to its associated runs.
+
+To view the runs linked to your traces:
+
+1. Run a script that calls traced functions inside a `wandb.init()` context, such as the training example in [Use Weave panels](#use-weave-panels).
+2. Navigate to the [W&B app](https://wandb.ai) and select your project.
+3. In the **Weave** project sidebar, click **Traces**. The **Traces** table displays links to any associated runs.
+4. Open a trace from the **Traces** table to inspect the linked W&B run and review its experiment context.
+
+
+Linking traces to W&B runs is not yet available in the TypeScript SDK.
+
+
## Associate traces with a specific W&B run
In some cases, you may want to attach traces to a run other than the one Weave detects automatically. By default, Weave automatically detects and associates traces with the active `wandb.run`. If you need to associate traces with a specific run that isn't the global `wandb.run`, use `set_wandb_run_context`. To associate traces with a specific run and run step, define values for the method's `run_id` and `step` arguments:
diff --git a/weave/guides/tracking/trace-to-run.mdx b/weave/guides/tracking/trace-to-run.mdx
deleted file mode 100644
index 41f84864d0..0000000000
--- a/weave/guides/tracking/trace-to-run.mdx
+++ /dev/null
@@ -1,94 +0,0 @@
----
-title: "Link a W&B run to trace function calls"
-description: "Associate Weave traces with W&B runs for experiment tracking"
-keywords: ["wandb.init", "weave.op", "experiment tracking", "trace linking"]
----
-
-With W&B Weave, you can trace function calls in your code and link them directly to the [W&B runs](https://docs.wandb.ai/models/runs/) in which they ran.
-When you trace a function with `@weave.op()` and call it inside a `wandb.init()` context, Weave automatically associates the trace with the W&B run.
-The **Traces** table shows links to any associated runs.
-
-## View a W&B run in the Traces table
-
-
-
-The following Python code shows how Weave links traced Ops to W&B
-runs when you run them inside a `wandb.init()` context. These traces appear in the
-Weave UI and are associated with the corresponding run.
-
-To view a W&B run as a Weave trace:
-
-1. In the terminal, install dependencies.
-
-```bash lines
-pip install wandb weave
-```
-
-2. Log in to W&B.
-
-```bash lines
-wandb login
-```
-
-3. In the following script, replace `your-team-name/your-project-name` with your W&B entity and project:
-
-```python lines
-import wandb
-import weave
-
-def example_wandb(projname):
- # Split projname into entity and project
- entity, project = projname.split("/", 1)
-
- # Initialize Weave context for tracing
- weave.init(projname)
-
- # Define a traceable Op
- @weave.op()
- def say(message: str) -> str:
- return f"I said: {message}"
-
- # First W&B run
- with wandb.init(
- entity=entity,
- project=project,
- notes="Experiment 1",
- tags=["baseline", "paper1"],
- ) as run:
- say("Hello, world!")
- say("How are you!")
- run.log({"messages": 2})
-
- # Second W&B run
- with wandb.init(
- entity=entity,
- project=project,
- notes="Experiment 2",
- tags=["baseline", "paper1"],
- ) as run:
- say("Hello, world from experiment 2!")
- say("How are you!")
- run.log({"messages": 2})
-
-if __name__ == "__main__":
- # Replace this with your actual W&B username/project
- example_wandb("your-team-name/your-project-name")
-```
-
-4. Run the script.
-
-```bash lines
-python weave_trace_with_wandb.py
-```
-
-5. Navigate to the [W&B app](https://wandb.ai) and select your project.
-6. In the **Weave project sidebar**, click **Traces**. The **Traces** table displays links to any associated runs.
-
-You can now open any trace from the **Traces** table to inspect the linked W&B run and review its associated experiment context.
-
-
-```text
-This feature is not available for the TypeScript SDK yet.
-```
-
-