@@ -163,12 +163,15 @@ func (instance *Traceloop) NewAgent(ctx context.Context, name string, associatio
163163 sdk : instance ,
164164 workflow : nil ,
165165 ctx : aCtx ,
166- Name : name ,
166+ Attributes : AgentAttributes {
167+ Name : name ,
168+ AssociationProperties : associationProperties ,
169+ },
167170 }
168171}
169172
170173// New workflow-based API
171- func (instance * Traceloop ) LogPrompt (ctx context.Context , prompt Prompt , workflowAttrs * WorkflowAttributes ) LLMSpan {
174+ func (instance * Traceloop ) LogPrompt (ctx context.Context , prompt Prompt , contextAttrs ContextAttributes ) LLMSpan {
172175 spanName := fmt .Sprintf ("%s.%s" , prompt .Vendor , prompt .Mode )
173176 _ , span := instance .getTracer ().Start (ctx , spanName )
174177
@@ -178,14 +181,19 @@ func (instance *Traceloop) LogPrompt(ctx context.Context, prompt Prompt, workflo
178181 semconvai .LLMRequestType .String (prompt .Mode ),
179182 }
180183
181- if workflowAttrs != nil {
182- attrs = append (attrs , semconvai .TraceloopWorkflowName .String (workflowAttrs .Name ))
184+ if contextAttrs .WorkflowName != nil {
185+ attrs = append (attrs , semconvai .TraceloopWorkflowName .String (* contextAttrs .WorkflowName ))
186+ }
183187
184- // Add association properties if provided
185- for key , value := range workflowAttrs .AssociationProperties {
186- attrs = append (attrs , attribute .String ("traceloop.association.properties." + key , value ))
187- }
188+ if contextAttrs .AgentName != nil {
189+ attrs = append (attrs , semconvai .LLMAgentName .String (* contextAttrs .AgentName ))
190+ }
191+
192+ // Add association properties
193+ for key , value := range contextAttrs .AssociationProperties {
194+ attrs = append (attrs , attribute .String ("traceloop.association.properties." + key , value ))
188195 }
196+
189197
190198 span .SetAttributes (attrs ... )
191199 setMessagesAttribute (span , "llm.prompts" , prompt .Messages )
0 commit comments