Smart Agent API
Authenticate with the same yocr_ API keys as OCR. Add agent scopes when creating keys. Browser dashboards use the shared workspace session.
Core workflow
- Sign up / sign in at
/ocr/login(shared identity). POST /v1/agents— create an agent with capabilities.POST /v1/agents/{id}/knowledge— ingest text or HTTPS URL.- Configure connectors:
/connectors/orders,/connectors/quotes, actions, webhooks. POST /v1/agents/{id}/chat— sync conversation turns.- Embed
/v1/widget/{public_key}.jsafter setting status tolive.
Chat request
curl -X POST "$API/v1/agents/$AGENT_ID/chat" \
-H "Authorization: Bearer yocr_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"message":"I need a quote. Email me at ops@acme.test","session_key":"demo-1"}'Intelligent engine
Turns run a lightweight orchestration graph: language detect → intent classify → clarify missing slots → retrieve knowledge → approved tools → grounded reply → anti-hallucination guardrails. Intents include product, pricing, support, order status, delivery estimate, quotation, sample, lead capture, complaint, and human handoff. English, Tamil, and Hindi are supported by default. The agent never invents prices, orders, payments, or delivery dates without verified connectors/knowledge.
Stream tokens with POST /v1/agents/{id}/chat/stream (SSE). Free LLM (recommended): Groq — set OCR_AGENT_GROQ_API_KEY from console.groq.com/keys (model llama-3.3-70b-versatile). Hugging Face Inference Providers currently needs prepaid credits. With no key, the agent uses grounded offline knowledge replies.
Scopes
agents:read, agents:write, conversations:read, conversations:write, knowledge:read, knowledge:write, leads:read, actions:write, usage:read
Metering
Each billed assistant turn charges agent_usage credits from the shared workspace ledger (default 1 credit / turn).
OpenAPI
Interactive docs are served by the API at /v1/docs on your OCR / Agent API origin.