MCPcopy Index your code
hub / github.com/simstudioai/sim / setAgentOutputMessages

Function setAgentOutputMessages

apps/sim/lib/copilot/request/otel.ts:184–203  ·  view source on GitHub ↗
(span: Span, output: CopilotAgentOutputMessages)

Source from the content-addressed store, hash-verified

182}
183
184function setAgentOutputMessages(span: Span, output: CopilotAgentOutputMessages): void {
185 if (!isGenAIMessageCaptureEnabled()) return
186 const parts: GenAIAgentPart[] = []
187 if (output.assistantText) {
188 parts.push({ type: 'text', content: output.assistantText })
189 }
190 for (const tc of output.toolCalls ?? []) {
191 parts.push({
192 type: 'tool_call',
193 id: tc.id,
194 name: tc.name,
195 ...(tc.arguments ? { arguments: tc.arguments } : {}),
196 })
197 }
198 if (parts.length === 0) return
199 const serialized = marshalAgentMessages([{ role: 'assistant', parts }])
200 if (serialized) {
201 span.setAttribute(TraceAttr.GenAiOutputMessages, serialized)
202 }
203}
204
205export type CopilotLifecycleOutcome =
206 (typeof RequestTraceV1Outcome)[keyof typeof RequestTraceV1Outcome]

Callers 1

startCopilotOtelRootFunction · 0.85

Calls 3

marshalAgentMessagesFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected