langroid
Use Langroid to build Python LLM agents, tools, tasks, RAG/document chat, provider configs, structured data agents, MCP integrations, Chainlit callbacks, and no-network smoke checks.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- langroid
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use Langroid to build Python LLM agents, tools, tasks, RAG/document chat, provider configs, structured data agents, MCP integrations, Chainlit callbacks, and no-network smoke checks.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/install-and-extras.md2.8 KB
- 参考文档references/optional-dependencies.md2.7 KB
- 参考文档references/repo-provenance.md1.8 KB
- 参考文档references/repo-routing-metadata.json483 B
- 参考文档references/troubleshooting.md3.0 KB
- 脚本scripts/check_langroid_environment.py4.6 KB
03 SKILL.md 正文
Langroid Repo Skill
Use this repo skill when a task names Langroid or asks for Python LLM agent
workflows involving ChatAgent, Task, ToolMessage, providers, RAG,
structured data agents, MCP, Chainlit, or Langroid optional extras.
Langroid is a Python framework for building LLM-powered agents that use tools, exchange messages, delegate tasks, retrieve from documents, and integrate with providers and external tool systems.
First checks
Read references/repo-provenance.md when you
need to decide whether this skill matches a checkout or installed package
version. For install and extras selection, read
references/install-and-extras.md and
references/optional-dependencies.md.
Minimal package check:
python - <<'PY'
import langroid as lr
import langroid.language_models as lm
print(lr.ChatAgent, lr.Task, lr.ToolMessage)
print(lm.OpenAIGPTConfig().chat_model)
PY
No-network skill helper:
python scripts/check_langroid_environment.py --json --optional
Route by task
| User task shape | Read |
|---|---|
Create a ChatAgent, define/enable ToolMessage, wire handlers, use Task, delegate subtasks, route recipients, configure done_sequences, test with MockLM, or debug tool/task loops |
sub-skills/agents-tasks-tools/SKILL.md |
| Configure OpenAI-compatible models, Azure, Gemini, LiteLLM proxy, Ollama/local endpoints, Portkey, LangDB, HTTP clients, rotating keys, cached clients, embeddings, or model-name selection | sub-skills/llm-provider-config/SKILL.md |
Build document QA/RAG with DocChatAgent, parse PDFs/DOCX/URLs/Markdown/DataFrames, tune chunking/retrieval/reranking, choose vector stores or embeddings, or debug empty retrieval |
sub-skills/retrieval-doc-chat/SKILL.md |
Use TableChatAgent, SQLChatAgent, Neo4jChatAgent, ArangoChatAgent, CSV-to-KG, schema metadata, database URIs, query validators, or dangerous-operation safety controls |
sub-skills/data-sql-graph-agents/SKILL.md |
| Convert MCP servers to Langroid tools, choose async/decorator MCP patterns, enable search/file tools, wire Chainlit callbacks, HTML logging, quiet/status output, or external integration smoke checks | sub-skills/integrations-mcp-chainlit/SKILL.md |
Operating defaults
- Prefer deterministic
MockLMor config-construction checks before making live LLM/provider calls. - Use the smallest optional extra needed for the workflow; do not install
allunless broad demo coverage is explicitly required. - Treat API keys, local LLM servers, MCP subprocess transports, Chainlit apps, vector DB services, SQL/graph databases, model downloads, OCR, and GPU execution as optional live-backend work that needs explicit prerequisites.
- Keep security defaults unless the environment is trusted:
VectorStoreConfig.full_eval=False,TableChatAgentConfig.full_eval=False, and SQL/graphallow_dangerous_operations=False. - Do not depend on original repo examples or tests at runtime. Use this skill's bundled references and scripts.
Bundled smoke scripts
Run these from this skill directory or pass their full path from another current working directory:
python scripts/check_langroid_environment.py --json --optional
python sub-skills/agents-tasks-tools/scripts/core_agent_smoke.py
python sub-skills/llm-provider-config/scripts/provider_config_smoke.py --compact
python sub-skills/retrieval-doc-chat/scripts/rag_config_smoke.py --json
python sub-skills/data-sql-graph-agents/scripts/data_agent_safety_smoke.py
python sub-skills/integrations-mcp-chainlit/scripts/mcp_tool_smoke.py
These helpers avoid provider calls, live database queries, long-running servers, network downloads, training, and destructive writes by default.
Cross-cutting troubleshooting
Start with references/troubleshooting.md for
install/import/extras, provider credential boundaries, security defaults, and
which sub-skill owns each failure surface. Use sub-skill troubleshooting files
for workflow-specific symptoms and recovery.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).