npx skills add ...
npx skills add getsentry/junior --skill pi-agent-integration
npx skills add getsentry/junior --skill pi-agent-integration
Integrate the latest `@earendil-works/pi-agent-core` APIs into an app, library, runtime, or agent harness. Use for Pi `Agent`, `AgentHarness`, streaming bridges, tool execution hooks, `convertToLlm`/`transformContext`, queueing via `steer`/`followUp`, `continue()` semantics, `streamFn`/`streamProxy`, timeout/abort, session, skill, or compaction behavior.
Implement Pi-agent consumers against the latest published Pi API with stable streaming, correct queue semantics, and minimal wrapper surface area.
Pick the path before editing:
| Request type | Read first |
|---|---|
Wiring or updating Agent, loop, provider, stream, or tool APIs | references/api-surface.md |
| Adding Pi behavior in a consuming app, library, or runtime | references/common-use-cases.md |
| Using Pi's built-in harness, sessions, skills, resources, or compaction | references/harness.md |
| Debugging broken streaming, tools, queues, continuation, proxy, or abort behavior | references/troubleshooting-workarounds.md |
If a task spans multiple categories, load only the relevant references above. Keep guidance Pi-specific unless the user explicitly asks about a consuming product.
latest for @earendil-works/pi-agent-core as the source of truth before relying on a contract.Agent when event handling must be awaited as part of run settlement; use low-level agentLoop only when an observational event stream is enough.message_update where assistantMessageEvent.type === "text_delta".prompt() or continue() while an agent is active; queue mid-run input with steer() or followUp().continue() as a resume from a non-empty user or toolResult tail. An assistant tail can only drain queued steering/follow-up messages, otherwise it throws.streamFn, convertToLlm, transformContext, getApiKey, queue providers, and loop hooks no-throw for expected request/runtime failures; return safe values or encode failures in protocol events.streamFn, getApiKey, sessionId, thinkingBudgets, transport, maxRetryDelayMs, onPayload, onResponse, beforeToolCall, afterToolCall, prepareNextTurn, toolExecution, steeringMode, and followUpMode.Agent state through agent.state properties and reset(); do not invent setter wrappers unless the consumer API needs them.transformContext for message-level pruning/injection and convertToLlm for provider-compatible role conversion/filtering."one-at-a-time" or "all") when ordering or batching matters.streamFn with streamProxy-style behavior instead of provider logic scattered through consumers.toolExecution, per-tool executionMode, beforeToolCall, afterToolCall, thrown tool errors, and terminate before adding a custom tool runner.prompt()/continue() race handling and queued steer()/followUp() behavior.continue() preconditions for empty history, user tail, toolResult tail, and assistant tail with and without queued messages.convertToLlm emits only provider-compatible messages.streamFn encodes expected provider failures instead of throwing/rejecting.terminate behavior.Agent.subscribe() listener settlement and waitForIdle() behavior when listeners perform async work.AgentHarness session, resource, hook, compaction, and abort behavior when the harness path is used.