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
CEO, SaaSNext
- 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
- Memory pressure: 770B FP8 weights consume ~380GB VRAM. Plan for 8×H100 80GB or 4×H200 141GB nodes.
- 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).
- 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.
- KV cache eviction: Enable tiered KV cache offloading (
--kv-cache-disk-path /nvme/cache) for context windows beyond 128K tokens. - 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.
Enjoyed this breakdown? Get our morning dispatch in your inbox.
Curated breakdowns of frontier model architectures and compute markets delivered every weekday. Zero fluff.
Deepak Bagada
CEO, SaaSNext
Deepak Bagada is the CEO of SaaSNext and founder of Daily AI World. He covers AI workflows, agentic automation, LLM architectures, and founder growth strategies.
Build a Faro AI Clinical-Trial MCP Server for Agentic Healthcare Data Access in 2026
Next Story →vLLM 0.28.0 Decode Context Parallel: The End of the Context-Length Tax in 2026
Related Intelligence Analysis
The Step-by-Step Guide to Automating Meeting Tasks with Whisper
You're spending 45 minutes after every client meeting typing up notes and manually assigning tasks in Jira. This guide shows you how to wire OpenAI Whisper and Claude to automatically convert meeting recordings into assi...
Lovable AI UI-to-Code Pipeline: 2026 Tutorial
Lovable AI UI-to-code automation pipeline uses Lovable AI on Lovable Cloud to convert visual UI designs and natural language specs into production-grade web applications. UI/UX designers and frontend developers bridging...
Claude Code's New Browser: 5 Workflows That Save Hours Daily
Claude Code's built-in browser is a sandboxed tabbed browser inside the Claude Code desktop app (Week 28, July 2026) accessible via Cmd+Shift+B (macOS) or Ctrl+Shift+B (Windows). It lets Claude open websites, read docume...