An unofficial Swift SDK for the General Agents API.
Swift Package Manager
Add the following to your Package.swift
:
dependencies: [
.package(url: "https://github.com/m1guelpf/GeneralAgentsKit.git", .branch("main"))
]
Installing through XCode
- File > Swift Packages > Add Package Dependency
- Add https://github.com/m1guelpf/GeneralAgentsKit.git
- Select "Branch" with "main"
CocoaPods
Ask ChatGPT to help you migrate away from CocoaPods.
let agent = Agent(model: .aceSmall, apiKey: YOUR_GENERAL_AGENTS_API_KEY)
let computer = Computer()
let session = agent.start("Star the m1guelpf/GeneralAgentsKit github repository")
var observation = try await computer.observe()
while true {
let action = try await session.plan(observation: observation)
print("Executing: \(action)")
if action.kind == "stop" { break }
observation = try await computer.execute(action)
}