Repository navigation
Let extensions hold agents' model calls; define the scope of pi-agents - #112
Merged
Merged
Conversation
The core is durable agent execution and durable messaging. Policy such as pricing, budgets, quotas, or scheduling belongs in co-loaded extensions behind small hooks, so user requests no longer grow the core by default. AGENTS.md turns this into a checklist for agents, and budgets leave the deferred list because they are extension policy.
A new optional beforeAgentRequest hook runs before each generation request and compaction summary. Each request waits until the hook's callback returns. The hook runs in pi-durable's own request hooks, before credentials resolve and before the working-agent cap takes a slot. Stopping or interrupting an agent, or shutting down, ends the wait. pi-agents keeps no hold state, timers, or status, so pricing schedules and manual holds stay in the consumer extension.
AGENTS.md keeps the four-step check in fewer words and drops the rule about precedent. The architecture diagram in the README and docs now lists holding calls among the hooks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔍 Problem
recheckAttimers, a manual hold, a way to combine holds, and aModelswrapper. That is policy machinery, and it doesn't belong in a durability extension.🛠️ Solution
docs/design.mddefines the core as durable agent execution and durable messaging. Graphs, delegation, and waits are built on top of those; everything else is a customization point.AGENTS.mdadds a short checklist that agents must follow before building new behavior. Budgets move off the deferred list because they are extension policy.beforeAgentRequest(ctx): a new optional hook. It runs before each generation request and compaction summary, and the call waits until the callback returns. pi-agents keeps no hold state, timers, reasons, or status, so pricing schedules and manual holds stay in the consumer extension.beforeRequest/beforeCompacthooks, the same place the working-agent cap waits. That means:💬 Review
Modelswrapper back, so extensions that want to fail closed catch their own errors and keep waiting.modelis the agent's configured model, read before routing.onAgentRequeststill sees the model actually dispatched.classify/generateImagescalls. Covering those later would take onebeforeToolregistration.