Skip to content

langroid

v0.65.8 Feature

This release adds 2 notable features for engineering teams evaluating rollout.

✓ No known CVEs patched
Read the diff → Tool health → What is this tool? →

✓ No known CVEs patched in this version

Topics

agents ai chatgpt function-calling llm gpt-4
+10 more
gpt4 information-retrieval language-model llama llm-agent llm-framework local-llm multi-agent-systems openai-api retrieval-augmented-generation

Summary

AI summary

Updates name, server, and target across a mixed release.

Full changelog

0.65.8 — Faster MCP tool init

Building Langroid tools from an MCP server now costs one tools/list
round-trip instead of 1 + N. If you connect to MCP servers over the network
(SSE / HTTP), especially ones exposing many tools, tool initialization is now
materially faster. No API or behavior change for well-formed tools, and no
configuration needed.

pip install -U langroid

Performance — one list_tools() instead of 1 + N (#1054)

FastMCPClient.get_tools_async() previously issued 1 + N tools/list
round-trips to build N tools: one initial list_tools(), then — inside
get_tool_async → get_mcp_tool_async — one more full re-list per tool, just
to pick a single entry by name. Because fastmcp's Client.list_tools() is
uncached, every one of those is a real network call, so tool init scaled as
O(N) round-trips and dominated startup latency on slow or remote servers.

The network fetch is now split from the pure, synchronous, network-free
schema-to-ToolMessage conversion:

  • get_tools_async() calls list_tools() once and maps the conversion
    over the result — 1 round-trip total.
  • get_tool_async(name) still fetches its single Tool, then converts it.

Generated tool models are identical to before — verified by a new
behavior-equivalence test asserting get_tools_async() yields the same models
(names, fields, defaults, renamed fields, and order) as building each tool via
get_tool_async().

New — public tool_model_from_mcp_tool()

FastMCPClient.tool_model_from_mcp_tool(target) is now public: a pure,
synchronous, network-free conversion from an already-fetched mcp.types.Tool
into a Langroid ToolMessage subclass. Allow-list / subset consumers can fetch
one list_tools() snapshot, filter it, and build models for just the tools
they want — without re-listing the server once per tool:

async with FastMCPClient(server) as client:
    tools = await client.client.list_tools()
    wanted = [t for t in tools if t.name in {"search", "fetch"}]
    models = [client.tool_model_from_mcp_tool(t) for t in wanted]

Robustness

The now-public builder tolerates malformed or missing MCP tool metadata that
the previous inline code dereferenced unguarded — a null / non-dict
inputSchema, missing name / inputSchema / description, null nested
properties / items, and non-string required entries. An invalid tool name
raises a clear ValueError; a malformed schema now degrades to a permissive
model instead of raising AttributeError / TypeError and failing the whole
get_tools_async() batch on one bad tool.

Behavior change: a genuinely malformed tool that previously crashed tool
loading is now tolerated (built as a permissive model). Well-formed tools are
unaffected.

Credit

The optimization was originally proposed by
@alexagr in
#1053; this release ships it
with added hardening, tests, and docs.

Upgrade

pip install -U langroid

Full changelog:
0.65.7...0.65.8

Weekly OSS security release digest.

The CVE patches and breaking changes that affected production tools this week. One email, every Sunday.

No spam, unsubscribe anytime.

Share this release

Track langroid

Get notified when new releases ship.

Sign up free

About langroid

Harness LLMs with Multi-Agent Programming

All releases →

Related context

Earlier breaking changes

  • v0.65.9 MCP tool parameters now strictly validate enums, unions, and nested models.
  • v0.65.5 Blocks code‑execution, file, and network primitives in creation tools by default.
  • v0.65.5 Restricts retrieval tools to read‑only queries; write or admin clauses are rejected by default.
  • v0.65.3 Raw user messages containing tools registered with `enable_message(..., use=False, handle=True)` are now dropped instead of executed.
  • v0.65.2 Restricts eval'd expression builtins to a curated safe set, breaking code that relied on full Python builtins (e.g., __import__, open).

Beta — feedback welcome: [email protected]