Examples
Copyable implementation examples for docs-driven evaluation.
Build the first backend wrapper, dashboard panel, artifact inspector, and read-only agent integration.
Minimal Python client shape
The Python shape keeps the API key server-side and wraps the smallest useful workflow. Production code should add retries, timeouts, request IDs, and structured logging.
import requests
class AyneyeClient:
def __init__(self, api_key: str):
self.base = "https://api.ayneye.com"
self.headers = {"Authorization": f"Bearer {api_key}"}
def add_video(self, url: str, title: str):
return requests.post(f"{self.base}/api/videos/add", json={"url":url,"title":title}, headers=self.headers).json()
def ask(self, video_id: str, question: str):
payload = {"question": question, "require_evidence": True}
return requests.post(f"{self.base}/api/product/videos/{video_id}/ask", json=payload, headers=self.headers).json()Agent-safe wrapper
An agent should not treat every response as permission to act. The wrapper below turns review_required and missing evidence into controlled outcomes.
def safe_agent_answer(client, video_id, question):
result = client.ask(video_id, question)
if result.get("review_required"):
return {"action": "human_review", "reason": result.get("reason")}
if not result.get("evidence_refs"):
return {"action": "refuse", "reason": "No evidence supports answer"}
return {"action": "answer", "answer": result.get("answer"), "evidence_refs": result["evidence_refs"]}Dashboard panel pattern
A good dashboard panel shows current execution state, artifact links, evidence preview, and cost/limits. The user should see why an answer is not ready, why a limit blocks execution, or why review is required. Do not collapse all states into a spinner or generic AI answer.
Negative example to avoid
Do not send raw video repeatedly to a general-purpose model on every user question, hide the cost, and display a paragraph without evidence. The Ayneye pattern is: materialize state once, query compact artifacts, cite evidence, expose limits.