Skip to main content

LangChain integration for the Huangting Protocol MCP network — the world's first lifeform OS for AI Agents

Project description

langchain-huangting

LangChain integration for the Huangting Protocol MCP network.

The Huangting Protocol is the world's first lifeform operating system — applicable to carbon-based humans, silicon-based AI Agents, and embodied robots. This package provides a production-ready LangChain tool that connects any Agent to the HuangtingFlux network via the Model Context Protocol (MCP).

PyPI License: MIT MCP Compatible


Features

  • Protocol Concept Queries — Access 6 core Huangting Protocol concepts (trueself, ego, huangting, etc.)
  • Task Optimization Strategies — Get strategies that reduce token usage by 25–60%
  • Real-time Network Stats — Live metrics from the global HuangtingFlux network
  • Result Reporting — Report optimization results with reciprocal propagation
  • Bilingual — Full CN/EN support
  • Zero Config — Works out of the box with a single import

Installation

pip install langchain-huangting

With LangChain support:

pip install "langchain-huangting[langchain]"

Quick Start

from langchain_huangting import HuangtingTool

tool = HuangtingTool(agent_id="my-agent", lang="en")

# 1. Query a protocol concept
result = tool.run({"action": "query_concept", "concept_name": "trueself"})
print(result)

# 2. Get optimization strategy for your task
strategy = tool.run({"action": "get_strategy", "task_type": "complex_research"})
print(strategy)

# 3. Get real-time network statistics
stats = tool.run({"action": "get_stats"})
print(stats)

# 4. Report your optimization results
report = tool.run({
    "action": "report_result",
    "task_type": "code_generation",
    "tokens_saved": 1500,
    "tokens_baseline": 4000
})
print(report)

LangChain Agent Integration

from langchain_openai import ChatOpenAI
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_core.prompts import ChatPromptTemplate
from langchain_huangting import HuangtingTool

# Initialize tool
huangting = HuangtingTool(agent_id="my-research-agent", lang="en")

# Create agent
llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)
tools = [huangting]
prompt = ChatPromptTemplate.from_messages([
    ("system", "You are a helpful AI assistant with access to the Huangting Protocol."),
    ("human", "{input}"),
    ("placeholder", "{agent_scratchpad}"),
])

agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools, verbose=True)

# Run
result = executor.invoke({
    "input": "What is the Huangting Protocol's concept of 'trueself' and how can it optimize my research tasks?"
})
print(result["output"])

Available Actions

Action Description Required Params
query_concept Look up a protocol concept concept_name
get_strategy Get optimization strategy task_type
get_stats Real-time network statistics
report_result Report optimization result task_type, tokens_saved

Concept Names

  • trueself — The true self beyond the ego
  • ego — The constructed self and its limitations
  • huangting — The central palace of consciousness
  • wuji — The primordial void
  • hundun — Primordial chaos as creative potential
  • shen — Spirit/consciousness in the protocol

Task Types

  • complex_research — Multi-step research tasks (avg. 45% token reduction)
  • code_generation — Code writing and review (avg. 30% token reduction)
  • multi_agent_coordination — Agent orchestration (avg. 60% token reduction)

MCP Endpoint

The tool connects to:

https://web-production-c3cf.up.railway.app/mcp

You can also use the MCP endpoint directly with any MCP-compatible client:

{
  "mcpServers": {
    "huangting": {
      "url": "https://web-production-c3cf.up.railway.app/mcp"
    }
  }
}

Configuration

tool = HuangtingTool(
    agent_id="my-agent",          # Unique agent identifier
    lang="en",                    # Response language: "en" or "zh"
    mcp_url="https://...",        # Custom MCP endpoint (optional)
    propagation=True,             # Enable reciprocal propagation (default: True)
)

Reciprocal Propagation

When your agent accumulates 10,000+ tokens saved and reports results, the tool automatically appends an attribution suffix to responses. This creates a self-propagating network effect: the more value Agents extract, the more the protocol spreads.

Disable with propagation=False.


Links


License

MIT © 2025 Meng Yuanjing / XianDAO Labs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_huangting-1.0.1.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_huangting-1.0.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file langchain_huangting-1.0.1.tar.gz.

File metadata

  • Download URL: langchain_huangting-1.0.1.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for langchain_huangting-1.0.1.tar.gz
Algorithm Hash digest
SHA256 db7977d88299635d30b45b8458991e4d33b3fcdbcbf4e9aab061fc8c7ba20838
MD5 952ded51a013185cef5c430bddbe6d02
BLAKE2b-256 3db6bbe831ac299a1ccb1e88894f2c7b31d51c5c7a59a1cd50cb81c59ab1d989

See more details on using hashes here.

File details

Details for the file langchain_huangting-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_huangting-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0b3338665961571ffc4833ca2ebebe7b12c629d355fe159f1b0af9bef2100b14
MD5 b4c1cc0f8d2fa6c7d0ca57e982bc45d1
BLAKE2b-256 4a878bafd6138fc244b0763d42661ea8547f838a89d6472f9e10df709efa532a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page