agent-squad-swift
O que ela faz
Este guia ajuda a IA a criar um app em Swift que usa o framework AgentSquad para coordenar agentes de IA no próprio aparelho. Ele é para desenvolvedores Swift que trabalham com apps para iOS ou macOS.
Quando usar
- ✓Quando eu quero adicionar um único assistente de IA a um app para iPhone ou Mac escrito em Swift.
- ✓Quando eu preciso de vários agentes de IA especialistas, e um roteador escolhe o certo para cada mensagem.
- ✓Quando meu app precisa de respostas de IA que batam com dados ao vivo, como preços ou saldos.
Link da skill
https://github.com/2FastLabs/agent-squad/blob/main/swift/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Quero adicionar um assistente de IA com vários agentes ao meu app de iPhone em Swift usando o AgentSquad. Por onde começo?”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
O guia aponta para a IA os blocos certos, como agentes, um roteador e ferramentas, e explica o que observar. Ele não substitui a referência oficial.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do 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,
Perguntas frequentes
Quais sistemas da Apple ele suporta?
O framework é voltado para iOS 16 ou mais recente e macOS 14 ou mais recente.
Este guia é só para especialistas?
Ele é para desenvolvedores que já criam apps em Swift e querem usar este framework.
Os agentes podem usar ferramentas externas?
Sim. O framework oferece suporte a ferramentas nativas e a ferramentas fornecidas por servidores MCP.
Detalhes
Descrição original do autor
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
Popularidade
- Estrelas no GitHub
- 7,8 mil
- Posição no ranking
- #12831
- Licença
- Apache-2.0
- Atualizada em
- 08/10/2026
Comentários
- …
Mais skills deste repositório
agent-squad-python
7,8 milAjuda seu agente a criar um app em Python com o pacote agent-squad, um framework para coordenar vários agentes de IA, direcionar pedidos e compartilhar ferramentas.
agent-squad-typescript
7,8 milAjuda seu agente a criar apps Node.js em que vários agentes de IA trabalham juntos, com direcionamento, armazenamento de dados e conexões com ferramentas externas.
Skills parecidas
add-model-provider
394 milPermite que seu agente conecte um novo provedor de modelos de IA ao OpenClaw com comandos seguros, guarde as chaves de API com segurança e faça um teste ao vivo.
acp-router
394 milAjuda seu agente a enviar uma tarefa a um assistente de programação, como Claude Code ou Cursor, pelo OpenClaw, para que o trabalho rode nessa ferramenta.
browser-automation
394 milEnsina seu agente a controlar páginas web passo a passo, incluindo logins, abas e recuperação quando uma página para de responder.