ov.agents#
ov.agents — the optional in-package agent layer (Phase 4 productization).
This is the mechanical lift the spec promised (§7, D4): the Phase-1–3 deterministic
core + the .claude/skills/ policy are re-hosted as runnable agents, with no
rewrite. The lift is done by coact
(COMPLETE a skill into an agent definition, REALIZE it onto a backend); this
package is the thin ov-specific glue that coact intentionally leaves out — the
operator’s live-browser loop, the analyst’s multimodal evidence-bundle call,
and the orchestration topology.
Three things to know:
Host stays the manager (the cheap default).
materialize()writes.claude/agents/so Claude Code runs ov’s agents as subagents — zero LLM, no fan-out. In-package SDK agents (OperatorAgent,AnalystAgent,study()) are opt-in;estimate()surfaces the ~15× fan-out cost gate.Reuse, don’t rewrite. Capture, the analyzers, the evidence-bundle assembler, the reliability passes and the synopsis map-reduce are used unchanged.
Injected, optional, model-free-by-default. Every LLM is dependency-injected;
coact/aw/py2mcpare theov[agents]extra, gated with a friendly error — importing this package needs none of them.>>> from ov.agents import OV_AGENTS, default_model >>> sorted(OV_AGENTS) ['arch-analyst', 'operator', 'orchestrator', 'ux-analyst'] >>> default_model("operator") 'haiku'
- class ov.agents.AgentSpec(name, role, skill, lens=None, default_model='sonnet')[source]#
Bases:
objectOne
ovagent: its name, role, source skill, optional lens, default model.>>> AgentSpec("ov-analyze-ux", "analyst", "ov-analyze-ux", "ux").lens 'ux'
- class ov.agents.AnalystAgent(lens, llm=None, judge=None, model=None, max_marks=20, task=None, name='')[source]#
Bases:
objectInterpret a captured run’s evidence bundle into grounded findings (UX or Arch).
- Parameters:
lens (
str) –"ux"or"arch"— selects default model + finding defaults.llm (
Any) – the injected LLM (a callable, an object exposingstructuredfor the multimodal path, anawStepConfig, orNone). Ignored if ajudgeis given.judge (
Optional[Callable[...,list]]) –(bundle, *, run, store) -> list[Finding | dict]. Override the whole LLM step (tests, alternative providers). Defaults to_default_judge().model (
Optional[str]) – model selector for the image-budget + info (defaults from the lens).max_marks (
int) – cap on Set-of-Mark regions in the bundle.
- execute(input_data, context=None)[source]#
Analyze a run (or a prebuilt bundle) →
(verified_findings, info)(aw protocol).input_datamay be aCaptureRun, anEvidenceBundle, or a mapping carryingrun/store/bundle. The verified LLM findings are appended torun.findings(additive —source_layerkeeps them distinct from deterministic facts) and returned.
- class ov.agents.OperatorAgent(decider, session=None, max_steps=12, strategy='ax_snapshot', polite_rate_s=0.0, no_progress_steps=3, observe_fn=None, act_fn=None, model='haiku', name='operator')[source]#
Bases:
objectDrive a target toward a goal, recording every step (an
aw.AgenticStep).- Parameters:
decider (
Callable[...,Optional[Action]]) –(observation, *, goal, history) -> Action | None. Returns the next action, orNoneto stop. Usemake_llm_decider()for a model-backed one, or any callable (host / script / test stub).session (
Any) – aCaptureSession(supplies.page+.run). Optional —pageandrunmay instead arrive via thecontextpassed toexecute()(keys"page"/"run").max_steps (
int) – hard cap on actions (a budget; the deterministic loop signal is advisory, the cap is the backstop).strategy (
str) – perception strategy for the defaultobserve("ax_snapshot"|"screenshot"|"hybrid").act_fn (
Optional[Callable[[Any,Action],Any]]) – injection seams for the hands (default to the realobserve()/act()); tests pass fakes.
- class ov.agents.Orchestrator(llm=None, lenses=('ux', 'arch'), out_dir=None, store=None, capture_fn=<function _default_capture>, analyze_fn=<function _default_analyze>, report_fn=<function _default_report>, synopsis_fn=<function _default_synopsis>, capture_kwargs=dict())[source]#
Bases:
objectCoordinate a full study, delegating each stage (never analyzing itself).
- Parameters:
llm (
Any) – the injected model for the analyst agents.None→ deterministic-only study (the host-is-manager default; analysts are skipped).lenses (
tuple) – which analysis lenses to run ("ux"and/or"arch").out_dir (
Any) – where reports + synopsis are written (None→ the run’s store).synopsis_fn (
Callable) – stage seams (default to the realovfacade). Inject fakes to unit-test the coordination.capture_kwargs (
dict) – extra kwargs forwarded tocapture_fn(e.g.mode,authorized,crawl_pages,journey).
- ov.agents.agents_for_role(role)[source]#
All specs with
role(e.g. both analysts).>>> [s.lens for s in agents_for_role("analyst")] ['ux', 'arch']
- ov.agents.arch_analyst(llm=None, **kwargs)[source]#
A software-architecture analyst (Opus-routed).
llmis the injected model.>>> arch_analyst().model 'opus'
- Return type:
- ov.agents.complete_agent(role_or_name, *, skills_dir=None, policy=None, llm=None)[source]#
COMPLETEone ov skill into acoact.AgentDefinition(the lift).Mechanical by default (no LLM): model, tools, return contract and MCP wiring come from the skill’s
coact:block. Passllm=only to let coact draft a persona — the deterministic template path is used otherwise.- Return type:
- ov.agents.complete_all(*, roles=None, skills_dir=None, policy=None)[source]#
COMPLETEevery ov agent (orroles) →{role: AgentDefinition}.
- ov.agents.default_model(role)[source]#
The default model selector for a role (falls back to
"sonnet").>>> default_model("operator"), default_model("arch"), default_model("???") ('haiku', 'opus', 'sonnet')
- Return type:
- ov.agents.default_skills_dir()[source]#
Resolve the directory holding
ov’s skills (env, then packaged, then repo).Returns the first layout that actually contains skills; if none is found, the packaged path is returned so callers get a clear, consistent miss to report.
Deliberately not cached: it reads
OV_SKILLS_DIRat call time (a few cheapPathchecks), so an env change is always honoured. Resolution is invoked once per agent lift, not in a hot loop, so the cost is immaterial.- Return type:
- ov.agents.estimate(roles=None, *, skills_dir=None)[source]#
The cost gate — coact’s fan-out estimate over the selected ov agents.
Realizing an in-package fleet costs roughly an order of magnitude more tokens than the host path, and the premium is worst on interdependent work (ov’s analysts share the evidence bundle). Render this before spawning:
from ov.agents import estimate print(estimate(["ux-analyst", "arch-analyst"]).render())
- Return type:
- ov.agents.materialize(*, roles=None, dest=None, scope='project', project_dir=None, link=True, skills_dir=None, force=False, policy=None)[source]#
Realize ov’s agents on the host backend: write
.claude/agents/+ link skills.This is the cheap pit-of-success — it stands up no runtime. It emits one
<name>.mdper agent intodest(default: the project’s.claude/agents/) and symlinks each referenced skill into the sibling.claude/skills/so Claude Code discovers both, then verifies discovery. Returns coact’sRealizedHost(.agents,.skills,.warnings).- Return type:
- ov.agents.mcp_server(*, name='ov', tools=None, input_trans=None)[source]#
Build a FastMCP server exposing
ovto foreign hosts (viapy2mcp).>>> srv = mcp_server() >>> srv.run() # serve over stdio
- Return type:
- ov.agents.ov_tools()[source]#
The
ovcallables exposed as MCP tools (coarse, stateless, JSON-shaped).
- ov.agents.realize_agent(role_or_name, *, backend='host', skills_dir=None, policy=None, **kwargs)[source]#
Realize a single ov agent on
backend("host"|"sdk"|"mcp").sdkreturns acoact.RunnableAgent(anaw.AgenticStep) for text-shaped agents;mcpexposes the skill’s declaredcoact: mcp:tools as a FastMCP server (foreign hosts). For ov’s live-browser / multimodal runtimes useOperatorAgent/AnalystAgentinstead — coact’s text-promptsdkagent can’t drive a page or send images.- Return type:
- ov.agents.resolve_llm(llm=None)[source]#
Resolve
llmto acallable(str) -> str, orNone.One injection convention: a callable (used as-is), an
awStepConfig, a model-name string, orNoneto discover an ambient provider. A plain callable short-circuits (no optional dependency needed); the other forms defer tocoact.llm.resolve_llm().>>> resolve_llm(lambda p: "hi")("x") 'hi'
- ov.agents.skill_path(name, *, skills_dir=None)[source]#
Absolute path to skill
name’s directory (the one holdingSKILL.md).Raises
FileNotFoundErrorwith an actionable hint when the skill is not discoverable, rather than letting coact fail later on a missing path.- Return type:
- ov.agents.structured(prompt, schema, *, llm=None, images=None, retries=1)[source]#
Best-effort schema-conforming dict from an LLM, or
Noneif unavailable.Resolution order honours dependency injection:
if
llmexposes astructuredmethod, it is used as-is — this is the multimodal path (the method may acceptimages=); a real vision client plugs in here;otherwise fall through to coact’s portable text-only
structured(anyimagesare dropped — the bundle’s textual facts still ground the claims);if no LLM is resolvable at all, return
Noneso callers fall back to a deterministic-only path (no crash, no provider lock-in).
- ov.agents.study(url, *, llm=None, lenses=('ux', 'arch'), **kwargs)[source]#
Run an end-to-end study of
url(the in-package twin of thestudy-web-appskill).The pit-of-success one-liner: capture → analyze → (optional analyst judgment) → report → synopsis. With
llm=Noneit is fully deterministic; pass an injected model to add grounded UX/Arch narrative. Forwardsmode/authorized/crawl_pages/out_dir/ stage seams via**kwargs.- Return type:
- ov.agents.ux_analyst(llm=None, **kwargs)[source]#
A UX/accessibility analyst (Sonnet-routed).
llmis the injected model.>>> a = ux_analyst() >>> a.lens, a.model, a.name ('ux', 'sonnet', 'ux-analyst')
- Return type:
Modules
The Analyst agents (UX + Arch) — grounded judgment over an evidence bundle. |
|
SSOT: which |
|
Provider-agnostic LLM facade for the |
|
Expose |
|
The Operator agent — the model-bound perceive→decide→act→record loop. |
|
The Orchestrator — a pure coordinator over the study pipeline ( |
|
The mechanical lift — turn |