CrewAI
HighflameCrewHooks for CrewAI — register/unregister pattern, hooks on before/after LLM and tool calls. Available for Python and TypeScript. Session ID from crew.id automatically.
Installation
pip install 'highflame[crewai]'npm install @highflame/sdkBasic Usage
from highflame import Highflame
from highflame.integrations.crewai import HighflameCrewHooks
client = Highflame(api_key="hf_sk_...")
hooks = HighflameCrewHooks(client, mode="enforce")
hooks.register()
result = crew.kickoff()import { Highflame } from "@highflame/sdk";
import { HighflameCrewHooks } from "@highflame/sdk/integrations/crewai";
const client = new Highflame({ apiKey: "hf_sk_..." });
const hooks = new HighflameCrewHooks(client, { mode: "enforce" });
hooks.register(registry);
const result = await crew.kickoff();Constructor
HighflameCrewHooks(
client: Highflame,
*,
mode: str = "enforce",
session_id: str | None = None,
)Parameter
Type
Default
Description
new HighflameCrewHooks(client: Highflame, options?: {
mode?: "enforce" | "monitor" | "alert";
sessionId?: string;
sessionIdKey?: string;
})Parameter
Type
Default
Description
Session ID Resolution
Hooks
before_llm_call / beforeLlmCall
before_llm_call / beforeLlmCallafter_llm_call / afterLlmCall
after_llm_call / afterLlmCallbefore_tool_call / beforeToolCall
before_tool_call / beforeToolCallafter_tool_call / afterToolCall
after_tool_call / afterToolCallRegistration Patterns
Enforcement Modes
Complete Example
Session Tracking Across Crew Runs
Error Handling
Requirements
Package
Minimum Version
Package
Minimum Version
Last updated