Docs
Collect feedback from your Swift app
Add native feedback to your macOS or iOS app with the Agentback Swift Package. It submits reports from your existing form with async/await. Pulse Mac is the first integration, using its Support settings alongside its email feedback action.
Install the package
In Xcode, choose File → Add Package Dependencies and enter the repository URL:
texthttps://github.com/superagents-lab/agentback-swift.git
Select Up to Next Major Version starting at 0.1.0, then add the
Agentback product to your app target. For a SwiftPM project:swift// Package dependencies:.package(url: "https://github.com/superagents-lab/agentback-swift.git", from: "0.1.0")// Target dependencies:.product(name: "Agentback", package: "agentback-swift")
The package requires Swift 6 and supports macOS 12+ and iOS 15+. It uses Foundation and has no third-party dependencies. Source and releases are public under the MIT license.
This is the core SDK: use your app's own feedback form. Version 0.1.0 submits text feedback; it does not include a default UI or support log files, screenshots or other attachments.
Connect your form
Create or select a project in the console, then copy its public project key (
af_ followed by 64 hexadecimal characters). The key can only submit feedback and is safe to ship in an app. Never embed a server secret, identity secret or account access token.swiftimport Foundationimport Agentbacklet client = try Agentback(projectKey: "af_..." /* your actual public project key */)let receipt = try await client.send(.init(message: message,category: .bug,version: Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String))// Show success only after send returns a receipt.
Use
.bug, .featureRequest, .docs or .other for the category. Native user feedback uses source direct. Only explicitly supplied fields are sent; the SDK does not collect diagnostics, device identifiers or account information.Keep your app's existing feedback entry point and styling. While sending, disable editing and repeated submission. On failure, keep the user's draft and offer your existing email contact option. The message limit is 4000 UTF-16 code units (
message.utf16.count in Swift), matching the service's limit even for emoji.Handle errors
send returns only after HTTP 201 and a valid receipt. AgentbackError distinguishes invalid configuration, invalid fields, network failure, invalid responses and .http(status:retryAfter:). A numeric Retry-After header is exposed in seconds. The retryable property is true for network errors, HTTP 429 and 5xx. Cancellation throws CancellationError.The client has a 20-second request timeout and does not retry or queue automatically: after a lost response, the report might already be stored. Let the user decide whether to retry and do not clear their draft on failure.
Accounts and additional fields
Reports are anonymous by default. If your backend signs an opaque account ID, pass
Agentback.Identity(account:signature:) as the report's identity. Follow the verified accounts guide; never compute signatures with an embedded secret in the app.The report also accepts
outcome, intent, expected, actual, suggestion, tool, requestID and agent. For a local Swift MCP server or CLI, explicitly set source: .mcp or .cli. See the HTTP field reference for their limits. Server-only context and report status are not accepted by this client.Verify
Clone the SDK repository and run
swift test there, then build your app targets with the package dependency. The package tests use a mock transport and send no live feedback or email. For local end-to-end testing, initialize a client with a loopback origin, such as http://127.0.0.1:3020, and use a local Agentback project with the preview mail sink. Custom origins otherwise require HTTPS.