Skip to content

Add Pi coding agent provider skeleton#830

Draft
dersam wants to merge 1 commit intomainfrom
dersam/pi-provider-skeleton
Draft

Add Pi coding agent provider skeleton#830
dersam wants to merge 1 commit intomainfrom
dersam/pi-provider-skeleton

Conversation

@dersam
Copy link
Contributor

@dersam dersam commented Mar 2, 2026

Register :pi as a valid agent provider alongside :claude.

  • Add Providers::Pi with Output class delegating to PiInvocation::Result
  • Add PiInvocation with full lifecycle (start/run/complete/fail states)
  • Build pi CLI command line: pi -p --mode json with model, system prompt,
    append system prompt, session, and custom command support
  • Parse Pi's streaming JSON output (session, agent_end, turn_end,
    message_update types) to extract response, session ID, and usage stats
  • Add comprehensive tests mirroring ClaudeInvocation test patterns

Pi's JSON streaming protocol differs from Claude Code's:

  • Output flag: --mode json (vs --output-format stream-json)
  • Non-interactive: -p (vs -p --verbose)
  • Session resume: --session (vs --fork-session --resume )
  • Result extraction from agent_end message (vs type: result)
  • Usage stats from turn_end messages (vs modelUsage in result)

Copy link
Contributor Author

dersam commented Mar 2, 2026

Register :pi as a valid agent provider alongside :claude.

- Add Providers::Pi with Output class delegating to PiInvocation::Result
- Add PiInvocation with full lifecycle (start/run/complete/fail states)
- Build pi CLI command line: pi -p --mode json with model, system prompt,
  append system prompt, session, and custom command support
- Parse Pi's streaming JSON output (session, agent_end, turn_end,
  message_update types) to extract response, session ID, and usage stats
- Add comprehensive tests mirroring ClaudeInvocation test patterns

Pi's JSON streaming protocol differs from Claude Code's:
- Output flag: --mode json (vs --output-format stream-json)
- Non-interactive: -p (vs -p --verbose)
- Session resume: --session <path> (vs --fork-session --resume <id>)
- Result extraction from agent_end message (vs type: result)
- Usage stats from turn_end messages (vs modelUsage in result)
@dersam dersam force-pushed the dersam/pi-provider-skeleton branch from 07b9833 to f7587c7 Compare March 2, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants