Complete, runnable sample applications demonstrating the a2a-swift SDK in real-world scenarios. Each sample is a standalone Swift package that you can build and run independently.
Looking for quick code snippets? Check out
Examples/for single-file reference implementations of agents and clients.
| Sample | Description | Stack |
|---|---|---|
| A2AServer | Dockerized product catalog agent with Ollama LLM | Vapor · Docker · Ollama |
| A2AChatClient | macOS chat client with multi-agent support | SwiftUI · Foundation Models |
Before running the samples, make sure you have the following installed:
| Tool | Required for | Install |
|---|---|---|
| Docker Desktop | A2AServer | brew install --cask docker |
| Xcode 26+ | A2AChatClient | Mac App Store |
| Swift 6.0+ | Both (local builds) | Included with Xcode |
No Docker? You can also run the server locally with
swift run— see A2AServer README for details.
Run both apps end-to-end in under 5 minutes:
cd Samples/A2AServer
docker compose up --buildFirst run pulls the Ollama image and qwen3:0.6b model (~500MB). Wait until you see:
a2a-server-1 | Starting Product Catalog Agent (20 products) with Ollama at http://ollama:11434
# In a new terminal
curl http://localhost:8080/.well-known/agent-card.json | jq .name
# → "Tech Store Product Catalog"cd Samples/A2AChatClient
open Package.swift
# Xcode opens → Build & Run (⌘R)- In the app sidebar, click "Connect an Agent"
- Enter
http://localhost:8080 - Click Connect — you'll see the agent's name and skills
- Try: "What laptops do you have?", then follow up with "Which one is cheaper?"
# Option A: With Ollama (natural language responses)
brew install ollama
ollama serve &
ollama pull qwen3:0.6b
cd Samples/A2AServer
OLLAMA_HOST=http://localhost:11434 swift run
# Option B: Without Ollama (returns raw search results, no setup needed)
cd Samples/A2AServer
swift run┌──────────────────────┐ A2A Protocol ┌──────────────────────┐
│ A2AChatClient │ ◄──── (JSON-RPC + SSE) ────► │ A2AServer │
│ │ │ │
│ SwiftUI + FM │ 1. Agent card discovery │ Vapor + Ollama │
│ orchestration │ 2. SendMessage (streaming) │ product catalog │
│ │ 3. Task continuations │ conversation memory │
└──────────────────────┘ └──────────────────────┘
Both apps use the a2a-swift SDK (A2A package) — the server uses AgentExecutor, DefaultRequestHandler, and A2ARouter; the client uses A2AClient for discovery and streaming communication.