system.eam.queryAgentHistory
This function is used in Python Scripting.
Descriptionβ
Returns a list of the most recent agent events. This function can only be called from the Controller. If called from an Agent, this function will return an exception.
Client Permission Restrictionsβ
This scripting function has no Client Permission restrictions.
Syntaxβ
system.eam.queryAgentHistory(groupIds, agentIds, startDate, endDate, limit)
Parametersβ
| Type | Parameter | Description |
|---|---|---|
| List | groupIds | A list of groups to restrict the results to. If not specified, all groups will be included. |
| List | agentIds | A list of agent names to restrict the results to. If not specified, all agents will be allowed. |
| Date | startDate | The starting time for history events. If null, defaults to 8 hours previous to now. |
| Date | endDate | The ending time for the query range. If null, defaults to "now". |
| int | limit | The limit of results to return. Defaults to 100. A value of 0 means "no limit". |
Returnsβ
Dataset - A dataset with columns id, agent_name, agent_role, event_time, event_category, event_type, event_source, event_level, event_level_int, and message, where each row is a new agent event.
Scopeβ
Gateway, Vision Client, Perspective Session
Code Examplesβ
Example #1 -Querying for Agent Task History
# This script will loop through each row of the dataset and grab out every value from that row and assign it to a matching variable. Those variables can then be used in some way.
results=system.eam.queryAgentHistory()
for row in range(results.rowCount):
eventId=results.getValueAt(row, "id")
agentName=results.getValueAt(row, "agent_name")
agentRole=results.getValueAt(row, "agent_role")
eventTime=results.getValueAt(row, "event_time")
eventCategory=results.getValueAt(row, "event_category")
eventType=results.getValueAt(row, "event_type")
eventSource=results.getValueAt(row, "event_source")
eventLevel=results.getValueAt(row, "event_level")
eventLevelInt=results.getValueAt(row, "event_level_int")
message=results.getValueAt(row, "message")
#Can include some code here to use the variables in some way for each row.
Example #2 - Querying for Agent Task History
# This script grabs the agent event history from agents called Agent1, Agent2, Agent3, and will then place the data into a table on the same window.
results=system.eam.queryAgentHistory(agentIds=["Agent1", "Agent2", "Agent3"])
event.source.parent.getComponent('Table').data = results