langchain_agentx
langchain_agentx 是一组基于 LangChain / LangGraph 的“代码智能体”工具函数,帮助你在自己的项目里快速集成:
- OpenCode 风格的 LangGraph Agent(代码理解、重构、分析)
- DeepAgent 兼容的 Agent 工厂
- 上下文感知中间件、性能监控等基础设施
安装
发布到 PyPI 后,你可以直接通过 pip 安装:
pip install langchain-agentx
快速上手
from langchain_agentx import create_opencode_style_agent, create_opencode_style_deepagent
# 这里省略 LangChain / LangGraph 相关模型与工具配置
agent = create_opencode_style_agent(...)
deep_agent = create_opencode_style_deepagent(...)
具体的能力和使用方式可以参考源码中的 docstring 以及各模块下的 README.md。
发布新版本流程(备忘)
以下命令默认在项目根目录(
c:\git_code\langchain_agentx)并已激活kw_venv。
1. 准备代码与版本号
- 修改版本号:编辑
pyproject.toml:- 把
[project]里的version = "0.x.y"改成新版本(例如0.2.0)。
- 把
- 确认工作区干净:
- 运行
git status,确认只有本次要发版的变更。
- 运行
2. 安装构建与发布工具
只需偶尔执行一次(环境更新或新机器时):
python -m pip install -U build twine
3. 本地构建分发包
在项目根目录执行:
python -m build
构建成功后会生成:
dist/langchain_agentx-<version>.tar.gzdist/langchain_agentx-<version>-py3-none-any.whl
4. 上传到 TestPyPI(可选,推荐先试)
- 在浏览器里登录
https://test.pypi.org/,创建/获取 API token。 - 在本机用户目录创建/编辑
~/.pypirc:
[distutils]
index-servers =
testpypi
[testpypi]
username = __token__
password = pypi-xxxxxxxxxxxxxxxxxxxx
- 运行上传命令:
python -m twine upload --repository testpypi dist/*
- 在一个干净的虚拟环境里测试安装:
python -m pip install -i https://test.pypi.org/simple/ langchain-agentx==<version>
5. 上传到正式 PyPI
- 在浏览器里登录
https://pypi.org/,创建/获取 API token。 - 在
~/.pypirc中增加正式仓库配置(若尚未配置):
[distutils]
index-servers =
pypi
testpypi
[pypi]
username = __token__
password = pypi-xxxxxxxxxxxxxxxxxxxx
[testpypi]
username = __token__
password = pypi-xxxxxxxxxxxxxxxxxxxx
- 上传到 PyPI:
python -m twine upload dist/*
6. 打 Tag 并推送(可选但推荐)
git add .
git commit -m "release: langchain-agentx <version>"
git tag v<version>
git push
git push --tags
下次发布时按本节从上到下依次执行即可。***
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
langchain_agentx-0.1.1.tar.gz
(109.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_agentx-0.1.1.tar.gz.
File metadata
- Download URL: langchain_agentx-0.1.1.tar.gz
- Upload date:
- Size: 109.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1778d165b2f0685188f8a44194dd185eb9b65e75806f7d13d279ddbea527f5e8
|
|
| MD5 |
a5806dbb16f7581db3a1541c46ddfd34
|
|
| BLAKE2b-256 |
775d62ba9509dfdad023acb3df1d976de608bc67395c706aeff3cffe3f3699e5
|
File details
Details for the file langchain_agentx-0.1.1-py3-none-any.whl.
File metadata
- Download URL: langchain_agentx-0.1.1-py3-none-any.whl
- Upload date:
- Size: 131.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5580a040ff2e0f50b9331d3db057d5ee39732a6081beae565a20946f7868b89c
|
|
| MD5 |
fc2b544346cfdcc69c83b6c31617bed6
|
|
| BLAKE2b-256 |
d032298f07467457e0c9c1e05a845f337f9aa55c1ef81d23e1ff093108c6846c
|