A Go agent runtime with resumable runs, host-owned storage, and a standard-library-only core.
中文文档 · Runnable example · Architecture · MIT license
Build agents inside your own service. You provide the model, tools, identity, and persistence; pi-go coordinates execution.
Requires Go 1.23.7 or newer.
git clone https://github.com/qdxiao/pi-go.git
cd pi-go
go run ./examples/basicThe deterministic example calls an order-lookup tool and prints the paid order status. It needs no model account, database, or cloud service.
From an existing Go module:
go get github.com/qdxiao/pi-go@v1.0.0-rc.1
# Optional provider adapter
go get github.com/qdxiao/pi-go/adapters/chatcompletions@v1.0.0-rc.1From the repository checkout, run the focused tutorial test. The fake tool stays idle while approval is pending, and saving the decision does not execute it. An explicit resume runs it once in this test.
go -C tests/tutorial test -run '^TestApprovalRequiresHostDecisionAndExplicitResume$' -vSee the tutorial requirements and limits. No model API key is needed.
- Run/resume, cancellation, execution ownership, and recovery for unknown tool outcomes.
- Sessions, immutable history, branching, follow-up input, and context compaction.
- Host-injected model, tool executor, storage, memory, and resource interfaces.
- Durable approvals, budgets, atomic events, replay, and observability hooks.
- Optional Chat Completions, SQL/GORM, JSON Schema, MCP HTTP, cloud storage, and OpenTelemetry adapters in separate Go modules.
The runtime does not start a server or worker. Hosts supply authentication and downstream idempotency. See the runtime contracts before integrating recovery into a service.
go test ./...
go run ./tests/checkThe second command covers all independent modules, including race tests, vet, and install checks. Live model, MCP, cloud storage, and external database tests are opt-in; passing local tests does not certify those integrations for production.
Initial public release candidate. APIs may change as integrations are exercised. Please report concrete integration problems or minimal reproductions in Issues. Local reference measurements are documented under tests/; they are not universal performance guarantees.
Pi is a behavioral reference; this project does not claim compatibility with its CLI, session format, or TypeScript plugin API. See NOTICE for dependency and upstream context.