Close Menu
    Facebook X (Twitter) Instagram
    Articles Stock
    • Home
    • Technology
    • AI
    • Pages
      • About ArticlesStock — AI & Technology Journalist
      • Contact us
      • Disclaimer For Articles Stock
      • Privacy Policy
      • Terms and Conditions
    Facebook X (Twitter) Instagram
    Articles Stock
    AI

    Tips on how to Construct Human-in-the-Loop Plan-and-Execute AI Brokers with Express Consumer Approval Utilizing LangGraph and Streamlit

    Naveed AhmadBy Naveed Ahmad17/02/2026Updated:17/02/2026No Comments2 Mins Read
    blog banner23 33


    app_code = r'''
    import os, json, uuid
    import streamlit as st
    from typing import TypedDict, Checklist, Dict, Any, Optionally available
    from pydantic import BaseModel, Subject
    from openai import OpenAI
    
    
    from langgraph.graph import StateGraph, START, END
    from langgraph.sorts import Command, interrupt
    from langgraph.checkpoint.reminiscence import InMemorySaver
    
    
    
    
    def tool_search_flights(origin: str, vacation spot: str, depart_date: str, return_date: str, budget_usd: int) -> Dict[str, Any]:
       choices = [
           {"airline": "SkyJet", "route": f"{origin}->{destination}", "depart": depart_date, "return": return_date, "price_usd": int(budget_usd*0.55)},
           {"airline": "AeroBlue", "route": f"{origin}->{destination}", "depart": depart_date, "return": return_date, "price_usd": int(budget_usd*0.70)},
           {"airline": "Nimbus Air", "route": f"{origin}->{destination}", "depart": depart_date, "return": return_date, "price_usd": int(budget_usd*0.62)},
       ]
       choices = sorted(choices, key=lambda x: x["price_usd"])
       return {"device": "search_flights", "top_options": choices[:2]}
    
    
    def tool_search_hotels(metropolis: str, nights: int, budget_usd: int, preferences: Checklist[str]) -> Dict[str, Any]:
       base = max(60, int(budget_usd / max(nights, 1)))
       picks = [
           {"name": "Central Boutique", "city": city, "nightly_usd": int(base*0.95), "notes": ["walkable", "great reviews"]},
           {"title": "Riverside Keep", "metropolis": metropolis, "nightly_usd": int(base*0.80), "notes": ["quiet", "good value"]},
           {"title": "Fashionable Loft Resort", "metropolis": metropolis, "nightly_usd": int(base*1.10), "notes": ["new", "gym"]},
       ]
       if "luxurious" in [p.lower() for p in preferences]:
           picks = sorted(picks, key=lambda x: -x["nightly_usd"])
       else:
           picks = sorted(picks, key=lambda x: x["nightly_usd"])
       return {"device": "search_hotels", "top_options": picks[:2]}
    
    
    def tool_build_day_by_day(metropolis: str, days: int, vibe: str) -> Dict[str, Any]:
       blocks = []
       for d in vary(1, days+1):
           blocks.append({
               "day": d,
               "morning": f"{metropolis}: espresso + a must-see landmark",
               "afternoon": f"{metropolis}: {vibe} exercise + native lunch",
               "night": f"{metropolis}: sundown spot + dinner + non-obligatory evening stroll"
           })
       return {"device": "draft_itinerary", "days": blocks}
    '''
    



    Source link

    Naveed Ahmad

    Naveed Ahmad is a technology journalist and AI writer at ArticlesStock, covering artificial intelligence, machine learning, and emerging tech policy. Read his latest articles.

    Related Posts

    In Harvard research, AI provided extra correct diagnoses than emergency room medical doctors

    03/05/2026

    TechCrunch Mobility: How do you concern a ticket to a robotaxi?

    03/05/2026

    This tiny, magnetic e-reader may cease you from doomscrolling

    03/05/2026
    Leave A Reply Cancel Reply

    Categories
    • AI
    Recent Comments
      Facebook X (Twitter) Instagram Pinterest
      © 2026 ThemeSphere. Designed by ThemeSphere.

      Type above and press Enter to search. Press Esc to cancel.