agent-squad-swift
Qué hace
Esta guía ayuda a la IA a crear una app en Swift que usa el marco AgentSquad para coordinar agentes de IA en el dispositivo. Está pensada para desarrolladores de Swift que trabajan en apps para iOS o macOS.
Cuándo usarla
- ✓Cuando quiero añadir un asistente de IA único a una app para iPhone o Mac escrita en Swift.
- ✓Cuando necesito varios agentes de IA especialistas, y un enrutador elige el adecuado para cada mensaje.
- ✓Cuando mi app necesita respuestas de IA que coincidan con datos en vivo, como precios o saldos.
Link de la skill
https://github.com/2FastLabs/agent-squad/blob/main/swift/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Quiero añadir un asistente de IA con varios agentes a mi app de iPhone en Swift usando AgentSquad. ¿Por dónde empiezo?”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
La guía indica a la IA las piezas adecuadas, como los agentes, el enrutador y las herramientas, y explica qué debe vigilar. No sustituye la referencia oficial.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de 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,
Preguntas frecuentes
¿Qué sistemas de Apple admite?
El marco está pensado para iOS 16 o posterior y macOS 14 o posterior.
¿Esta guía es solo para expertos?
Está pensada para desarrolladores que ya crean apps en Swift y quieren usar este marco.
¿Los agentes pueden usar herramientas externas?
Sí. El marco admite herramientas nativas y herramientas proporcionadas por servidores MCP.
Detalles
Descripción original del 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
Popularidad
- Estrellas en GitHub
- 7,8 mil
- Posición en el ranking
- #12831
- Licencia
- Apache-2.0
- Actualizada
- 8/10/2026
Comentarios
- …
Más skills de este repositorio
agent-squad-python
7,8 milAyuda a tu agente a crear una app en Python con el paquete agent-squad, un marco para coordinar varios agentes de IA, enrutar peticiones y compartir herramientas.
agent-squad-typescript
7,8 milAyuda a tu agente a crear apps en Node.js donde varios agentes de IA trabajan juntos, con enrutamiento, almacenamiento de datos y conexiones a herramientas externas.
Skills parecidas
add-model-provider
394 milPermite que tu agente conecte un nuevo proveedor de modelos de IA a OpenClaw con comandos de configuración seguros, mantenga las claves API fuera del texto plano y haga una prueba en vivo.
acp-router
394 milAyuda a tu agente a enviar una tarea a un asistente de programación como Claude Code o Cursor a través de OpenClaw, para que el trabajo se ejecute en esa herramienta.
browser-automation
394 milEnseña a tu agente a controlar páginas web paso a paso, incluidos los inicios de sesión, las pestañas y la recuperación cuando una página deja de responder.