Skip to main content
Authenticated API

This endpoint requires a valid JWT Bearer token. Accessible via the API gateway at /v1/agent/*. The ai.enabled feature gate must be active for the tenant.

LangGraph Agent API

AI agent orchestration using LangGraph for multi-step workflows, contextual conversations, and human-in-the-loop approval processes.

Overview

AttributeValue
Base Path/api/v1/agent
AuthenticationBearer Token
Feature Gateai.enabled must be true
ProxyGo gateway forwards all /v1/agent/* requests to Python Analytics service at /api/agent/*

The Go API gateway proxies all requests under /v1/agent/* to the Python Analytics service. The Python service requires LangGraph to be installed; endpoints return 503 if the dependency is unavailable.

Agent Chat

Send Message

Process a message through the LangGraph workflow engine. Routes the message through intent classification, RAG retrieval, planning, execution, and optional human approval.

POST /api/v1/agent/chat

Request Body

{
"message": "What's our current inventory of ribeye?",
"tenant_id": "restaurant-1",
"user_id": "user_123",
"session_id": "sess_abc",
"shell_type": "staff",
"domain": "inventory",
"complexity": 3
}
FieldTypeRequiredDescription
messagestringYesUser message to process
tenant_idstringYesTenant identifier
user_idstringYesUser identifier
session_idstringYesSession identifier (used as LangGraph thread ID)
shell_typestringYesShell context: staff, admin, cockpit, customer
domainstringNoDomain hint for routing (e.g., inventory, sales, labor, general)
complexityintegerNoComplexity hint (1-10, default: 3)

Response

{
"response": "Based on your inventory records, you currently have 45 ribeye steaks in stock...",
"requires_approval": false,
"approval_reason": null,
"session_id": "sess_abc",
"thread_id": "sess_abc"
}
FieldTypeDescription
responsestringAgent's response text (from the last LangChain message)
requires_approvalbooleanWhether the workflow is paused waiting for human approval
approval_reasonstringReason approval is needed (null if not paused)
session_idstringSession identifier
thread_idstringLangGraph thread identifier (same as session_id)

When requires_approval is true, the workflow is paused at the human_approval node. Use the /approve endpoint to resume.


Phone Agent Chat

Optimized endpoint for phone/voice interactions. Uses a specialized phone agent graph designed for low latency and concise responses.

POST /api/v1/agent/chat/phone

Request Body

{
"message": "I'd like to make a reservation for 4 people",
"tenant_id": "restaurant-1",
"user_id": "caller_001",
"session_id": "phone_sess_001",
"shell_type": "customer"
}

The request body uses the same ChatRequest model as /chat. The shell_type is overridden to "customer" internally for phone callers.

Response

{
"response": "I'd be happy to help you make a reservation for 4 people. What date and time works best for you?",
"session_id": "phone_sess_001"
}

Approval Workflow

Approve or Reject Action

Approve or reject a pending action from the agent workflow. When the agent requires human approval for sensitive operations (e.g., refunds, inventory adjustments), the workflow pauses at the human_approval node.

POST /api/v1/agent/approve

Request Body

{
"session_id": "sess_abc",
"thread_id": "sess_abc",
"approved": true,
"approver_id": "manager_123",
"reason": "Approved inventory adjustment"
}
FieldTypeRequiredDescription
session_idstringYesSession identifier
thread_idstringYesLangGraph thread identifier
approvedbooleanYesWhether the action is approved
approver_idstringYesUser approving or rejecting
reasonstringNoReason for the decision

Response

{
"response": "Inventory adjustment has been applied. 10 units of ribeye added to stock.",
"status": "completed"
}
FieldTypeDescription
responsestringAgent's response after resuming the workflow
statusstringAlways "completed" after approval resolution

Conversation History

Get Session History

Retrieve the conversation history and current state for a session.

GET /api/v1/agent/history/{session_id}

Path Parameters

ParameterTypeDescription
session_idstringSession identifier

Response

{
"messages": [
{
"role": "human",
"content": "What's our current inventory of ribeye?"
},
{
"role": "ai",
"content": "Based on your inventory records, you currently have 45 ribeye steaks in stock..."
}
],
"current_state": [],
"requires_approval": false
}
FieldTypeDescription
messagesarrayArray of message objects with role and content
current_statearrayThe next nodes to execute in the LangGraph state machine (empty if completed)
requires_approvalbooleanWhether the workflow is paused at human_approval

Agent Status

Get Agent Availability

Check whether the LangGraph agent is available and ready.

GET /api/v1/agent/status

Response

{
"available": true,
"message": "LangGraph agent ready"
}

When LangGraph is not installed, returns:

{
"available": false,
"message": "LangGraph not installed"
}

Content Generation

Generate Content Suggestion

AI-powered content generation using the Content Suggestion LangGraph agent. Generates social media content ideas, drafts posts per platform, and provides predicted performance metrics.

POST /api/v1/agent/content/suggestion

Request Body

{
"topic": "Valentine's Day dinner special",
"platforms": ["instagram", "facebook", "twitter"],
"tone": "romantic",
"context": "We're running a prix fixe Valentine's dinner at $89/couple",
"industry": "restaurant"
}
FieldTypeRequiredDescription
topicstringYesContent topic
platformsarrayYesTarget platforms (e.g., instagram, facebook, twitter)
tonestringYesContent tone (e.g., romantic, casual, professional)
contextstringNoAdditional context for the content
industrystringNoIndustry context for better suggestions

Response

{
"ideas": [
"Highlight the chef's special courses",
"Share a behind-the-scenes prep video",
"Feature a couples' testimonial from last year"
],
"posts": [
{
"platform": "instagram",
"content": "Love is in the air... and so is the aroma of our Valentine's prix fixe...",
"hashtags": ["#ValentinesDay", "#DateNight"]
}
],
"analysis": {
"predicted_engagement": "high",
"best_posting_time": "6:00 PM"
}
}

Upsell Suggestions

Generate Upsell

Generate AI-powered upsell suggestions based on the current cart contents.

POST /api/v1/agent/upsell

Request Body

{
"cart_items": [
{"item_id": "burger-001", "name": "Classic Burger", "price": 12.99}
],
"user_id": "user_123",
"tenant_id": "restaurant-1",
"session_id": "sess_abc"
}
FieldTypeRequiredDescription
cart_itemsarrayYesArray of cart item objects
user_idstringYesUser identifier
tenant_idstringYesTenant identifier
session_idstringYesSession identifier

Response

{
"suggestions": [
{
"item_id": "fries-001",
"name": "Classic Fries",
"reason": "Frequently ordered with Classic Burger",
"confidence": 0.92
}
],
"analysis": "Based on popular pairings, fries and a drink would complement this order."
}

Error Responses

StatusCodeDescription
400invalid_contextMissing required context fields
401unauthorizedInvalid or missing JWT token
403feature_disabledThe ai.enabled feature gate is not active
404session_not_foundSession ID not found in LangGraph state
503langgraph_unavailableLangGraph dependencies not installed