Repository navigation
Conversation
--model clef talks to Workers AI or a local /v1/systemone server (CLEF_URL, or CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_AUTH_TOKEN; CLEF_MODEL=clef|clef-flash, default clef-flash). Screenshots map to Clef's images array (max 4); a text observation still runs. Contract tests use a stub server; no live Cloudflare or GPU call in CI.
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.
Required human contributor answers
Per the repo owner's (Danyang, @Birfy) standing instruction, these are filled from the issue (#126) instead of waiting for separate human answers.
What outcome are you trying to achieve?
Answer: Agents can call Cloudflare Clef or Clef-flash as a served System One decision model over HTTP (
--model clef) for text, and for screenshots when the observation has images, without loading weights in process ([Feat] Add Cloudflare Clef / Clef-flash as a System One decision backend #126).What is the highest-leverage variable for that outcome?
Answer: Whether the HTTP body matches the official Clef / Workers AI schema (
model,state,questions, optionalimagesdata URLs, max 4) on both Workers AI and localPOST /v1/systemone, with a clean refusal when URL/token or the response body is missing or bad — and without inventing OneJevmedia/<image:N>mapping or avideos/scorepath our interface does not have.How will this work move that variable rather than create busywork?
Answer: It adds a dedicated served adapter (same shape as
clm/onejev): one deadline per decision, provenance (url,request_id, served model name, usage), and contract tests against a stub server so CI does not call Cloudflare or a GPU.Who is the customer or user, and what do they actually need?
Answer: People who want
--model clefagainst Workers AI or a local SGLang Clef server for choice/noul decisions, including optional screenshots, without waiting for a live qualification run.After answering the four questions: is a PR needed at all to achieve this outcome?
Human decision and rationale (or explicit source reference): Yes; #126 proposes this adapter as the scope of one PR and distinguishes "adapter wired" from "qualified on this checkpoint and path".
For a bug fix: link actual observed failure evidence.
Evidence: Not a bug fix: a new served backend (#126).
Why
system1-agents has no
--model clef. Workers AI is not/v1/systemone: it isPOST /client/v4/accounts/$ACCOUNT_ID/ai/run/@cf/cloudflare/clef(orclef-flash). Local SGLang does speak/v1/systemone, but screenshots use Clef'simagesfield, not OneJev'smedia. Closes #126.How
Start with
s1a/decision_models/clef.py, thenfactory.pyand the fronts, andtests/test_decision_models_clef.py.--model clef→ClefModel.from_env():CLEF_URL(local/v1/systemone) orCLOUDFLARE_ACCOUNT_ID+CLOUDFLARE_AUTH_TOKEN(Workers AI;CLOUDFLARE_API_TOKENaccepted as an alias).CLEF_MODEL=clef|clef-flash(defaultclef-flash). OptionalCLEF_API_KEY/CLEF_TIMEOUT_S(default 30).model,stateas the observation (no image markers),questionsas choice/noul,imagesas PNG/JPEG/WebP data URLs only when present (max 4). Workers AI REST envelopes ({success, result, errors}) are unwrapped; a local body withanswersis used as-is.MODEL_CALL_FAILED. Transport errors / malformed answers /success: falsefail closed, same as other served clients.rawkeepsserved_by(includingpath:localorworkers-ai),url,request_id,server_timing, optionalcf_ray, andsent_imagesdigests (never image bytes).DECISION_MODEL_NAMESand on the tool, browser, rails, CLIdecide/probe, and MCPdecidefronts (Clef is text-capable; images are optional).scorequestions andvideosare unsupported on our interface and are not sent. The Workers AI Clef / Clef-flash input schema also has novideosfield (that extension is documented on Clef-omni). This adapter does not remapCLEF_MODELto a Hugging Face id if a local server wantsCloudflare/clef.What
CLEF_URL,CLEF_MODEL,CLEF_API_KEY,CLEF_TIMEOUT_S, plusCLOUDFLARE_ACCOUNT_ID/CLOUDFLARE_AUTH_TOKENindocs/configuration.mdand.env.example.docs/decision-models.md(backend row + optional smoke recipe),docs/capabilities.md(adapter wired vs not qualified; no Decision Index numbers copied as ours),docs/agents.md,docs/architecture.md.Verification
uv run ruff format --check . && uv run ruff check . && uv run ty check: all cleanuv run pytest -qandscripts/smoke.sh: 1401 passed, 134 skipped, 267 subtests passed; smoke OKCHANGELOG.mdand the docs say what the code does nowOffline tests cover the text path (no
images/media/videosfields), screenshot data URLs, the Workers AI REST envelope andcf-ray, asuccess: falseenvelope, more than 4 images, transport error (after retry), malformed answers, HTTP 500, one decision deadline across the permitted retry,from_env/build_model(local vs Workers AI, local URL wins, token alias), and front registration.Demo / evidence
docs/results/. Hardware / path qualification remains unmarked in the capability matrix until a pinned run lands.issue-126-clef; no System1-Omni involved (Workers AI or a local SGLang Clef server).