knolo-core icon indicating copy to clipboard operation
knolo-core copied to clipboard

Feature request: Pydantic AI integration

Open HiveForensicsAI opened this issue 1 month ago • 0 comments

For human review. This issue was drafted from the Knolo Adoption Targets research. A human will review it and implement it manually. No code or pull request accompanies it.

Motivation

Pydantic AI is a popular type-safe Python agent framework with a built-in MCP client, so @knolo/mcp plugs in directly. A documented, tested path strengthens Knolo's Python story next to CrewAI (#95).

Adoption case

Sheet traction (Knolo Adoption Targets, Nov 2 candidate):

  • pydantic/pydantic-ai: 20,992 GitHub stars (GitHub API, checked 2026-11-02)
  • PyPI pydantic-ai: 1,723,783 downloads last week (https://pypistats.org/api/packages/pydantic-ai/recent, checked 2026-11-02)

Sources: https://github.com/pydantic/pydantic-ai ; https://ai.pydantic.dev/mcp/client/ ; https://pypistats.org/packages/pydantic-ai

What exists today

  • @knolo/tools 0.2.0 (in tree): host-agnostic read-only service. Pins a V5 Knowledge Image by file SHA-256 and state root, checks the policy root, and writes a query receipt before results return. Caller identity is supplied by the host.
  • @knolo/mcp 0.2.0 on main (npm still 0.1.0): stdio server with knolo_search, knolo_get, knolo_verify, knolo_status, plus knolo_kar_evaluate, knolo_kar_verify, knolo_cortex_verify for mounts with a pinned graph (PR #80, PR #87). Started with npx -y @knolo/mcp --config /absolute/knolo-mcp.json. Stdio only, no network at runtime.
  • @knolo/core and @knolo/cli 6.2.0, including KAR, composition and Cortex. PyPI knolo 5.5.1 (packages/core-python) has no KAR features.
  • Existing adapters: @knolo/openclaw, @knolo/langchain, @knolo/llamaindex. Open requests for other frameworks: #90 (OpenAI Agents SDK), #95 (CrewAI, Python), #93 (Mastra), #92 (Vercel AI SDK).

Proposed design

  1. examples/pydantic-ai: an agent that attaches @knolo/mcp as a stdio MCP server (npx -y @knolo/mcp --config ...) through Pydantic AI's MCP client, runs knolo_search, and returns a typed result model that carries the receipt id, state root and object ids so answers can be cited.
  2. A CI smoke test that runs the example offline against a fixture image using a test model, so no model API key is needed.
  3. Optional, decided at review: a small knolo-pydantic-ai toolset over PyPI knolo 5.5.1 for search and get only. No KAR features are promised in Python, since PyPI knolo 5.5.1 lacks them.

Scope

In: the example, the CI smoke test, README docs. Out: a Python port of KAR or Cortex, hosted services, network image downloads, write tools, any model calls inside Knolo. Any listing on Pydantic AI docs would be a separate manual step.

Acceptance criteria

  • Example runs offline against a fixture image and returns results with receipt ids.
  • Pin, policy and audit failures surface the same error codes as @knolo/tools (ACCESS_DENIED, AUDIT_UNAVAILABLE, etc.).
  • KAR and Cortex tools only appear when a graph is pinned, matching @knolo/mcp behavior.
  • Docs state that verification checks integrity and does not decide that a claim is true.

Open questions

  • Is the MCP example enough, or is a native Python toolset worth shipping before Python has KAR?
  • Share one Python example harness with #95 (CrewAI)?

Related

  • #79 / PR #80: @knolo/mcp read-only server
  • #84 / PR #87: KAR and Cortex tools in @knolo/mcp
  • #95: CrewAI tool (Python)
  • #90: OpenAI Agents SDK integration (same MCP-first pattern)

Knolo is open source under Apache-2.0, built by Hive Forensics AI Inc. R&D.

HiveForensicsAI avatar Nov 02 '26 08:11 HiveForensicsAI