Aller au contenu
Skillpedia
Agents7.8k · #12831

agent-squad-swift

Ce qu’il fait

Ce guide aide l'IA à créer une application Swift qui utilise le framework AgentSquad pour coordonner des agents IA sur l'appareil. Il s'adresse aux développeurs Swift qui travaillent sur des applications iOS ou macOS.

Quand l’utiliser

  • ✓Quand je veux ajouter un seul assistant IA à une application iPhone ou Mac écrite en Swift.
  • ✓Lorsque j'ai besoin de plusieurs agents IA spécialisés, et qu'un routeur choisit le bon pour chaque message.
  • ✓Quand mon application doit donner des réponses IA conformes à des données en direct, comme des prix ou des soldes.

Lien du skill

https://github.com/2FastLabs/agent-squad/blob/main/swift/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/2FastLabs/agent-squad/blob/main/swift/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Je veux ajouter un assistant IA à plusieurs agents à mon application iPhone en Swift, avec AgentSquad. Par où dois-je commencer ?”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

Le guide oriente l'IA vers les bons éléments, comme les agents, le routeur et les outils, et explique les points de vigilance. Il ne remplace pas la référence officielle.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis 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 (or GroundedAgent) + an Orchestrator with 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 of Agent) or OpenAIGroundedVoiceAssistant (Brain → Presenter, can't drift from data — analog of GroundedAgent).

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

  • Orchestrator drives a turn. The classifier is optional — omit it for a single agent.
  • Agent is one LLM with an internal tool loop. GroundedAgent is 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; presenterInput picks .questionAndData (default) or .dataOnly.
  • ChatCompletionsClient speaks the OpenAI wire — point its baseURL at OpenAI, Azure, OpenRouter, Groq, or a local Ollama/llama.cpp. Implement LLMClient for anything else.
  • Tools come from a ToolProvider. Built-ins: ToolKit holds native tools — Tool.local (Swift closure) and Tool.http/Tool.get/.post (declarative HTTP, with a ToolParameter DSL 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; and AggregateToolProvider composes any mix behind one seam; DakeraRetriever(namespace:…) is a ToolProvider backed by a self-hosted Dakera memory server — it exposes a search_memory tool for grounding (and a direct retrieve(_:) API), talking to Dakera's REST endpoint over URLSession with no extra dependency. A ToolResult is three-part: text → the model's context, structuredContent → curator/UI data,
Questions fréquentes

Quels systèmes Apple sont pris en charge ?

Le framework vise iOS 16 et les versions ultérieures, ainsi que macOS 14 et les versions ultérieures.

Ce guide est-il réservé aux experts ?

Il s'adresse aux développeurs qui créent déjà des applications Swift et veulent utiliser ce framework.

Les agents peuvent-ils utiliser des outils externes ?

Oui, le framework prend en charge les outils natifs et les outils fournis par des serveurs MCP.

Détails

Description originale de l’auteur

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

Popularité

Étoiles GitHub
7.8k
Position au classement
#12831
Licence
Apache-2.0
Mis à jour
08/10/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires