Promptly is a runtime for building software that an AI can operate.
It provides an execution loop that sends messages to a model, executes model-requested tools, feeds tool outputs back to the model, and returns structured conversation entries. The project ships as a command line interface and as reusable Swift libraries.
This is a source-available project under active change. Breaking changes are expected.
Promptly is both:
- A runtime (
PromptlyKit) for model-driven execution with tools - An execution environment (
PromptlyKitTooling,PromptlySubAgents,PromptlyDetachedTask) for capabilities, delegation, and follow-up handling - A command line interface first workflow tool (
promptly) for interactive terminal use, tool management, canned prompts, sub agents, and self tests
The runtime is provider-compatible through OpenAI-style APIs (Responses and Chat Completions), configured by provider URL and credentials.
At runtime, Promptly follows this loop:
- Build a run context from messages (or a resume token for Responses).
- Send the request through a provider adapter (
PromptTurnEndpoint). - Stream events (
assistantTextDelta, tool call requested, tool call completed). - If the model requested tools, execute matching
ExecutableToolimplementations. - Submit tool outputs back to the provider endpoint.
- Repeat until there are no more tool calls.
- Return
PromptRunResultwithconversationEntriesand optionalresumeToken.
The loop is implemented in PromptRunExecutor, behind the public PromptRunCoordinator API.
PromptRunCoordinator: Public entry point to run a prompt session.PromptRunContext: Either.messages(...)or.resume(resumeToken:requestMessages:).PromptRunResult: Returned entries (PromptMessage) plus optional resume token.ExecutableTool: Capability contract (name, description, JSON schema, async execute).PromptStreamEvent: Provider-neutral stream of assistant deltas and tool lifecycle events.- Shell tools: Loaded from
tools.jsondefinitions and exposed asExecutableToolvalues. - Sub agents: Loaded as tools (
SubAgent-<name>) and executed through detached task sessions. - Return contract for sub agents:
ReturnToSupervisorpayload with optionalresumeIdandlogPath.
PromptlyKit: Core runtime, prompt coordination, provider adapters, stream events, session loop.PromptlyKitTooling: Shell command tool loading and execution, argument templates, built-inApplyPatch.PromptlySubAgents: Sub agent configuration loading, tool factory, supervisor recovery logic.PromptlyDetachedTask: Detached task orchestration, resume strategies, transcript logging.PromptlyConsole: Console runner and interactive conversation loop.
Promptlyexecutable target:prompt(default): run one-shot or interactive sessionsui: terminal user interface modetool: manage tool definitionsagent: manage and run sub agentscanned: manage canned promptstoken: store or update provider token in Keychainself-test: run runtime, tool, and sub agent checks
Promptly keeps a clear boundary between reasoning and execution:
- Model reasoning happens through provider endpoints.
- Execution happens only via explicit tool calls.
- Tool outputs are serialized as JavaScript Object Notation and fed back into the loop.
A typical command line interface run with tools enabled:
- User starts
promptlywith messages and tool filters. - Command line interface loads config, tools, and optional sub agent tools.
PromptRunCoordinatorsends the request to the selected API (responsesorchat).- Model emits text deltas and may request a tool.
- Promptly executes the tool and emits completion events.
- Tool output is returned to the model for continuation.
- Final assistant output and tool interactions are returned as
conversationEntries.
For sub agent follow-up cases (needsMoreInformation or needsSupervisorDecision), Promptly can recover a missing resume identifier by running one recovery cycle before asking the user for additional input.
- Main prompt sessions: conversation state is held in memory by the runner.
- Runtime resume token:
- Responses API: supported (
PromptRunResult.resumeToken,PromptRunContext.resume). - Chat Completions API: resume token is not supported; continuation requires full messages.
- Responses API: supported (
- Sub agent continuation: uses
resumeIdmanaged byDetachedTaskResumeStoreduring the running process. - Sub agent transcripts: detached task runs can log JavaScript Object Notation Lines transcripts under the configuration directory in
agents/logs/<agent-name>/...when log sink initialization succeeds.
Promptly uses explicit tool definitions and filtering:
- Tools are allow-listed from configuration files (
local,user,bundled), plus built-in tools. - Include and exclude filters control which tools are loaded.
optIntools are disabled by default unless explicitly included.{(path)}argument template placeholders enforce workspace-relative path checks in shell tools.- Built-in
ApplyPatchapplies diffs through a sandboxed workspace file system root.
Important: shell commands still execute as local processes. Safety depends on tool definitions, argument templates, and your include and exclude policy.
Streaming is first-class in the runtime:
- Responses API: server-sent events are parsed incrementally; assistant text deltas are emitted as they arrive.
- Chat Completions API: streamed chunks are processed into content and tool call events.
- Output handling is provider-neutral via
PromptStreamEvent.
brew tap nicholascross/promptly
brew install promptlypromptly token setuppromptly --message "user:Summarize the latest changes in this repository."promptly --interactive --message "system:Be concise and technical."promptly uipromptly --include-tools ShowFileTree --message "user:Show the project directory tree."promptly agent list
promptly agent view refactor
promptly agent run refactor "Refactor the parser without changing behavior."promptly self-test basic
promptly self-test tools
promptly self-test agents- Runtime-first design: model output is not treated as final until tool actions complete.
- Explicit capability contracts: tools are schema-described and invoked by name.
- Provider-neutral runtime events: streaming and tool lifecycle use shared types.
- Additive composition: command line interface and sub agent systems are built on the same core run loop.
- Configured execution surface: capabilities come from merged tool and agent configuration, not hidden defaults.
- Pragmatic observability: conversation entries are structured; detached sub agent runs can emit transcript logs.
Promptly is released under the MIT License. See LICENSE.