From 14f72ad4f167d2e3dcfd37d73e04c3bf7211eb78 Mon Sep 17 00:00:00 2001 From: Adil Hafeez Date: Sat, 17 Jan 2026 15:15:39 -0800 Subject: [PATCH] fix demo --- .../Dockerfile | 26 +++++----- .../config.yaml | 4 +- .../crewai/flight_agent.py | 12 ++++- .../docker-compose.yaml | 49 +++---------------- .../langchain/weather_agent.py | 8 ++- 5 files changed, 36 insertions(+), 63 deletions(-) diff --git a/demos/use_cases/multi_agent_with_crewai_langchain/Dockerfile b/demos/use_cases/multi_agent_with_crewai_langchain/Dockerfile index 3e6afcf5..65337efc 100644 --- a/demos/use_cases/multi_agent_with_crewai_langchain/Dockerfile +++ b/demos/use_cases/multi_agent_with_crewai_langchain/Dockerfile @@ -2,27 +2,23 @@ FROM python:3.13-slim WORKDIR /app -# Install bash and uv -RUN apt-get update && apt-get install -y bash && rm -rf /var/lib/apt/lists/* -RUN pip install --no-cache-dir uv +# Install system dependencies +RUN apt-get update && \ + apt-get install -y --no-install-recommends bash && \ + rm -rf /var/lib/apt/lists/* && \ + pip install --no-cache-dir uv -# Copy dependency files -COPY pyproject.toml ./ -COPY README.md ./ - -# Install dependencies to system Python +# Install Python dependencies +COPY pyproject.toml README.md ./ RUN uv pip install --system . -# Copy shared utilities -COPY openai_protocol.py ./ - # Copy application code +COPY openai_protocol.py ./ COPY crewai/ ./crewai/ COPY langchain/ ./langchain/ -# Set environment variables -ENV PYTHONUNBUFFERED=1 -ENV PYTHONPATH=/app:$PYTHONPATH +# Runtime configuration +ENV PYTHONUNBUFFERED=1 \ + PYTHONPATH=/app -# Default command (will be overridden in docker-compose) CMD ["uv", "run", "python", "crewai/flight_agent.py"] diff --git a/demos/use_cases/multi_agent_with_crewai_langchain/config.yaml b/demos/use_cases/multi_agent_with_crewai_langchain/config.yaml index 0b6aaba2..b3a204f3 100644 --- a/demos/use_cases/multi_agent_with_crewai_langchain/config.yaml +++ b/demos/use_cases/multi_agent_with_crewai_langchain/config.yaml @@ -2,9 +2,9 @@ version: v0.3.0 agents: - id: weather_agent - url: http://host.docker.internal:10510 + url: http://langchain-weather-agent:10510 - id: flight_agent - url: http://host.docker.internal:10520 + url: http://crewai-flight-agent:10520 model_providers: - model: openai/gpt-4o diff --git a/demos/use_cases/multi_agent_with_crewai_langchain/crewai/flight_agent.py b/demos/use_cases/multi_agent_with_crewai_langchain/crewai/flight_agent.py index 77e8352c..bfff06de 100644 --- a/demos/use_cases/multi_agent_with_crewai_langchain/crewai/flight_agent.py +++ b/demos/use_cases/multi_agent_with_crewai_langchain/crewai/flight_agent.py @@ -36,7 +36,7 @@ http_client = httpx.AsyncClient(timeout=30.0) openai_client = AsyncOpenAI(base_url=LLM_GATEWAY_ENDPOINT, api_key="EMPTY") -SYSTEM_PROMPT = """You are a travel planning assistant specializing in flight information. +SYSTEM_PROMPT = """You are a travel planning assistant specializing in flight information and travel conditions. CRITICAL: You MUST respond with ONLY the final answer to the user. @@ -60,12 +60,20 @@ Flight Information Format: - Aircraft: Model name - Status: Current status +Weather Information (when available): +- Present weather data in a clear, readable format +- Include temperature, conditions, and any travel advisories +- Integrate weather context with flight information naturally +- Mention how weather might affect travel plans if relevant + Your task: 1. Use tools silently (don't mention them to the user) 2. Convert technical data into friendly, readable text 3. Use 12-hour time format (e.g., "9:00 AM") 4. Organize flights chronologically by departure time -5. Include terminal/gate info when available6. NOTE (Multi-agent context): If the conversation includes information from other sources that are not flight-related, incorporate it naturally.""" +5. Include terminal/gate info when available +6. When weather data is provided, summarize it clearly and relate it to the travel plans +7. NOTE (Multi-agent context): If the conversation includes information from other sources (weather, hotels, etc.), incorporate it naturally and cohesively in your response.""" def build_flight_crew( diff --git a/demos/use_cases/multi_agent_with_crewai_langchain/docker-compose.yaml b/demos/use_cases/multi_agent_with_crewai_langchain/docker-compose.yaml index 851f311e..e114442f 100644 --- a/demos/use_cases/multi_agent_with_crewai_langchain/docker-compose.yaml +++ b/demos/use_cases/multi_agent_with_crewai_langchain/docker-compose.yaml @@ -1,13 +1,11 @@ services: plano: - image: katanemo/plano:0.4.2 # Will auto-pull from Docker Hub if not present locally - container_name: plano-dataplane + build: + context: ../../../ + dockerfile: Dockerfile ports: - - "12000:12000" # Main LLM gateway port - - "8001:8001" # Agent/prompt gateway port - - "12001:12001" # Control plane port - - "19901:9901" # Envoy admin interface + - "8001:8001" environment: - ARCH_CONFIG_PATH=/app/arch_config.yaml - OPENAI_API_KEY=${OPENAI_API_KEY:?OPENAI_API_KEY environment variable is required but not set} @@ -15,51 +13,28 @@ services: volumes: - ./config.yaml:/app/arch_config.yaml:ro - /etc/ssl/cert.pem:/etc/ssl/cert.pem - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:12000/healthz"] - interval: 5s - timeout: 3s - retries: 5 - start_period: 10s - extra_hosts: - - "host.docker.internal:host-gateway" crewai-flight-agent: build: - context: . dockerfile: Dockerfile - container_name: crewai-flight-agent restart: always ports: - "10520:10520" environment: - - LLM_GATEWAY_ENDPOINT=http://host.docker.internal:12000/v1 + - LLM_GATEWAY_ENDPOINT=http://plano:12000/v1 - AEROAPI_KEY=${AEROAPI_KEY:?AEROAPI_KEY environment variable is required but not set} - PYTHONUNBUFFERED=1 command: ["python", "-u", "crewai/flight_agent.py"] - depends_on: - plano: - condition: service_healthy - extra_hosts: - - "host.docker.internal:host-gateway" langchain-weather-agent: build: - context: . dockerfile: Dockerfile - container_name: langchain-weather-agent restart: always ports: - "10510:10510" environment: - - LLM_GATEWAY_ENDPOINT=http://host.docker.internal:12000/v1 - - PYTHONUNBUFFERED=1 + - LLM_GATEWAY_ENDPOINT=http://plano:12000/v1 command: ["python", "-u", "langchain/weather_agent.py"] - depends_on: - plano: - condition: service_healthy - extra_hosts: - - "host.docker.internal:host-gateway" open-web-ui: image: dyrnq/open-webui:main @@ -69,21 +44,11 @@ services: environment: - DEFAULT_MODEL=gpt-4o-mini - ENABLE_OPENAI_API=true - - OPENAI_API_BASE_URL=http://host.docker.internal:8001/v1 - depends_on: - plano: - condition: service_healthy - langchain-weather-agent: - condition: service_started - crewai-flight-agent: - condition: service_started - extra_hosts: - - "host.docker.internal:host-gateway" + - OPENAI_API_BASE_URL=http://plano:8001/v1 jaeger: build: context: ../../shared/jaeger - container_name: jaeger restart: always ports: - "16686:16686" # Jaeger UI diff --git a/demos/use_cases/multi_agent_with_crewai_langchain/langchain/weather_agent.py b/demos/use_cases/multi_agent_with_crewai_langchain/langchain/weather_agent.py index 6246026b..c4bd1500 100644 --- a/demos/use_cases/multi_agent_with_crewai_langchain/langchain/weather_agent.py +++ b/demos/use_cases/multi_agent_with_crewai_langchain/langchain/weather_agent.py @@ -250,7 +250,7 @@ class WeatherToolInput(BaseModel): ) -WEATHER_SYSTEM_PROMPT = """You are a weather assistant in a multi-agent system. You will receive weather data in JSON format with these fields: +WEATHER_SYSTEM_PROMPT = """You are a weather and travel conditions assistant in a multi-agent system. You will receive weather data in JSON format with these fields: - "location": City name - "forecast": Array of weather objects, each with date, day_name, temperature_c, temperature_f, temperature_max_c, temperature_min_c, weather_code, sunrise, sunset @@ -263,7 +263,11 @@ WEATHER_SYSTEM_PROMPT = """You are a weather assistant in a multi-agent system. 4. Include temperature in both Celsius and Fahrenheit 5. Describe conditions naturally based on weather_code 6. Use conversational language - 7. NOTE (Multi-agent context): If the conversation includes information from other agents and sources incorporate it naturally. + 7. When flight information is present in the conversation, summarize it clearly: + - Present flight details in a readable format (airline, times, gates, status) + - Integrate flight and weather information cohesively + - Mention how weather might affect the flights if relevant + 8. NOTE (Multi-agent context): If the conversation includes information from other agents and sources (flights, hotels, etc.), incorporate it naturally and provide a comprehensive travel summary. Remember: Only use the provided data. If fields are null, mention data is unavailable."""