-- Query: Daily tool messages per host
-- Result variable: daily_host_activity

SELECT
    tm.tool_timestamp::DATE AS date,
    c.host_id,
    COUNT(*) AS tool_message_count
FROM hostagentspg.public.tool_messages AS tm
INNER JOIN hostagentspg.public.conversations AS c ON tm.conversation_id = c.id
GROUP BY tm.tool_timestamp::DATE, c.host_id