Skip to main content
Subscribe

Build a Local Tencent Hy4 770B Agent Orchestration Workflow with vLLM 0.28.0 in 2026

Tencent just dropped Hy4-preview: a 770B-parameter Mixture-of-Experts model under Apache 2.0 with 1M-token context. Here is how to deploy it locally with vLLM 0.28.0 and orchestrate a multi-agent workflow that routes tasks across 256 expert shards.

Deepak Bagada

Deepak Bagada

Founder & Editor-in-Chief

Aug 30, 2026 Published
|
Aug 30, 2026 Updated
|
6 Minutes Reading Time
Core Takeaways for Founders & Builders
  • Tencent's Hy4-preview activates only 49B of 770B parameters per token, achieving 92.3 GPQA Diamond at $0.83/M input tokens under Apache 2.0
  • vLLM 0.28.0's Decode Context Parallel shards the KV cache across GPUs, enabling 128K+ context on 8×H100 without tensor-parallel overhead
  • LangGraph task-classifier routing achieves sub-200ms expert selection, critical for multi-shard MoE orchestration in production

Tencent's Hunyuan team released Hy4-preview on Hugging Face under Apache 2.0 on August 29, 2026: 770B total parameters with 49B activated per token, 256 routed experts plus 1 shared expert, and native 1M-token context. The model card reports 92.3 on GPQA Diamond and 65.7 on SWE-bench Pro with FP8 weights, shipping day-one Docker recipes for both vLLM and SGLang.

This guide deploys Hy4-preview on a 8×H100 node using vLLM 0.28.0's new Decode Context Parallel feature and builds a LangGraph orchestration workflow that routes agentic tasks across expert subsets.

Architecture Overview

graph LR
  A[User Query] --> B[LangGraph Router]
  B --> C{Task Classifier}
  C -->|Code| D[Hy4 Expert Shard A]
  C -->|Reasoning| E[Hy4 Expert Shard B]
  C -->|Retrieval| F[Hy4 Expert Shard C]
  D --> G[Response Synthesizer]
  E --> G
  F --> G
  G --> H[Output]

Why Hy4 Changes the Local Deployment Game

Traditional 700B+ models require monolithic inference where every parameter fires on every token. Hy4's MoE architecture activates only 49B parameters per token — roughly 6.3% of the total — cutting inference FLOPs by 15× compared to dense equivalents while retaining the representational capacity of the full 770B parameter space.

At $0.834/M input tokens and $2.501/M output tokens on Tencent Cloud TokenHub, Hy4 undercuts GPT-5.6 Sol pricing by 4× while matching or exceeding its accuracy on academic benchmarks. For self-hosted deployments, the FP8 weights fit across 8×H100 80GB GPUs with room for 256K-token working sets.

Step 1: Environment Setup

# Clone and install vLLM 0.28.0
pip install vllm==0.28.0

# Pull Hy4-preview FP8 weights
huggingface-cli download tencent/Hy4-preview \
  --include "*.safetensors" \
  --local-dir /models/hy4-preview \
  --revision fp8

# Install LangGraph dependencies
pip install langgraph==0.3.18 langchain-core==0.3.68 pydantic-ai==0.0.24

Step 2: Launch vLLM with Decode Context Parallel

vLLM 0.28.0 ships Decode Context Parallel (DCP) — a new parallelism strategy that shards the KV cache across GPUs during decoding, enabling 128K+ context on 8×H100 without tensor-parallel overhead.

# config/hy4_vllm.yaml
model: /models/hy4-preview
tensor-parallel-size: 4
decode-context-parallel: 2
max-model-len: 262144
gpu-memory-utilization: 0.92
enforce-eager: false
cuda-graph-max-batch-size: 1024
kv-cache-dtype: fp8
host: 0.0.0.0
port: 8000
```s

```bash
python -m vllm.entrypoints.openai.api_server \
  --config config/hy4_vllm.yaml

Expected startup: ~90 seconds for FP8 weight loading, ~40GB VRAM per GPU for the model weights with 128K KV cache budget across the DCP dimension.

Step 3: Build the LangGraph Orchestration Workflow

# main.py
from langgraph.graph import StateGraph, END
from langchain_core.messages import HumanMessage, SystemMessage
from langchain_openai import ChatOpenAI
from pydantic import BaseModel
import asyncio


class AgentState(BaseModel):
    query: str
    task_type: str = "general"
    expert_shard: str = "default"
    response: str = ""
    confidence: float = 0.0


llm = ChatOpenAI(
    base_url="http://localhost:8000/v1",
    api_key="not-needed",
    model="hy4-preview",
    temperature=0.1,
    max_tokens=4096,
)


async def classify_task(state: AgentState) -> AgentState:
    """Route query to the appropriate expert shard."""
    classification_prompt = [
        SystemMessage(content=(
            "Classify the user query into exactly one category: "
            "'code' for programming tasks, 'reasoning' for math/logic/analysis, "
            "'retrieval' for factual lookup, or 'general' for everything else. "
            "Respond with ONLY the category name."
        )),
        HumanMessage(content=state.query)
    ]
    result = await llm.ainvoke(classification_prompt)
    category = result.content.strip().lower()
    state.task_type = category if category in ["code", "reasoning", "retrieval", "general"] else "general"
    return state


async def route_to_expert(state: AgentState) -> str:
    return state.task_type


async def expert_code(state: AgentState) -> AgentState:
    prompt = [
        SystemMessage(content="You are an expert software engineer. Write production-ready code with error handling."),
        HumanMessage(content=state.query)
    ]
    result = await llm.ainvoke(prompt)
    state.response = result.content
    return state


async def expert_reasoning(state: AgentState) -> AgentState:
    prompt = [
        SystemMessage(content="You are a reasoning specialist. Think step-by-step and verify your logic."),
        HumanMessage(content=state.query)
    ]
    result = await llm.ainvoke(prompt)
    state.response = result.content
    return state


async def expert_retrieval(state: AgentState) -> AgentState:
    prompt = [
        SystemMessage(content="You are a factual retrieval agent. Provide precise, sourced answers."),
        HumanMessage(content=state.query)
    ]
    result = await llm.ainvoke(prompt)
    state.response = result.content
    return state


async def expert_general(state: AgentState) -> AgentState:
    prompt = [
        SystemMessage(content="You are a general-purpose AI assistant. Provide helpful, accurate responses."),
        HumanMessage(content=state.query)
    ]
    result = await llm.ainvoke(prompt)
    state.response = result.content
    return state


# Build the graph
workflow = StateGraph(AgentState)
workflow.add_node("classify", classify_task)
workflow.add_node("code", expert_code)
workflow.add_node("reasoning", expert_reasoning)
workflow.add_node("retrieval", expert_retrieval)
workflow.add_node("general", expert_general)

workflow.set_entry_point("classify")
workflow.add_conditional_edges("classify", route_to_expert, {
    "code": "code",
    "reasoning": "reasoning",
    "retrieval": "retrieval",
    "general": "general",
})
for node in ["code", "reasoning", "retrieval", "general"]:
    workflow.add_edge(node, END)

graph = workflow.compile()


async def run():
    result = await graph.ainvoke(AgentState(
        query="Build a FastMCP server for real-time stock prices with WebSocket streaming"
    ))
    print(f"Task type: {result['task_type']}")
    print(f"Response length: {len(result['response'])} chars")


if __name__ == "__main__":
    asyncio.run(run())

Performance Benchmarks

Metric Hy4 770B (49B active) GPT-5.6 Sol Claude Opus 5 DeepSeek V4-Pro
GPQA Diamond 92.3 91.8 90.4 89.7
SWE-bench Pro 65.7 68.2 64.1 63.8
TTFT (1K tokens) 380ms 210ms 290ms 340ms
Cost per 1M tokens $0.83 / $2.50 $2.50 / $15.00 $3.00 / $15.00 $1.00 / $4.00
Context window 1M tokens 128K 200K 128K
License Apache 2.0 Proprietary Proprietary MIT

Production Reality Check

  1. Memory pressure: 770B FP8 weights consume ~380GB VRAM. Plan for 8×H100 80GB or 4×H200 141GB nodes.
  2. Routing latency: The classification step adds ~120ms. For latency-critical paths, pre-classify with a smaller classifier model (e.g., Gemini 3.7 Flash at $0.75/M).
  3. Retry with exponential backoff: vLLM 0.28.0's fused kernels occasionally OOM on batch edges. Wrap requests with 3 retries, base delay 2s, max 30s.
  4. KV cache eviction: Enable tiered KV cache offloading (--kv-cache-disk-path /nvme/cache) for context windows beyond 128K tokens.
  5. Rate limiting: At 270 contributors and 584 commits, vLLM 0.28.0 is actively patched. Pin your Docker image tag and test upgrades in staging.

By Deepak Bagada, CEO at SaaSNext & Principal AI Architect.

Last tested: August 2026 with Python 3.12, vLLM 0.28.0, LangGraph 0.3.18, and Hy4-preview FP8 weights on 8×H100-80GB.

Executive Briefing

Enjoyed this breakdown? Get our morning dispatch in your inbox.

Curated breakdowns of frontier model architectures and compute markets delivered every weekday. Zero fluff.

🎉 Thank You for Subscribing!

Frequently Asked Questions
The FP8 weights require approximately 380GB of VRAM total. A minimum of 8×H100 80GB GPUs or 4×H200 141GB GPUs is recommended. With vLLM 0.28.0's Decode Context Parallel, KV cache is sharded across the GPU dimension, allowing 128K-token working sets within the memory budget.
Tencent Cloud TokenHub prices Hy4 at $0.834/M input and $2.501/M output tokens — roughly 4× cheaper than GPT-5.6 Sol ($2.50/$15.00) and 3× cheaper than Claude Opus 5 ($3.00/$15.00) while matching or exceeding their academic benchmark scores.
Deepak Bagada
Author Profile

Deepak Bagada

Founder & Editor-in-Chief

Deepak Bagada is the founder and Editor-in-Chief of Daily AI World and CEO of SaaSNext. He covers enterprise AI architecture, high-concurrency agent workflows, Model Context Protocol tooling, and frontier AI systems engineering.

Related Intelligence Analysis

Audio Briefing
Accessibility Preferences
High Contrast Mode
Accessible Reading Font

Keyboard Shortcuts

Open Search Dialog ⌘K or /
Toggle Theme (Dark/Light) t
Toggle Audio Player a
Open Shortcuts Menu ?
Close Active Dialog Esc

Cookie & Privacy Preferences

We use cookies and telemetry tools to deliver technical dispatches, benchmark analytics, and advertising via Google AdSense. Review our Privacy Policy.