How to
Drive CLI Agents
Run Claude Code, Codex, Cursor, or Antigravity as a pi agent or provider
Read this when
- Reusing an installed CLI agent instead of a raw API
- Choosing between the CLI-backed agents and direct providers
Use a CLI when you want its own login, tools, and local workflow.
pkg/agentpkg/aidisk · network
Both kinds run the same installed binary. The kind decides who owns the loop:
the CLI, or pkg/agent.
When to reach for a CLI agent
- Use it when subscription pricing matters.
- Use it when the CLI already owns local tool policy.
- Use it when the provider-maintained loop is enough.
- Avoid it when you need pi-go tool execution.
- Avoid it when you need one portable provider API.
Run a CLI as the whole agent
c := catalog.New()c.RegisterAgent("codex", codex.Factory( codex.WithWorkDir(workDir), codex.WithSandbox("read-only"), codex.WithApprovalPolicy("never"),))
a, err := c.Agent("codex/gpt-5", agent.WithSystemPrompt("Answer about this repository."))
answer, err := agent.Prompt(ctx, a, "Summarize the package layout.")The Codex CLI owns the agent loop. The pi-go agent interface still gives Run,
Messages, and Close.
Run a CLI as a provider
provider := claudecli.New( claudecli.WithWorkDir(workDir), claudecli.WithModel("sonnet"),)
model := ai.NewLanguageModel(ai.Model{ID: "sonnet", Name: "sonnet"}, provider)
a := agent.New(model, agent.WithSystemPrompt("Use short answers."))The Claude CLI is only a language model here. The pi-go default loop still owns the tools and the turns.
Which CLIs support what
clauderuns as an agent, andclaude-cliruns as a provider.codexruns as an agent, andcodex-cliruns as a provider.cursorruns as an agent, andcursor-cliruns as a provider.antigravityruns as an agent, andantigravity-cliruns as a provider.- The
cmd/piCLI registers these shortcuts for its own command.
Next: Provider Capability Matrix.