| 250 | } |
| 251 | |
| 252 | func buildBehaviorFingerprint(processedRun ProcessedRun, metrics MetricsData, toolUsage []ToolUsageInfo, createdItems []CreatedItemReport, awContext *AwContext) *BehaviorFingerprint { |
| 253 | auditAgenticLog.Printf("Building behavior fingerprint: run_id=%d turns=%d tool_types=%d created_items=%d", processedRun.Run.DatabaseID, metrics.Turns, len(toolUsage), len(createdItems)) |
| 254 | toolTypes := len(toolUsage) |
| 255 | writeCount := len(createdItems) + processedRun.Run.SafeItemsCount |
| 256 | |
| 257 | executionStyle := "directed" |
| 258 | switch { |
| 259 | case metrics.Turns >= 10 || toolTypes >= 6: |
| 260 | executionStyle = "exploratory" |
| 261 | case metrics.Turns >= 5 || toolTypes >= 4: |
| 262 | executionStyle = "adaptive" |
| 263 | } |
| 264 | |
| 265 | toolBreadth := "narrow" |
| 266 | switch { |
| 267 | case toolTypes >= 6: |
| 268 | toolBreadth = "broad" |
| 269 | case toolTypes >= 3: |
| 270 | toolBreadth = "moderate" |
| 271 | } |
| 272 | |
| 273 | actuationStyle := "read_only" |
| 274 | switch { |
| 275 | case writeCount >= 6: |
| 276 | actuationStyle = "write_heavy" |
| 277 | case writeCount > 0: |
| 278 | actuationStyle = "selective_write" |
| 279 | } |
| 280 | |
| 281 | resourceProfile := "lean" |
| 282 | switch { |
| 283 | case processedRun.Run.Duration >= 15*time.Minute || metrics.Turns >= 12 || toolTypes >= 6 || writeCount >= 8: |
| 284 | resourceProfile = "heavy" |
| 285 | case processedRun.Run.Duration >= 5*time.Minute || metrics.Turns >= 6 || toolTypes >= 4 || writeCount >= 3: |
| 286 | resourceProfile = "moderate" |
| 287 | } |
| 288 | |
| 289 | dispatchMode := "standalone" |
| 290 | if awContext != nil { |
| 291 | dispatchMode = "delegated" |
| 292 | } |
| 293 | |
| 294 | agenticFraction := computeAgenticFraction(processedRun) |
| 295 | |
| 296 | auditAgenticLog.Printf("Behavior fingerprint: execution=%s breadth=%s actuation=%s resource=%s dispatch=%s agentic_fraction=%.2f", executionStyle, toolBreadth, actuationStyle, resourceProfile, dispatchMode, agenticFraction) |
| 297 | return &BehaviorFingerprint{ |
| 298 | ExecutionStyle: executionStyle, |
| 299 | ToolBreadth: toolBreadth, |
| 300 | ActuationStyle: actuationStyle, |
| 301 | ResourceProfile: resourceProfile, |
| 302 | DispatchMode: dispatchMode, |
| 303 | AgenticFraction: agenticFraction, |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | func buildAgenticAssessments(processedRun ProcessedRun, metrics MetricsData, toolUsage []ToolUsageInfo, createdItems []CreatedItemReport, domain *TaskDomainInfo, fingerprint *BehaviorFingerprint, awContext *AwContext) []AgenticAssessment { |
| 308 | if domain == nil || fingerprint == nil { |