MCPcopy Create free account
hub / github.com/modelscope/ms-agent / build_timing_record

Function build_timing_record

ms_agent/utils/stats.py:87–110  ·  view source on GitHub ↗
(
        *,
        event: str,
        agent_tag: Optional[str],
        agent_type: Optional[str],
        started_at: str,
        ended_at: str,
        duration_s: float,
        status: str,
        usage: Optional[Dict[str, int]] = None,
        extra: Optional[Dict[str, Any]] = None)

Source from the content-addressed store, hash-verified

85
86
87def build_timing_record(
88 *,
89 event: str,
90 agent_tag: Optional[str],
91 agent_type: Optional[str],
92 started_at: str,
93 ended_at: str,
94 duration_s: float,
95 status: str,
96 usage: Optional[Dict[str, int]] = None,
97 extra: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
98 record = {
99 'event': event,
100 'agent_tag': agent_tag,
101 'agent_type': agent_type,
102 'started_at': started_at,
103 'ended_at': ended_at,
104 'duration_s': round(duration_s, 6),
105 'status': status,
106 'usage': usage or {},
107 }
108 if extra:
109 record.update(extra)
110 return record
111
112
113def now_iso() -> str:

Callers 2

run_loopMethod · 0.90
_run_agentMethod · 0.90

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected