---
title: kiliczsh/genui-agent-protocol
framework: Swift Package Catalog
role: article
path: packages/kiliczsh/genui-agent-protocol
---

# kiliczsh/genui-agent-protocol

Minimal, versioned JSON contract shared by GenUI clients and cloud agent

## Client commands

| Type | Purpose | |---|---| | `session.start` | Start a session for an OpenAI or Anthropic provider | | `message.send` | Send one user message to the active session | | `session.interrupt` | Interrupt the active agent turn |

## Agent events

| Type | Purpose | |---|---| | `session.started` | Confirm the created session and selected provider | | `agent.text` | Stream or complete assistant text using `isFinal` | | `a2ui.message` | Deliver one A2UI v1.0 message to the client renderer | | `turn.completed` | Mark a normal or interrupted turn as complete | | `error` | Deliver a shared, retry-aware error payload |

Every command carries `protocolVersion`, `commandId`, and `sessionId`. Every event carries `protocolVersion`, `eventId`, `sessionId`, a monotonic `sequence`, and an ISO 8601 `timestamp`.

## Repository layout

- `schemas/client-command.schema.json` - `schemas/agent-event.schema.json` - `schemas/session.schema.json` - `schemas/error.schema.json` - `examples/` - `generated/swift/` - `Package.swift` - `VERSION`

The protocol transports A2UI envelopes but does not replace A2UI catalog or component validation. The cloud runtime and native renderer must still validate messages against their allowed catalogs.

## Swift package

The `GenUIAgentProtocol` Swift Package exposes typed commands, event decoding, and dynamic JSON/A2UI values for Apple clients.

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

```swift import GenUIAgentProtocol

// Encode a command let command = StartSessionCommand(     commandId: UUID().uuidString,     sessionId: "session-123",     provider: .openai ) let data = try JSONEncoder().encode(command)

// Decode any incoming event let event = try JSONDecoder().decode(AgentEvent.self, from: frame) switch event { case .agentText(let envelope): print(envelope.payload.text) case .a2uiMessage(let envelope): render(envelope.payload.message) default: break } ```

Automated generation, TypeScript model generation, compatibility automation, and broader session features remain deferred.

This repository is included in [`kiliczsh/genui`](https://github.com/kiliczsh/genui) as `protocol/genui-agent-protocol`.

## Package Metadata

Repository: kiliczsh/genui-agent-protocol

Default branch: main

README: README.md
