SwiftAgent
achimala/SwiftAgent
Swift package that embeds Hermes Agent, CPython and an iSH shell inside an iOS app
SwiftAgent is a Swift package for embedding an AI agent in an iOS app, with Hermes Agent as its first supported runtime. It bundles CPython and Hermes, streams agent events to SwiftUI and gives the agent an iOS-safe workspace with file tools and an embedded iSH shell.
What SwiftAgent does
SwiftAgent runs Hermes in process inside an iOS app. It embeds CPython, bundles Hermes and its Python dependencies, and exposes a Swift API for creating an agent, sending messages, streaming events and managing sessions. A HermesAgentConfiguration such as the OpenAI helper takes an API key and model, and agent.send returns a response while delivering events to a callback. The agent gets a workspace with file read and write tools that work across the iOS host filesystem and the iSH workspace, plus shell commands through an embedded iSH.
The app bundle is expected to hold a Python payload at PythonApp/hermes. A Run Script build phase calls swiftagent-install-hermes.sh, which fetches the pinned Hermes release if needed, stages platform-specific Python packages, installs the Python stdlib and converts native extension modules into signed app frameworks. The package also includes a sample iOS chat app, mock shell and model providers for tests, an optional local MLX provider proof of concept, and an Apple Foundation Models experiment for iOS 26+.
Key features
- High-level Swift API for creating an agent, sending messages, streaming events and managing sessions
- Embedded CPython with Hermes and its dependencies bundled
- iSH-backed shell and file tools inside an app workspace
- Build script that stages a pinned Hermes release and signs native extensions as frameworks
- Sample iOS chat app and mock providers for tests
- Optional add-on packages for local MLX models and Apple Foundation Models
When to use it
- Building an iOS chat app whose agent is Hermes running inside the app
- Streaming agent events into a SwiftUI interface
- Trying on-device inference with MLX or Apple Foundation Models behind the same agent facade
Who it is for: iOS developers who want to ship Hermes Agent inside a native app instead of calling a remote server.
How it fits with Hermes Agent
Embeds Hermes Agent as its first supported runtime, running it in process; Hermes stays MIT-licensed and attributed to its upstream project.
How to install SwiftAgent
These commands are copied from the project's README. Check the repository for the latest steps before you run them.
.package(url: "https://github.com/achimala/SwiftAgent", branch: "main")
set -euo pipefail
"${BUILD_DIR%/Build/*}/SourcePackages/checkouts/SwiftAgent/Scripts/swiftagent-install-hermes.sh"Requirements: An iOS app using Swift Package Manager; the Apple Foundation Models experiment needs iOS 26+
Note: The local MLX provider is described as a proof of concept and the Apple Foundation Models provider as an experiment.
FAQ
What is SwiftAgent?
SwiftAgent is a Swift package that embeds an AI agent runtime inside an iOS app. Its first supported runtime is Hermes Agent, bundled with CPython and run in process.
How do I install SwiftAgent?
Add the package with Swift Package Manager using the GitHub URL on the main branch, then add the SwiftAgent product to your app target. Also add a Run Script build phase that calls Scripts/swiftagent-install-hermes.sh.
Is SwiftAgent free and open source?
Yes. SwiftAgent is licensed under GPLv3 because its embedded iSH dependency is GPLv3. Hermes Agent itself is MIT-licensed and attributed to its upstream project.
Similar dev tools for Hermes Agent
All dev toolsLocal token-economy optimizer for Codex, Claude Code, OpenCode, Hermes, Pi and OMP tool output
kingkillery pk-pi-hermes-evolvePi package that evolves SKILL.md, prompts and AGENTS.md files, inspired by Hermes Agent Self-Evolution
NewTurn2017 Hermes Profile KitCLI that sets up isolated Hermes Agent profiles with their own config, memory, tokens and personas
rotorstar HITL ProtocolOpen HTTP protocol for human decisions in agent workflows, with review URLs and messenger buttons
lodado Playwright Spec for AI AgentCLI that has an AI agent judge a live staging page against your existing Playwright specs
barkley-assistant CaduceusRust daemon and Hermes plugin that reviews pull requests and turns labeled issues into PRs
Related guides: How to install Hermes Agent · Run multiple Hermes agents with profiles