Skip to content

Agent tracing in Weave#6288

Open
evgenyrp wants to merge 7 commits into
mozilla:masterfrom
evgenyrp:agent_tracing
Open

Agent tracing in Weave#6288
evgenyrp wants to merge 7 commits into
mozilla:masterfrom
evgenyrp:agent_tracing

Conversation

@evgenyrp

@evgenyrp evgenyrp commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Enable Weave tracing for all agents. The agent name will be the same as its folder name.

See test example traces: https://wandb.ai/moz-bugbug/hackbot-test/weave/agents?filters[agent_name]=build-repair

Auth through WIF similar to Anthropic (need to test that on deployment).

fixes #6266

@evgenyrp evgenyrp requested a review from suhaibmujahid July 7, 2026 19:05
Comment thread agents/README.md Outdated
Comment on lines +103 to +136
## Tracing (Weave)

Dashboards: [prod](https://wandb.ai/moz-bugbug/hackbot-prod/weave/agents), [dev](https://wandb.ai/moz-bugbug/hackbot-dev), [test](https://wandb.ai/moz-bugbug/hackbot-test)

Tracing is handled once in the runtime (`hackbot_runtime.tracing`), so every agent
gets it for free — there's nothing to add per agent. On startup the runtime calls
`weave.init()`, which autopatches the Claude Agent SDK (or other supported frameworks) and captures each query,
model response, and tool call, labelled with the agent's name (so the Weave
**Agents** view shows `build-repair`, `bug-fix`, etc. instead of a generic
`claude_agent_sdk`).

It is **opt-in**: the runtime only traces when it has W&B credentials, and never
fails a run if Weave can't start. `WEAVE_PROJECT` picks the destination project
(a bare `project` or `entity/project`; defaults to `hackbot-test`).

**Locally**, add the key to your root `.env`; the agent's `compose.yml` should
pass `WANDB_API_KEY` through to the agent container.

`.env`:

```dotenv
WANDB_API_KEY=...
```

`compose.yml`:

```yaml
environment:
- WANDB_API_KEY=${WANDB_API_KEY:-}
```

**In deployment**, the agent container holds no long-lived key: it authenticates
via W&B [Identity Federation](https://docs.wandb.ai/platform/hosting/iam/identity_federation).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us drop this out to keep it short. We could have advanced docs for Hackbot in /docs, we could do this later since it is out of the scope of this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather add docs together with functionality, especially since we already have them here. I can move it to another place.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to /docs, we can refactor later if we don't like it

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us file a follow-up issue to reduce duplication between wandb_wif.py and anthropic_wif.py.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add the issue when we land it

Comment thread libs/hackbot-runtime/pyproject.toml Outdated

[project.optional-dependencies]
claude-sdk = ["claude-agent-sdk>=0.1.30", "agent-tools[claude-sdk]"]
claude-sdk = ["claude-agent-sdk>=0.1.30", "agent-tools[claude-sdk]", "weave>=0.53.1"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think this needs to be specific to the Claude SDK.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

@evgenyrp evgenyrp requested a review from suhaibmujahid July 8, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Observability for agents

2 participants