Langsung ke konten
Skillpedia
Agen7.8k ยท #12831

agent-squad-swift

Fungsinya

Panduan ini membantu AI membangun aplikasi Swift yang memakai kerangka kerja AgentSquad untuk mengoordinasikan agent AI di perangkat. Panduan ini cocok untuk pengembang Swift yang mengerjakan aplikasi iOS atau macOS.

Kapan dipakai

  • โœ“Saat saya ingin menambahkan satu asisten AI ke aplikasi iPhone atau Mac yang ditulis dengan Swift.
  • โœ“Saat saya membutuhkan beberapa agent AI spesialis, dan router memilih yang tepat untuk setiap pesan.
  • โœ“Saat aplikasi saya membutuhkan jawaban AI yang harus sesuai dengan data langsung, seperti harga atau saldo.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/2FastLabs/agent-squad/blob/main/swift/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit โ†’

Contoh permintaan ke AI

โ€œSaya ingin menambahkan asisten AI multi-agent ke aplikasi iPhone Swift saya menggunakan AgentSquad. Dari mana saya harus mulai?โ€

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Panduan ini mengarahkan AI ke blok bangunan yang tepat, seperti agent, router, dan alat, lalu menjelaskan hal-hal yang perlu diwaspadai. Panduan ini tidak menggantikan referensi resmi.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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,
Pertanyaan umum

Sistem Apple mana yang didukung?

Kerangka kerja ini ditujukan untuk iOS 16 ke atas dan macOS 14 ke atas.

Apakah panduan ini hanya untuk ahli?

Panduan ini ditujukan untuk pengembang yang sudah membangun aplikasi Swift dan ingin memakai kerangka kerja ini.

Apakah agent bisa memakai alat dari luar?

Bisa. Kerangka kerja ini mendukung alat bawaan dan alat yang disediakan oleh server MCP.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
7.8k
Peringkat
#12831
Lisensi
Apache-2.0
Diperbarui
8/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • โ€ฆ

Skill lain dari repositori ini

Skill serupa