---
schema_version: "1"
id: 39080915b89717d837321f4c1ddba677b8603081b409a5af89586fcd5d72180d
title: Untitled
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/genai/agentforce-mobile-sdk/references/ios/agentforce-instrumentation-handler-ios.md
canonical_url: https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/references/agentforce-mobile-sdk/agentforce-instrumentation-handler-ios.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: c98d04a2d18a25590594c945ed27cfb86eadf3d33bfae53563889c3e16712b08
products:
  - Agentforce Mobile SDK
  - Agentforce and Einstein Generative AI
---
## Overview

Protocol for handling instrumentation events from the Agentforce SDK. This protocol defines the interface for receiving and processing analytics and monitoring events generated throughout the SDK. Implementations can integrate with various analytics platforms, logging systems, or monitoring services.

## Declaration

```swift
protocol AgentforceInstrumentationHandling
```

## Methods

| Method                       | Signature                                                                | Description                                                 |
| ---------------------------- | ------------------------------------------------------------------------ | ----------------------------------------------------------- |
| `handleInstrumentationEvent` | `func handleInstrumentationEvent(event: AgentforceInstrumentationEvent)` | Processes an instrumentation event from the Agentforce SDK. |

## Implementation Patterns

### Analytics Integration

```swift
class AnalyticsHandler: AgentforceInstrumentationHandling {
    func handleInstrumentationEvent(event: AgentforceInstrumentationEvent) {
        switch event {
        case .userInteractionEvent(let eventInfo):
            Analytics.track(eventInfo.name, properties: eventInfo.properties)
        case .perfEvent(let eventInfo):
            PerformanceMonitor.recordTiming(eventInfo.name,
                                          duration: eventInfo.endTime - eventInfo.startTime)
        case .errorEvent(let eventInfo):
            ErrorTracker.logError(eventInfo.error, context: eventInfo.properties)
        }
    }
}
```

### Multi-Platform Handling

```swift
class MultiPlatformHandler: AgentforceInstrumentationHandling {
    private let analyticsProviders: [AnalyticsProvider]

    func handleInstrumentationEvent(event: AgentforceInstrumentationEvent) {
        // Send to multiple analytics platforms
        analyticsProviders.forEach { provider in
            provider.track(event)
        }
    }
}
```
