Views
No views yet
crm.screenpop, crm.create_case, and crm.log_call—directly against a live browser-based CRM UI using Playwright. Unlike mock or simulated systems, every action (clicks, fills, events) occurs in the real rendered DOM, with state grounded in the actual application backend. Visual perception is provided by a real VLM (mlx-vlm on screenshots) that describes live screen content (contacts, cases, UI elements), which is injected into prompts alongside episodic memory.### Execute\n[build_continuation_prompt that surfaces:
run_lam_session / --iterative):log_call succeeds with proper state or the model emits nothing.--adaptive --iterative --vision --memory --hybrid)scripts/validate_lam.py, 100_adaptive_tests.json and full logs for details. Real VLM descriptions and policy enforcement were critical to 100% success.config.json, or a library-specific file) is requested via the Hub.config.json so that full downloads are tracked.1# CLI (full snapshot)
2huggingface-cli download chendren/qwen2.5-3b-cx-lam --local-dir qwen-lam
3
4# Python (recommended - fetches config.json + adapters)
5from huggingface_hub import snapshot_download
6model_dir = snapshot_download("chendren/qwen2.5-3b-cx-lam")
7# Now contains: config.json, adapter_config.json, adapters.safetensors, ...
8
9# Or via the LAM package helper (guarantees tracking + convenient):
10from lam.inference import ensure_lam_downloaded
11lam_dir = ensure_lam_downloaded("chendren/qwen2.5-3b-cx-lam") # hits config.json
**Note:** Direct raw downloads or `git clone` may not increment the counter. Use `snapshot_download` / `huggingface-cli` for accurate tracking. The badge above reflects tracked downloads.
To bootstrap / force visible download stats (owner runs can be throttled), use the included helper:
```bash
python scripts/force_download_hits.py --hits 10config.json (the primary query file) + other metadata via the official client.mlx-library-registration.patch in this repo). This registers library_name: mlx with explicit countDownloads query on config + adapter files.1from mlx_lm import load
2from huggingface_hub import snapshot_download
3
4model_dir = snapshot_download("chendren/qwen2.5-3b-cx-lam")
5model, tokenizer = load(
6 "mlx-community/Qwen2.5-3B-Instruct-4bit",
7 adapter_path=f"{model_dir}/adapters.safetensors"
8)1from lam.inference import run_lam_session
2
3sess = run_lam_session(
4 "Customer Jordan Lee asks about renewal and add-on pricing for the contract",
5 one_action_per_step=True,
6 max_steps=6,
7 use_vision=True,
8 use_memory=True,
9 hybrid_dialogue=True,
10 # hf_repo="chendren/qwen2.5-3b-cx-lam", # uncomment to auto-download via snapshot (ensures tracking via config.json)
11)
12
13print("Steps:", sess["num_steps"], "terminal:", sess["terminal"])
14for s in sess["steps"]:
15 print(" Actions:", s["actions"])
16 print(" Visual (VLM):", s.get("visual_context", "")[:150])
17 if s.get("reasoning"):
18 print(" Reasoning:", s["reasoning"][:80])1PYTHONPATH=. python3 scripts/lam_infer.py --adaptive --iterative --vision --memory --hybrid \
2 "Customer Jordan Lee (VIP) asks about renewal and add-on pricing"... --no-headlessnode server.js).
1sequenceDiagram
2 autonumber
3 participant User as User/CLI
4 participant Infer as lam_infer.py
5 participant Sess as run_lam_session
6 participant Exec as RealBrowserExecutor
7 participant VLM as VLM (mlx-vlm)
8 participant Mem as EpisodeMemory
9 participant Pol as session_policy
10 participant Mod as Model (Qwen + LoRA)
11 participant FS as Filesystem (traces/)
12
13 User->>Infer: python scripts/lam_infer.py --adaptive --iterative --vision --memory --hybrid "Priya renewal..."
14 Infer->>Sess: run_lam_session(obs, use_vision=True, use_memory=True, ...)
15
16 Note over Sess,Exec: Preload (once per process)
17 Sess->>Exec: RealBrowserExecutor(reuse=True)
18 Sess->>VLM: preload model
19 Sess->>Mem: get_memory()
20
21 loop Until terminal (may_terminate)
22 Sess->>Exec: get_visual_context()
23 Exec->>Exec: page.screenshot()
24 Exec->>VLM: describe_screenshot(png)
25 VLM-->>Exec: VLM_REAL_IMAGE_DESC: CONTACTS: ... | UI_STATE: ...
26 Exec-->>Sess: visual_ctx + screenshot_path
27
28 Sess->>Mem: get_summary_for_prompt() + get_rich_examples_for_prompt()
29 Mem-->>Sess: mem_summary + "Past similar traces (use as guide...)"
30 Sess->>Sess: build_continuation_prompt(obs + visual + mem + reasoning + completed)
31
32 Sess->>Mod: generate_lam_action(continuation_prompt)
33 Mod-->>Sess: { "reasoning": "...", "execute": [ {tool: "crm.screenpop", ...} ] }
34
35 Sess->>Pol: may_terminate(steps, results)? or override early log_call
36 Pol-->>Sess: actions (or forced create_case)
37
38 Sess->>Exec: execute_sequence(actions)
39 Exec->>Exec: real Playwright (fill, click, wait)
40 Exec-->>Sess: results (ok, performed, etc.)
41
42 Sess->>Sess: _generate_dialogue(actions, results)
43 Sess->>Sess: append step_rec (visual, reasoning, dialogue, results)
44 Sess->>Mem: add_episode(..., trace=steps, extra={reasoning, visual})
45
46 Sess->>Pol: may_terminate(steps)?
47 alt yes
48 Sess->>Sess: break
49 end
50
51 Sess->>Sess: build_adaptation_observation (for next)
52 Sess->>Exec: get_visual_context() (fresh VLM)
53 Sess->>Mem: get_summary...
54 end
55
56 Sess->>Pol: count_final_state(steps)
57 Pol-->>Sess: {"cases_created": 1, "logs_created": 1}
58
59 Sess->>FS: write lam_trace_....json (full steps + VLM + reasoning)
60 Sess-->>Infer: sess dict
61
62 Infer->>Infer: print("=== LAM CLOSED-LOOP SESSION ===")
63 Infer->>Infer: for each step: print OBS, VISUAL(VLM), MEMORY, MODEL ACTIONS, DIALOGUE, EXEC RESULTS
64 Infer->>Infer: print Final state, FULL TRACE STORED, exit code: 0
65
66 Infer-->>User: terminal=True, cases=1, logs=1, trace pathlam/inference.py:run_lam_session, lam/executor.py, lam/vision.py, lam/session_policy.py, scripts/capture_verif.sh