MCPcopy
hub / github.com/dataelement/Clawith / log_activity

Function log_activity

backend/app/services/activity_logger.py:12–31  ·  view source on GitHub ↗

Record an agent activity. Fire-and-forget, never raises.

(
    agent_id: uuid.UUID,
    action_type: str,
    summary: str,
    detail: dict | None = None,
    related_id: uuid.UUID | None = None,
)

Source from the content-addressed store, hash-verified

10
11
12async def log_activity(
13 agent_id: uuid.UUID,
14 action_type: str,
15 summary: str,
16 detail: dict | None = None,
17 related_id: uuid.UUID | None = None,
18) -> None:
19 """Record an agent activity. Fire-and-forget, never raises."""
20 try:
21 async with async_session() as db:
22 db.add(AgentActivityLog(
23 agent_id=agent_id,
24 action_type=action_type,
25 summary=summary,
26 detail_json=detail,
27 related_id=related_id,
28 ))
29 await db.commit()
30 except Exception as e:
31 logger.error(f"[ActivityLog] Failed to log {action_type}: {e}")

Callers 15

_execute_scheduleFunction · 0.90
_process_wechat_messageFunction · 0.90
execute_taskFunction · 0.90
_execute_heartbeatFunction · 0.90
run_agent_oneshotFunction · 0.90
execute_toolFunction · 0.90
_send_file_to_agentFunction · 0.90
_a2a_handle_openclawFunction · 0.90
_a2a_handle_notifyFunction · 0.90
_a2a_handle_consultFunction · 0.90

Calls 3

AgentActivityLogClass · 0.90
addMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected