Contents

kiliczsh/genui-agent-client-swift

Swift client SDK for connecting applications to a GenUI cloud agent

Features

  • Actor-isolated client with full Swift 6 strict concurrency
  • Typed session lifecycle: startSession, sendMessage, interrupt, close
  • Single AsyncThrowingStream of agent text, A2UI, turn, and error events
  • Protocol-version, session-id, and monotonic sequence validation on every event
  • Pluggable transport: AgentTransport protocol with a

URLSessionWebSocketTask implementation included

Requirements

  • iOS 16+ / macOS 13+
  • Swift 6.0+

Installation

.package(url: "https://github.com/kiliczsh/genui-agent-client-swift.git", from: "0.1.0")

Products: GenUIAgentClient (session API) and GenUIWebSocketTransport (default transport). Custom transports only need GenUIAgentTransport.

Usage

import GenUIAgentClient
import GenUIAgentProtocol
import GenUIWebSocketTransport

let transport = URLSessionWebSocketTransport()
let client = GenUIAgentClient(
    sessionId: "session-123",
    transport: transport
)

try await client.connect(
    to: URL(
        string: "wss://example.com/v1/sessions/session-123/websocket"
    )!
)
try await client.startSession(provider: .openai)
try await client.sendMessage("Show my workspace")

for try await event in client.events {
    // Route text and A2UI events into application state.
}

Scope

The package keeps transport concerns separate from application UI and from provider-specific backend implementations. SSE, authentication headers, reconnect, and session resume are planned follow-up work.

This repository is included in the kiliczsh/genui workspace as a Git submodule.

Package Metadata

Repository: kiliczsh/genui-agent-client-swift

Default branch: main

README: README.md