Skip to main content

Govern a CrewAI crew's native tool calls with Lodestar — the thin native hook that remotes each tool call through the Lodestar Action Kernel over NDJSON-RPC (ADR-0026).

Project description

lodestar-crewai

Govern a CrewAI crew's native tool calls with Lodestar — the open epistemic-governance framework for AI agents.

CrewAI runs role-based agents whose tools are native in-process Python objects and does not speak MCP, so the MCP proxy cannot wrap it. This package is the thin native hook (ADR-0026): it spawns the TypeScript governance-gate sidecar (lodestar runtime gate) and remotes each native tool call through the Lodestar Action Kernel over newline-delimited JSON-RPC. The same machinery the MCP proxy and the LangGraph adapter run — two-phase propose → arbitrate → execute, the signed policy gate, cognitive-core ingestion (external-document content can't auto-promote), sentinel arbitration, and the signed-approval L4 hold path — now applies to CrewAI, with no change to the engine. The gate sidecar is shared, unchanged; only this hook is new.

The tool body runs only inside the gate's execute phase, reached only after the gate (and any approval hold) clears: "tools that do work before approval are bugs" — across the Python↔TS boundary.

Install

pip install "lodestar-crewai[crewai]"
# and the Lodestar CLI (Bun/npm), which provides `lodestar runtime gate`:
npm install -g @qmilab/lodestar-cli   # or: bun add -g @qmilab/lodestar-cli

Use

from crewai import Agent, Crew, Task
from lodestar_crewai import GateClient, govern_tools, governed_call

with GateClient("runtime-gate.config.json") as gate:
    governed = govern_tools(gate, my_tools)        # register + wrap the toolset
    agent = Agent(role="researcher", goal="...", backstory="...", tools=governed)
    task = Task(description="...", agent=agent, expected_output="...")
    crew = Crew(agents=[agent], tasks=[task])
    crew.kickoff()                                  # every tool call is governed

    # A custom step invokes a governed tool through the helper, never raw:
    result = governed_call(gate, "search_web", {"q": "lodestar"})

The gate's config (runtime-gate.config.json) is a RuntimeGateConfig — the signed policy document, approver keys, sentinel ids, persistence, and durable log root all live there. The hook never holds credentials or policy.

Scope (honest, ADR-0004 lineage)

This is governance over declared actions, not OS containment of the process. Raw I/O performed outside the tool abstraction — a custom step that calls requests.get() directly instead of a registered tool — is outside the governed surface, exactly as guard.wrap() and the MCP proxy only govern the tools they are given. A call for an unregistered tool is denied (fail closed). Pair the adapter with network/filesystem controls for defense in depth.

Holds & denials

An L4 action the trust-ladder floor parks for approval is resolved by block-polling the gate up to the deadline for a signed approval (hold_wait_ms) — the headless default. A denied / held-then-timed-out call raises LodestarDenied by default; CrewAI's ToolUsage catches it and surfaces the reason to the agent as a re-plannable observation. Pass on_denied to govern_tools to map a denial to a return value instead.

Apache-2.0. Part of the Lodestar monorepo (runtimes/crewai/).

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

lodestar_crewai-0.3.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

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

lodestar_crewai-0.3.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file lodestar_crewai-0.3.0.tar.gz.

File metadata

  • Download URL: lodestar_crewai-0.3.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for lodestar_crewai-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d2631d4bd3ca6c45a621c2060978c28f26bf2a8828749445e937aff8035a5570
MD5 dffb4a48e49b1f962517232087ea8c4f
BLAKE2b-256 c5dd06d8a9cf536c133c4f270e9568aad72d6846fb65c498cdbf39c681992358

See more details on using hashes here.

File details

Details for the file lodestar_crewai-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: lodestar_crewai-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for lodestar_crewai-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8df33b5b9344ba96169bb6d41d9db55cb48799e94e78c83c1a3a4ce505bb7755
MD5 322f273c3bc72e3bbd589295c6185ebb
BLAKE2b-256 023b7823ab1081ca5fb978bde61eb8d3d84aefadc5f7e3161db125837c514d61

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