Default personas, usable unselected, and token usage per agent and per turn - #323
Merged
Conversation
…r agent and per turn Five personas ship with the studio for long-running fleet work: campaign_runner, watcher, reviewer, steward, and reporter, each a short set of working rules. They seed into every deployment, including ones that seeded before they existed, through a ledger that copies a starter file only when it is absent and has never been seeded, so an edited default is never overwritten and a deleted one never comes back. The library gains a Duplicate action, which opens a copy in the editor. The system prompt carries a live catalog of personas and a rule for using one without a selection: when a request clearly falls inside one persona's description, the assistant reads it and follows its rules for that request, says which one it applied, and never switches mid-request; when delegating, each agent gets the persona that fits. Token usage is now counted where the data exists. A chat turn sums the usage chunks its model calls report and stores the total on the message. An agent's pw code envelope is read for every spelling providers use (usage.prompt_tokens, input_tokens, total_cost_usd, and so on) and the count is kept on the agent, summed on the task, and shown on the Tasks page: on the agent row, in the drill-down, and on the task card. Where the gateway reports nothing, nothing is shown rather than zeros.
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.
Five personas ship with the studio for long-running fleet work:
campaign_runner,watcher,reviewer,steward,reporter, each a short set of working rules underextensions-starter/agents/.seedExtensionsnow fills in starter files on deployments that seeded before they existed, through a ledger (.seeded.json): a starter file is copied only when absent and never seeded before, so an edited default is never overwritten and a deleted one never returns. The library gains Duplicate, which opens a copy in the editor as a new file.The system prompt carries a live persona catalog (rebuilt on every prompt) and a rule for using one without a selection: when a request clearly falls inside one persona's description the assistant reads it and follows its rules for that request, says which one it applied, and never switches mid-request; when delegating, each agent gets the persona that fits its objective.
Token usage is counted where the data exists.
streamTurnreads ausagechunk when the stream carries one (including a usage-only final chunk), the tool loop sums them (addUsage), and the total is stored on the message astokensUsed. An agent's pw code envelope is read byusageOffor every spelling providers use; the count lives on the agent, sums on the task (sumUsage), and shows on the Tasks page row, drill-down, and card. Nothing is shown rather than zeros where the gateway reports nothing.Five new tests; 143 server and 9 web pass.