mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-08-21 06:35:50 +00:00
feat(agent-core-v2): report the bound model alias in subagent_created telemetry (#3086)
This commit is contained in:
parent
16499408d5
commit
2ea2ef62e4
3 changed files with 8 additions and 2 deletions
|
|
@ -345,6 +345,7 @@ export interface SubagentCreatedEvent {
|
|||
agent_id: string;
|
||||
parent_agent_id: string;
|
||||
parent_tool_call_id: string;
|
||||
model?: string;
|
||||
}
|
||||
|
||||
export interface McpConnectedEvent {
|
||||
|
|
@ -848,6 +849,7 @@ export const telemetryEventDefinitions = {
|
|||
agent_id: 'Child agent id',
|
||||
parent_agent_id: 'Parent (caller) agent id',
|
||||
parent_tool_call_id: "Tool call id of the launching call in the parent agent; '' when not launched from a tool call",
|
||||
model: 'Model alias the subagent binds to (secondary-model choice or inherited caller model); omitted when no binding was resolved',
|
||||
},
|
||||
}),
|
||||
mcp_connected: defineTelemetryEvent<McpConnectedEvent>({
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import { IAgentProfileService } from '#/agent/profile/profile';
|
|||
import { isProviderRateLimitError } from '#/kosong/contract/errors';
|
||||
import { type TokenUsage } from '#/kosong/contract/usage';
|
||||
import { ITelemetryService } from '#/app/telemetry/telemetry';
|
||||
import type { SubagentCreatedEvent } from '#/app/telemetry/events';
|
||||
import { Event2 } from '#/app/event/event2';
|
||||
import { isAbortError } from '#/_base/utils/abort';
|
||||
import { IAgentLifecycleService } from '#/session/agentLifecycle/agentLifecycle';
|
||||
|
|
@ -114,13 +115,15 @@ export function emitAgentRunSpawned(
|
|||
}),
|
||||
);
|
||||
childProfile?.republishStatus();
|
||||
requester.accessor.get(ITelemetryService)?.track2('subagent_created', {
|
||||
const telemetryEvent: SubagentCreatedEvent = {
|
||||
subagent_name: meta.profileName,
|
||||
run_in_background: meta.runInBackground ?? false,
|
||||
agent_id: targetAgentId,
|
||||
parent_agent_id: requester.id,
|
||||
parent_tool_call_id: meta.parentToolCallId ?? '',
|
||||
});
|
||||
model: meta.model,
|
||||
};
|
||||
requester.accessor.get(ITelemetryService)?.track2('subagent_created', telemetryEvent);
|
||||
}
|
||||
|
||||
export async function mirrorAgentRun(
|
||||
|
|
|
|||
|
|
@ -1532,6 +1532,7 @@ describe('Agent tool execution contract', () => {
|
|||
agent_id: 'agent-child',
|
||||
parent_agent_id: 'main',
|
||||
parent_tool_call_id: 'call_agent',
|
||||
model: 'provider/secondary',
|
||||
},
|
||||
});
|
||||
expect(events.find((event) => event.type === 'subagent.completed')).toMatchObject({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue