Repository navigation
feat: production mode (budgets, cost, events, OpenTelemetry, parallel tools, replay) - #10
Merged
Merged
Conversation
…llel tools and replay Co-Authored-By: Leonardo Marciano <leonardo.marciano@toolzz.me>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Co-Authored-By: Leonardo Marciano <leonardo.marciano@toolzz.me>
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.
What and why
Makes weightspace ready to run as a service against OpenAI / Anthropic, without changing the public API.
Results you can act on:
Result.stop_reason,ok,tokens(usage normalized across providers, incl. prompt-caching reads/writes and reasoning),cost(withpricing=),run_id,timings,error.Budgets:
token_budget,cost_budget,time_budget. When one runs out the LLM gets a last turn to submit.No lost work: Ctrl-C returns a partial
Result; API failures raiseSessionErrorwith the partial result on.result.Observability: run events +
callbacks=(LoggingCallback,EventLog,TranscriptWriter,ConsoleLogger) andweightspace.otel.OpenTelemetryCallbackwith GenAI semantic-convention spans (invoke_agent/chat/execute_tool).Parallel tools: read-only tool calls from one turn run on a thread pool (
wsp.tool(..., parallel=True)for custom ones). Writes, Python and probes stay sequential.Providers:
max_retries/timeouton all backends, Anthropic streaming for long requests, OpenAI prompt-caching key set per run on api.openai.com,parallel_tool_calls/safety_identifierpass through.Replay:
ScriptedLLM.from_transcript(...)(the README promised this but it did not exist), CLI--replay.Sandbox: timeout now works off the main thread and without SIGALRM; code runs under
torch.no_grad().Perf:
diff()/patch()in 1M-element blocks,describe_tensormemoized and uses a Gram spectrum for tall/wide matrices.ws.diff()after a small editCLI:
--probe FILE.py:FN,--forward-budget,--price,--max-cost,--max-tokens,--max-time,--events,--json,--version.agent.pysplit intotools.py,result.py,events.py,usage.py. Newdocs/production.md,py.typed, version 0.3.0 (main already shipped 0.2.0).How it was tested
ruff check . && ruff format --check .pytest(45 passed, 18 new intests/test_production.py),mypy src/weightspace,python -m build+twine check --strictCHANGELOG.mdentry (if user-facing)anthropic:claude-opus-5-5: toy fix task (broken entry in a 4x4 layer), fixed with a one-weight edit, tokens, prompt-caching and cost reported ($0.025), plus a streaming run withmax_tokens=32000.