-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
30 lines (23 loc) · 756 Bytes
/
app.py
File metadata and controls
30 lines (23 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from flask import Flask, render_template, request, jsonify
from agents.delivery_agent import DeliveryAgent
import json
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/resolve', methods=['POST'])
def resolve_scenario():
data = request.json
scenario = data.get('scenario', '')
if not scenario:
return jsonify({'error': 'No scenario provided'}), 400
# Initialize the agent
agent = DeliveryAgent()
# Process the scenario
try:
result = agent.process_scenario(scenario)
return jsonify(result)
except Exception as e:
return jsonify({'error': str(e)}), 500
if __name__ == '__main__':
app.run(host='0.0.0.0', debug=True)