Repository navigation
Conversation
A coding agent on top of ai.Agent, for long-running processes. The loop is the standard loop plus: - a built system prompt: env facts, AGENTS.md files, a skill list - steering: before each model request, and before stopping, the loop awaits the `steer` hook; the interface answers with its queued messages (possibly none) - turn and token limits - compaction by a client-side summary Tools: read, bash, and task (runs a subagent that cannot nest or steer). `python -m ai.harness` is a stdlib REPL to try it.
Interrupts: the interface cancels the run's task. The loop adds the partial turn before the cancel goes on: the text so far, the finished tool results, and an "Interrupted by user" error result for every other tool call whose ToolEnd it saw. Every tool call needs a result, or the next run would replay (re-run) it. Interrupt and redirect is a new run on that history; the REPL starts it with the lines typed during the stopped run. Budgets: MAX_TOKENS and the new MAX_USD cover a run and its subagents. The top-level run puts a Budget in a contextvar; subagent runs add to it and stop at the same limits. A request counts when its stream ends, so subagents started by the turn see it. MAX_USD is best-effort, from models.dev prices, and raises UnknownCostError when the model has no prices or a request reports no usage. LimitReached gains "usd" and reports the shared totals. The REPL gets --max-usd and keeps the session on any AIError.
Move PROMPT, SUMMARY_PROMPT, SUMMARY_PREFIX and the system message builder to ai.harness.prompts, and Steered, Compacted, LimitReached to ai.harness.events. The system message is now built by callers with prompts.system_message(). Rename task -> subagent and usd -> to_usd.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
No description provided.