Agentforce Coworker Data in Data 360
Query Agentforce Coworker Usage and Adoption Data in Data 360
Review Agentforce Coworker Prompts and Responses in Data 360
Monitor Agentforce Coworker Credit Consumption in Digital Wallet
Query the Einstein Audit and Feedback data model objects (DMOs) in Data 360 to see what your users ask Agentforce Coworker, what Coworker sends to the LLM, and how the LLM responds.
| REQUIRED EDITIONS AND PERMISSIONS | |
|---|---|
| Available in: | Enterprise, Unlimited, and Agentforce 1 Editions |
| To query Agentforce Coworker audit trail data in Data 360: | See permissions table in Create and Run Queries in Query Editor. |
Each audit trail query joins three DMOs: GenAIGeneration to GenAIGatewayResponse on generationResponseId__c, and GenAIGatewayResponse to GenAIGatewayRequest on generationRequestId__c = gatewayRequestId__c. To filter for Agentforce Coworker, use req.feature__c = 'Agentforce Coworker'.
Return the most recent 100 Agentforce Coworker LLM calls, with the session, user, model, full prompt, and raw response for each call.
1-- all Coworker LLM calls by user
2SELECT
3 req.timestamp__c AS event_time,
4 req.sessionId__c AS session_id,
5 req.UserId__c AS user_id,
6 gen.feature__c AS feature,
7 req.model__c AS model,
8 req.prompt__c AS sent_to_llm,
9 gen.responseText__c AS llm_response
10FROM GenAIGeneration__dlm gen
11JOIN GenAIGatewayResponse__dlm res
12 ON gen.generationResponseId__c = res.generationResponseId__c
13JOIN GenAIGatewayRequest__dlm req
14 ON res.generationRequestId__c = req.gatewayRequestId__c
15WHERE req.feature__c = 'Agentforce Coworker'
16ORDER BY req.timestamp__c DESC
17LIMIT 100The llm_response column contains raw JSON, with tool invocations mixed in with the response text. This query extracts only the text content.
1-- Extracting just the LLM response TEXT
2SELECT
3 req.timestamp__c AS event_time,
4 req.UserId__c AS user_id,
5 SUBSTRING(
6 gen.responseText__c,
7 POSITION('"content":"' IN gen.responseText__c) + LENGTH('"content":"'),
8 POSITION('"' IN SUBSTRING(
9 gen.responseText__c,
10 POSITION('"content":"' IN gen.responseText__c) + LENGTH('"content":"')
11 )) - 1
12 ) AS llm_response_text
13FROM GenAIGeneration__dlm gen
14JOIN GenAIGatewayResponse__dlm res
15 ON gen.generationResponseId__c = res.generationResponseId__c
16JOIN GenAIGatewayRequest__dlm req
17 ON res.generationRequestId__c = req.gatewayRequestId__c
18WHERE req.feature__c = 'Agentforce Coworker'
19 AND POSITION('"content":"' IN gen.responseText__c) > 0
20 AND SUBSTRING(
21 gen.responseText__c,
22 POSITION('"content":"' IN gen.responseText__c) + LENGTH('"content":"'),
23 1
24 ) != '"'
25ORDER BY req.timestamp__c DESC
26LIMIT 100The system instructions are the same in every Agentforce Coworker prompt. The ## Dynamic Context section makes each prompt unique, with details such as the user’s identity, recently viewed records, and session state. This query returns each prompt from the ## Dynamic Context marker onward.
1-- Query to extract from ## Dynamic Context onwards
2SELECT
3 MIN(req.timestamp__c) AS event_time,
4 req.UserId__c AS user_id,
5 SUBSTRING(
6 req.prompt__c,
7 POSITION('## Dynamic Context' IN req.prompt__c)
8 ) AS dynamic_context_onwards
9FROM GenAIGeneration__dlm gen
10JOIN GenAIGatewayResponse__dlm res
11 ON gen.generationResponseId__c = res.generationResponseId__c
12JOIN GenAIGatewayRequest__dlm req
13 ON res.generationRequestId__c = req.gatewayRequestId__c
14WHERE req.feature__c = 'Agentforce Coworker'
15 AND POSITION('## Dynamic Context' IN req.prompt__c) > 0
16GROUP BY req.prompt__c, req.UserId__c
17ORDER BY event_time DESC
18LIMIT 100In the ### Agent Catalog section, Agentforce Coworker uses the dynamic context to decide which agent or tool to call. This query returns each prompt from the ### Agent Catalog marker onward, so you can review the routing decision.
1-- Query to extract from ### Agent Catalog onwards
2SELECT
3 MIN(req.timestamp__c) AS event_time,
4 req.UserId__c AS user_id,
5 SUBSTRING(
6 req.prompt__c,
7 POSITION('### Agent Catalog' IN req.prompt__c)
8 ) AS agent_catalog_onwards
9FROM GenAIGeneration__dlm gen
10JOIN GenAIGatewayResponse__dlm res
11 ON gen.generationResponseId__c = res.generationResponseId__c
12JOIN GenAIGatewayRequest__dlm req
13 ON res.generationRequestId__c = req.gatewayRequestId__c
14WHERE req.feature__c = 'Agentforce Coworker'
15 AND POSITION('### Agent Catalog' IN req.prompt__c) > 0
16GROUP BY req.prompt__c, req.UserId__c
17ORDER BY event_time DESC
18LIMIT 100The role: user section of a prompt contains the generalized, rewritten version of the user’s question. This query extracts this text so you can see which tasks and topics drive Agentforce Coworker usage.
1-- Query to extract only the generalized query of what the user asked
2SELECT
3 MIN(req.timestamp__c) AS event_time,
4 req.UserId__c AS user_id,
5 SUBSTRING(
6 req.prompt__c,
7 POSITION('role: user' IN SUBSTRING(
8 req.prompt__c,
9 POSITION('### Agent Catalog' IN req.prompt__c)
10 )) + POSITION('### Agent Catalog' IN req.prompt__c) + LENGTH('role: user'),
11 GREATEST(
12 POSITION('role: assistant' IN SUBSTRING(
13 req.prompt__c,
14 POSITION('role: user' IN SUBSTRING(
15 req.prompt__c,
16 POSITION('### Agent Catalog' IN req.prompt__c)
17 )) + POSITION('### Agent Catalog' IN req.prompt__c) + LENGTH('role: user')
18 )) - 1,
19 0)
20 ) AS user_question
21FROM GenAIGeneration__dlm gen
22JOIN GenAIGatewayResponse__dlm res
23 ON gen.generationResponseId__c = res.generationResponseId__c
24JOIN GenAIGatewayRequest__dlm req
25 ON res.generationRequestId__c = req.gatewayRequestId__c
26WHERE req.feature__c = 'Agentforce Coworker'
27 AND POSITION('### Agent Catalog' IN req.prompt__c) > 0
28GROUP BY req.prompt__c, req.UserId__c
29HAVING
30 -- Ensure 'role: user' exists after '### Agent Catalog'
31 POSITION('role: user' IN SUBSTRING(
32 req.prompt__c,
33 POSITION('### Agent Catalog' IN req.prompt__c)
34 )) > 0
35 -- Ensure 'role: assistant' exists after 'role: user'
36 AND POSITION('role: assistant' IN SUBSTRING(
37 req.prompt__c,
38 POSITION('role: user' IN SUBSTRING(
39 req.prompt__c,
40 POSITION('### Agent Catalog' IN req.prompt__c)
41 )) + POSITION('### Agent Catalog' IN req.prompt__c) + LENGTH('role: user')
42 )) > 0
43ORDER BY event_time DESC
44LIMIT 100The prompt-extraction queries return reliable results for primary conversational calls, which contain the ### Agent Catalog marker. Delegated agent calls, internal helper calls, and utility calls don’t contain the same markers, so rows for those calls can return partial fragments, --, or empty results. The POSITION('### Agent Catalog' IN req.prompt__c) > 0 filter removes most of those rows, but some can remain.
Note
To learn more about the prompt sections and LLM call types, see Agentforce Coworker Data in Data 360.