Enterprise chatbot automation platform that transforms natural language requests into executable workflow agents.
The chatbot layer sits on top of the existing meta-flow infrastructure, providing conversational orchestration for internal business processes. Employees interact naturally with the system: "I need to submit an expense report" → chatbot generates and executes the appropriate workflow agent.
Employee → Chatbot Interface → Intent Matcher → Workflow Repository
↓
Meta-Agent Pipeline (existing)
↓
Parameter Extraction → Collection → Execution
↓
Results → Employee Notification
- LangGraph-based state machine for conversation flow
- State tracking across multiple turns
- Session management and persistence
- Semantic search using sentence-transformers
- Intent classification and confidence scoring
- Workflow repository interface
- AST-based parameter extraction from generated agents
- Conversational parameter collection
- Type validation and business rules
- Sandboxed agent execution
- Real-time log streaming
- Error handling and recovery
- Meta-agent client for workflow generation
- Agent loader and code injection
# Install dependencies
pip install -r requirements.txt
# Download sentence-transformers model (first run)
python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('BAAI/bge-small-en-v1.5')"# Required for meta-agent integration
export ANTHROPIC_API_KEY=your_api_key_here
# Optional: Redis for state persistence (default: in-memory)
export REDIS_URL=redis://localhost:6379# Start with interactive menu
./scripts/start.sh
# Or directly
./scripts/chatbot-start.sh
# Access:
# - Frontend: http://localhost:3002
# - Backend API: http://localhost:8001
# - API Docs: http://localhost:8001/api/docs# Start chatbot API
cd chatbot
uvicorn api.main:app --reload --port 8001
# API available at http://localhost:8001import requests
# Send message
response = requests.post(
"http://localhost:8001/chat/message",
json={
"session_id": "user-123",
"message": "I need to submit an expense report",
"user_id": "employee@company.com"
}
)
# Response
{
"response": "I can help with that. Please provide:\n• Expense amount (USD)\n• Date of expense\n• Category (travel/meals/office/other)",
"status": "collecting_parameters",
"parameters_needed": ["amount", "date", "category", "department", "receipt_url"]
}const ws = new WebSocket('ws://localhost:8001/ws/chat/user-123');
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.type === "log") {
console.log("Execution log:", data.payload);
} else if (data.type === "result") {
console.log("Final result:", data.payload);
}
};
ws.send(JSON.stringify({
message: "I need to submit an expense",
user_id: "employee@company.com"
}));Workflows are stored as .txt specifications in workflows/:
workflows/
├── hr/
│ ├── expense_approval.txt
│ └── leave_request.txt
├── it/
│ └── ticket_submission.txt
└── finance/
└── invoice_processing.txt
- Create workflow specification in appropriate directory
- Follow standard format (Workflow, Description, Inputs, Steps, Outputs)
- System automatically indexes on startup
- No code changes required
# Run all tests
pytest chatbot/tests/ -v
# Run specific test
pytest chatbot/tests/test_conversation.py -v
# With coverage
pytest chatbot/tests/ --cov=chatbot/src --cov-report=htmlPOST /chat/message- Send message, get responseGET /chat/session/{session_id}- Retrieve session stateDELETE /chat/session/{session_id}- Clear sessionWS /ws/chat/{session_id}- WebSocket for real-time updates
GET /workflows/list- List all available workflowsGET /workflows/{workflow_id}- Get workflow detailsGET /workflows/search?q=query- Search workflows
GET /health- Service health check
Adjust matching threshold in src/workflow_matching/repository.py:
# Default: 0.75 (75% confidence)
# Lower = more permissive, Higher = more strict
CONFIDENCE_THRESHOLD = 0.75Configure agent execution timeout in src/execution/orchestrator.py:
# Default: 30 seconds
EXECUTION_TIMEOUT = 30- Check workflow descriptions are clear and descriptive
- Rebuild embeddings cache:
rm -rf .embeddings_cache - Tune confidence threshold (see Configuration)
- Check agent complexity (tool count, parallel branches)
- Increase timeout for complex workflows
- Review execution logs for bottlenecks
- MVP uses in-memory state (lost on restart)
- Production: Configure Redis via
REDIS_URL - Add session persistence middleware
- Deterministic: No LLM hallucination risk
- Fast: Millisecond parsing vs. seconds for LLM
- Reliable: Works even when generated code format changes slightly
- Trade-off: Requires well-formed Python code (meta-agent already guarantees this)
- Fast: Sub-100ms query time with cached embeddings
- Flexible: Works with synonyms and paraphrasing
- Scalable: O(n) search with pre-computed embeddings
- Trade-off: Requires model download (~90MB for BAAI/bge-small-en-v1.5)
- Stateful: Built-in state management and checkpointing
- Composable: Easy to add/remove nodes without refactoring
- Debuggable: Visual graph representation and step-by-step execution
- Trade-off: Learning curve for graph-based thinking
- State Persistence: In-memory only (Redis for production)
- Authentication: No user auth (add middleware for production)
- Tool Execution: Simulated stubs (implement real integrations)
- Error Recovery: Basic retry only (add ML-based classification)
- Multi-language: English only (add i18n for global deployment)
- Follow supercode principles (see project plan)
- Add tests for all new functionality
- Update progress tracker with changes
- Keep functions <20 lines, single responsibility
AGPL-3.0 - If you use this in a web service, you must open-source your service.