agent-squad-swift
Что он делает
Это руководство помогает ИИ создать приложение на Swift, которое использует фреймворк AgentSquad для координации ИИ-агентов на устройстве. Оно нужно Swift-разработчикам, которые работают над приложениями для iOS или macOS.
Когда использовать
- ✓Когда я хочу добавить одного ИИ-ассистента в приложение для iPhone или Mac, написанное на Swift.
- ✓Когда нужны несколько специализированных ИИ-агентов, а маршрутизатор выбирает подходящего для каждого сообщения.
- ✓Когда приложению нужны ИИ-ответы, которые должны совпадать с живыми данными, например ценами или балансами.
Ссылка на скилл
https://github.com/2FastLabs/agent-squad/blob/main/swift/SKILL.mdСкопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.
Как использовать
Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.
Готовое сообщение для вставки
Для Claude Code, Codex или Cursor: запустите в папке проекта, и скилл установится.
Скачайте SKILL.md и положите его в папку скиллов вашего агента.
Пример запроса к вашему ИИ
“Я хочу добавить мультиагентного ИИ-ассистента в моё приложение для iPhone на Swift с AgentSquad. С чего начать?”
5 новых скиллов в неделю. 1 минута чтения.
Как это работает
Руководство направляет ИИ к нужным строительным блокам, например агентам, маршрутизатору и инструментам, и объясняет, на что обратить внимание. Оно не заменяет официальный справочник.
Технический текст (оригинальный SKILL.md)
Оригинальный текст автора на английском, прямо с GitHub.
AgentSquad Swift — assistant guide
Protocol-driven, on-device multi-agent framework (Swift 6.2, iOS 16+ / macOS 14+; persistence via
FileChatStorage on iOS 16+, DeviceChatStorage on iOS 17+). This is guidance and
a map — not an API reference. Read the exact signatures from the source (swift/Sources/AgentSquad/)
and the worked recipes from the docs site sources (docs/src/content/docs/swift/); this file tells
you what to use, when, and what to watch out for.
When to use what
- One assistant → an
Agent(orGroundedAgent) + anOrchestratorwith no classifier. No routing hop. - Several specialists → multiple agents + an
LLMClassifier; the orchestrator routes each turn. - Answers must not drift from data (prices, stock, balances) →
GroundedAgent: a Brain calls tools, an isolated Presenter speaks only from the curated results (it can be a smaller/local model). - Voice → a
VoiceAssistant(a peer of the orchestrator, not an agent):OpenAIVoiceAssistant(single LLM + tools, speaks directly — the spoken analog ofAgent) orOpenAIGroundedVoiceAssistant(Brain → Presenter, can't drift from data — analog ofGroundedAgent).
Every component is a Sendable protocol with one built-in implementation — swap in your own anywhere.
Modules (import only what you use)
| Import | Pulls in | Contents |
|---|---|---|
AgentSquad |
nothing external | protocols, Agent, GroundedAgent, Orchestrator, LLMClassifier, ChatCompletionsClient, DakeraRetriever, FileChatStorage, DeviceChatStorage, InMemoryChatStorage, TransformingChatStorage, SummarizingChatStorage, OSLogTracer, OTLP export |
AgentSquadMCP |
MCP Swift SDK | MCPServer (= MCPToolProvider), SDKMCPClient |
AgentSquadAudio |
AVFoundation | VoiceProcessedAudioIO (capture+playback, one engine, AEC — the recommended wiring), MicCapture (voice-processed/AEC by default), AudioPlayback, VoiceProcessing, AudioSessionPolicy (needs NSMicrophoneUsageDescription) |
SwiftPM: .package(url: "https://github.com/2FastLabs/agent-squad", branch: "main").
How a turn works
Two peer runtimes share contracts but not a control loop: a turn-based Orchestrator
(classify? → run agent → stream → persist) and a long-lived VoiceAssistant for voice. Either
way you consume an AsyncThrowingStream<AgentEvent, any Error> — the one idiom worth memorizing:
for try await event in orchestrator.route(.text("hello"), userId: "u1", sessionId: "s1") {
switch event {
case .textDelta(let token): /* stream tokens */
case .final(let message): /* the message that was persisted */
case .toolCall, .widget, .thinking, .error: break // .error is a user-facing string
}
}
.error carries a user-facing message; real programmer/transport failures throw through the
stream. .final is what the orchestrator persists. Inputs/messages are value types
(AgentInput.text, ConversationMessage, ContentPart, JSONValue) in Sources/AgentSquad/Core/.
The pieces
Orchestratordrives a turn. The classifier is optional — omit it for a single agent.Agentis one LLM with an internal tool loop.GroundedAgentis two LLMs (Brain + isolated Presenter) for answers that must stay grounded in tool results. The Presenter never sees chat history or the Brain's transcript;presenterInputpicks.questionAndData(default) or.dataOnly.ChatCompletionsClientspeaks the OpenAI wire — point itsbaseURLat OpenAI, Azure, OpenRouter, Groq, or a local Ollama/llama.cpp. ImplementLLMClientfor anything else.- Tools come from a
ToolProvider. Built-ins:ToolKitholds native tools —Tool.local(Swift closure) andTool.http/Tool.get/.post(declarative HTTP, with aToolParameterDSL so you don't hand-write JSON Schema);HTTPToolGroup(baseURL:…)declares one API's shared config once, then one line per endpoint;MCPServer(url:)connects an MCP server; andAggregateToolProvidercomposes any mix behind one seam;DakeraRetriever(namespace:…)is aToolProviderbacked by a self-hosted Dakera memory server — it exposes asearch_memorytool for grounding (and a directretrieve(_:)API), talking to Dakera's REST endpoint overURLSessionwith no extra dependency. AToolResultis three-part: text → the model's context,structuredContent→ curator/UI data,
Частые вопросы
Какие системы Apple поддерживаются?
Фреймворк рассчитан на iOS 16 и новее и на macOS 14 и новее.
Это руководство только для экспертов?
Оно для разработчиков, которые уже создают приложения на Swift и хотят использовать этот фреймворк.
Могут ли агенты использовать внешние инструменты?
Да, фреймворк поддерживает собственные инструменты и инструменты с серверов MCP.
Подробности
Оригинальное описание автора
Use when building or modifying a Swift app that uses the AgentSquad Swift framework — on-device multi-agent orchestration for iOS 16+ / macOS 14+: orchestrator, agents (Agent, GroundedAgent), classifier routing, LLM clients (OpenAI-compatible), tools (native + MCP), tool UIs/widgets, on-device storage, tracing, and realtime voice — built-in types and custom implementations.
repo: 2FastLabs/agent-squad
Популярность
- Звёзды на GitHub
- 7.8k
- Место в рейтинге
- #12831
- Лицензия
- Apache-2.0
- Обновлён
- 08.10.2026
Комментарии
- …
Другие скиллы из этого репозитория
agent-squad-python
7.8kПомогает агенту построить Python-приложение на пакете agent-squad: координация нескольких ИИ-агентов, маршрутизация запросов и общие инструменты.
agent-squad-typescript
7.8kПомогает агенту создавать приложения на Node.js, где несколько ИИ-агентов работают вместе, с маршрутизацией, хранением данных и подключением внешних инструментов.
Похожие скиллы
add-model-provider
394kПомогает агенту подключить нового провайдера ИИ-моделей к OpenClaw безопасными командами, хранить ключи API не в открытом виде и провести живой тест.
acp-router
394kПомогает агенту передать задачу инструменту для программирования, например Claude Code или Cursor, через OpenClaw, чтобы работа шла в этом инструменте.
browser-automation
394kУчит агента пошагово управлять веб-страницами: входить в аккаунты, работать с вкладками и восстанавливаться, если страница перестала отвечать.