pi-agent-integration

작성자: sentry

Integrate the latest `@earendil-works/pi-agent-core` APIs into an app, library, runtime, or agent harness. Use for Pi `Agent`, `AgentHarness`, streaming…

npx skills add https://github.com/getsentry/junior --skill pi-agent-integration

Implement Pi consumers against the latest published API. Keep streaming stable, queue behavior explicit, and wrapper code small.

Step 1: Classify the request

Request typeRead first
Wire or update Agent, loop, provider, stream, or tool APIsreferences/api-surface.md
Add Pi behavior in an app, library, runtime, or adapterreferences/common-use-cases.md
Use AgentHarness, sessions, skills, resources, compaction, or execution helpersreferences/harness.md
Debug streaming, tools, queues, continuation, proxy, abort, or harness failuresreferences/troubleshooting-workarounds.md

Load each reference that the task needs. Keep guidance Pi-specific unless the user asks about a consuming product.

Step 2: Apply integration guardrails

  1. Check npm latest for @earendil-works/pi-agent-core before relying on a contract. Treat the published package as authoritative. Treat upstream main as unreleased evidence.
  2. Pass a streamFn when constructing Agent. Also pass it as the last argument to low-level loop functions.
  3. Use Agent when event handling must finish before run settlement. Use agentLoop only when an observational event stream is enough.
  4. Stream user-visible text only from message_update when assistantMessageEvent.type === "text_delta".
  5. Preserve assistant message boundaries when forwarding multi-message output.
  6. Do not call prompt(), continue(), or reset() while an agent is active. Queue mid-run input with steer() or followUp().
  7. Continue a normal run only from a non-empty user or toolResult tail. An assistant tail can only drain queued steering or follow-up messages.
  8. Keep streamFn, convertToLlm, transformContext, getApiKey, queue providers, and loop hooks no-throw for expected failures. Return safe values or encode the failure in stream events.
  9. Keep tool calls, progress, results, thinking deltas, and provider payloads internal unless the product exposes them on purpose.
  10. In 0.84.1, do not recommend AgentHarness run, queue, hook, or navigation paths for production use. They are scaffold APIs and most reject with HarnessNotImplemented. Use bare Agent, session APIs, and standalone helpers until the published implementation is complete.

Step 3: Implement with minimal surface

  1. Prefer Pi options over wrapper state machines: streamFn, getApiKey, sessionId, thinkingBudgets, transport, maxRetryDelayMs, onPayload, onResponse, beforeToolCall, afterToolCall, shouldStopAfterTurn, prepareNextTurnWithContext, toolExecution, steeringMode, and followUpMode.
  2. Mutate Agent through agent.state and public runtime options. Call reset() only when idle.
  3. Use transformContext for message-level pruning or injection. Use convertToLlm for provider-compatible role conversion and filtering.
  4. Set queue modes to "one-at-a-time" or "all" when ordering or batching matters.
  5. Use streamFn with streamProxy-style behavior for server-proxied model access.
  6. Use toolExecution, per-tool executionMode, beforeToolCall, afterToolCall, thrown tool errors, and terminate before adding a custom tool runner.
  7. Keep timeout and abort paths observable. Make sure streams and iterables settle.

Step 4: Verify behavior

  1. Verify the event bridge emits only text deltas, preserves intended boundaries, and closes on success, error, and abort.
  2. Verify active-run handling for prompt(), continue(), and reset(). Verify queued steer() and followUp() behavior.
  3. Verify continue() with empty history and with user, toolResult, and assistant tails.
  4. Verify custom messages remain in agent state while convertToLlm emits only provider-compatible messages.
  5. Verify streamFn encodes expected provider failures instead of throwing or rejecting.
  6. Verify parallel and sequential tool ordering, hook blocking and patches, progress updates, usage, added tools, and termination.
  7. Verify Agent.subscribe() listener settlement and waitForIdle() with async listeners.
  8. When reviewing the AgentHarness scaffold, verify implemented status in the published source before recommending any method.

Step 5: Keep version discipline

  1. Target npm latest only.
  2. Re-check package metadata, declarations, implementation, README, and changelog before a material API update.
  3. Do not present unreleased main behavior as published behavior.
  4. Do not add compatibility shims or old package guidance unless the user asks for a migration.

sentry의 다른 스킬

generate-frontend-forms
sentry
Sentry의 새로운 폼 시스템을 사용하여 폼을 생성하는 가이드입니다. 폼, 폼 필드, 유효성 검사 또는 자동 저장 기능을 구현할 때 사용하세요.
official
sentry-snapshots-cocoa
sentry
Apple/Cocoa 프로젝트를 위한 전체 Sentry Snapshots 설정입니다. "SnapshotPreviews 설정", "Apple 스냅샷 테스트 설정", "Apple 스냅샷 업로드" 요청 시 사용하세요.
official
architecture-review
sentry
직원 수준의 코드베이스 건강 검토. 모놀리식 모듈, 무음 실패, 타입 안전성 격차, 테스트 커버리지 구멍, LLM 친화성 문제를 찾습니다.
official
linear-type-labeler
sentry
Linear 이슈를 분류하고, 각 이슈의 제목과 설명 내용을 기반으로 Sentry 워크스페이스의 레이블 분류 체계에서 Type 레이블을 적용합니다.
official
vercel-react-best-practices
sentry
Vercel Engineering의 React 및 Next.js 성능 최적화 가이드라인입니다. 이 스킬은 React/Next.js 코드를 작성, 검토 또는 리팩토링할 때 사용해야 합니다.
official
bump-size-limit
sentry
.size-limit.js 파일에서 크기 제한을 올립니다. size-limit CI 검사가 실패할 때 사용합니다. 사용자가 크기 제한 실패, 번들 크기 검사 실패, CI 크기 문제를 언급할 때 사용하세요.
official
generate-migration
sentry
Sentry용 Django 데이터베이스 마이그레이션을 생성합니다. 마이그레이션 생성, 컬럼이나 테이블 추가/제거, 인덱스 추가, 또는 마이그레이션 충돌 해결 시 사용하세요.
official
security-review
sentry
코드 변경 사항에서 악용 가능한 애플리케이션 보안 취약점을 찾습니다. Warden 보안 스캔, 앱 보안 검토, OWASP 스타일 점검, 인증 또는…에 사용합니다.
official