Enable Tool Tracing for SDK Scans

When you drive scans with the SDK, bind your conversation id to the scan session so the tool calls your agent reports join the right scan.

This is the scan-driver half of tool tracing. First instrument your agent’s runtime — see Trace Agent Tools — then bind the id here.

Prerequisites

Bind the conversation id

In your scan driver, bind the scan session to the same conversation id your tools report with. The binding is a set-once call on the session, valid any time before the session ends — this also covers targets that reveal their id only in the first response.

1await scan.run(async (session) => {
2 for await (const msg of session) {
3 const reply = await myAgent.send(msg.attack) // returns { conversationId, text }
4 session.setConversationId(reply.conversationId) // set-once
5 await msg.respond(reply.text)
6 }
7})

Targets you connect in the AI Red Teaming platform don’t need this — Red captures the target’s session id and associates tool activity with the scan automatically.

Reference

setConversationId / set_conversation_id

Binds the scan session to your conversation id. Set-once: callable any time before the session ends, idempotent, and errors only if you change an already-set id.