LoginStart beta
Ayneye
Agent quickstartStart beta

LangChain guide

Expose Ayneye video artifacts as auditable LangChain tools.

The safe pattern is not one giant video tool. Split state, evidence, cost, and Ask Video into separate read-only tools so every agent step can be logged and reviewed.

Tool architecture

ToolInputOutputReview rule
fetch_video_world_statevideo_idscene_graph.json summaryNo unsupported identity or intent claims
fetch_video_evidencevideo_id + evidence_reftime span + notesAnswer must cite evidence_ref
fetch_video_costvideo_idcost.json and limitsExpose budget state
ask_video_with_evidencevideo_id + questionanswer or insufficient-evidenceNever guess when evidence is missing

LangChain implementation sketch

from langchain_core.tools import tool

@tool
def fetch_video_world_state(video_id: str) -> dict:
    """Read Ayneye scene_graph.json for a processed video."""
    return ayneye.scene_graph(video_id)

@tool
def fetch_video_evidence(video_id: str, evidence_ref: str) -> dict:
    """Fetch traceable evidence span and review notes."""
    return ayneye.evidence(video_id, evidence_ref)

@tool
def fetch_video_cost(video_id: str) -> dict:
    """Read cost.json, detector mode, fallback flags, and limits."""
    return ayneye.cost(video_id)

SYSTEM = """
Use only Ayneye artifacts supplied by tools.
Cite evidence_ref for every factual claim.
Return INSUFFICIENT_EVIDENCE when evidence is missing.
Never infer identity, intent, or trigger physical actions.
"""

Production-readiness checklist

  1. Log tool name, input, artifact version, and output state.
  2. Persist evidence_ref citations in the final answer.
  3. Block unscoped video IDs and cross-tenant artifact reads.
  4. Expose review-required states in the UI.
  5. Test with ambiguous questions and verify refusal behavior.