Repository navigation
feat(objects): jev-cron — Jev-gated timer/message triggers - #107
Merged
Merged
Conversation
Genswarms.Objects.JevCron is a built-in object that, every `every` and/or on every message it receives, asks a Jev decision model (router /v1/decisions) to pick one action from a closed catalogue, then applies it deterministically: templated sends and/or memory changes (remember/forget) that feed the next decision. Jev never writes text. - min_confidence + fallback, daily budget, bounded queue, timer coalescing - endpoint from GENSWARMS_JEV_ENDPOINT; key from GENSWARMS_JEV_API_KEY only, per-object endpoints gated by the EndpointPolicy allowlist (fail closed) - curl transport (argv, key in a 0700 temp file): :httpc is unusable on Erlang builds without http_util - every decision is a jev_decision event (distribution, model, latency, cost) - swarm-object.json makes everything but endpoint x-mutable via PATCH config - new optional ObjectHandler.validate_config/1, called by SwarmConfig so `config validate` rejects bad object configs before start - docs/objects.md section, examples/jev-cron, tests incl. a real-swarm run and an IR round trip Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (13)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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
Genswarms.Objects.JevCronis a built-in object. Everyeveryand/or on each message it receives, it asks a Jev decision model (the router's/v1/decisions) to pick one action from a closed catalogue, then applies that action deterministically:remember/forget; the memory is part of the state Jev sees on the next decisionJev never writes text. The point is a cheap gate (~$0.00002, under 1 s per decision) in front of expensive LLM agents.
Details
min_confidence+fallback; daily budget; only one decision in flight at a time. Messages that arrive meanwhile wait in a queue (the oldest is dropped beyond 20), and a timer tick that fires during a decision is skipped.GENSWARMS_JEV_ENDPOINTand the key only fromGENSWARMS_JEV_API_KEY, never from the config. A per-objectendpointmust pass theEndpointPolicyallowlist; otherwise the object fails to start.curl(argv, key in a 0700 temp file).:httpcbreaks on Erlang builds withouthttp_util, which is the same problem noted inapi_client.ex.jev_decisionevent with the distribution, the top and applied action, the model, the latency and the cost.swarm-object.jsonmarks every key exceptendpointasx-mutable, so a running jev-cron can be retuned withPATCH /objects/:obj/config.ObjectHandler.validate_config/1, called bySwarmConfig, soconfig validaterejects a bad object config before start.docs/objects.md, plusexamples/jev-cron, env vars ingetting-started, andCLAUDE.md.Testing
test/genswarms/objects/jev_cron_test.exs(16 tests): validation, endpoint policy, the request/response contract, fallback, errors, queue and coalescing, budget, a policy_ir passthrough, an IR round trip, and an end-to-end run in a real swarm (ObjectServer + Router) against a fake transport.mix test: 801 tests, all passing. 14 pre-existing tests needjq, which is not installed on the dev box, so I ran them withnix shell nixpkgs#jq.router.ygr.aiwith ajev-1.13policy: a "backup OK" report gavenothing(1.0) and a "CI red" report gavewake(1.0), ~$0.00002 each.Not in this PR
🤖 Generated with Claude Code
Summary by CodeRabbit