anwar/agent-orchestrator

Core Brain to receive webhooks from n8n and orchestrate OpenAI Tool calling.

Maintainers

Package info

github.com/ringkubd/agent-orchestrator

pkg:composer/anwar/agent-orchestrator

Statistics

Installs: 8

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.0.6 2026-04-16 12:06 UTC

This package is auto-updated.

Last update: 2026-04-16 12:06:44 UTC


README

Latest Version on Packagist Total Downloads

A powerful AI-driven core for Laravel applications that orchestrates OpenAI tool calling, local vector embeddings via Ollama, and semantic search via Qdrant. Specifically designed to handle complex "Neighbor Chef" personas with HTML-rich responses and direct cart integration.

🎨 Features

  • 🚀 Hybrid Semantic Search: Integrated with Qdrant for high-performance vector search.
  • 🧠 Local Embeddings: Support for local Ollama (nomic-embed-text) to save costs and ensure privacy.
  • 🛠️ OpenAI Tool Calling: Seamlessly handle tool calls for order tracking, recipe consultation, and cart management.
  • 🍱 Branded HTML Responses: Enforces strict HTML formatting (no Markdown) for premium UI rendering.
  • 🛒 Cart Integration: Automatic generation of [Add to Cart] links and batch ingredient buttons.
  • 🔌 Webhook Ready: Built-in endpoint for n8n or other automation platform orchestration.

📦 Installation

You can install the package via composer:

composer require anwar/agent-orchestrator

The service provider will automatically register itself.

Publish Configuration

php artisan vendor:publish --tag="agent-config"

⚙️ Configuration

Add the following variables to your .env file:

# AI Agent Settings
AGENT_WEBHOOK_SECRET=your_secure_secret
AGENT_OPENAI_MODEL=gpt-4o-mini
OPENAI_REQUEST_TIMEOUT=120

# Vector Database (Qdrant)
QDRANT_HOST=http://localhost:6333

# Embedding Source (ollama or openai)
AGENT_EMBEDDING_SOURCE=ollama
OLLAMA_HOST=http://localhost:11435
OLLAMA_EMBEDDING_MODEL=nomic-embed-text

# OpenAI (if source is openai)
OPENAI_API_KEY=your_openai_key

🚀 Usage

1. Synchronize Data to Qdrant

To populate the vector database with your products and recipes:

# Sync Recipes
php artisan agent:sync-chef-brain

# Sync Active Products
php artisan agent:sync-products

2. Using the Service

You can resolve and use the AiAgentService anywhere in your application:

use Anwar\AgentOrchestrator\Services\AiAgentService;

$agent = app(AiAgentService::class);
$response = $agent->processMessage($customerPhone, "I want to cook Chicken Biryani");

// $response will contain HTML-formatted content with images and cart links.

3. Webhook Integration

The package provides a standard webhook endpoint: Endpoint: POST /api/v1/agent/webhook

Payload Example:

{
    "phone": "08012345678",
    "message": "Find me some Miso paste"
}

👨‍🍳 Persona: Gunma Neighbor Chef

The agent is pre-configured to behave as a Friendly, Bengali-Japanese neighbor.

  • Tone: Uses phrases like "Itadakimasu Bhai", "Ja-matod", and "Salam!".
  • Formatting: Strictly uses <b>, <ul>, <li>, and <br>.
  • E-commerce: Integrates product images and cart buttons directly into the chat flow.

🏗️ Dependencies

🔗 Repository

https://github.com/ringkubd/agent-orchestrator

📄 License

The MIT License (MIT). Please see License File for more information.

Developed with ❤️ for Gunma Halal Food.