一键导入
neatlogs-py-crewai
Use when adding neatlogs observability to a Python project that uses CrewAI (imports `crewai`, builds a Crew/Flow with agents and tasks).
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when adding neatlogs observability to a Python project that uses CrewAI (imports `crewai`, builds a Crew/Flow with agents and tasks).
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when adding neatlogs observability to a Python project that uses LangChain or LangGraph (imports `langchain*` / `langgraph`, builds chains, runnables, or a graph).
Use when adding neatlogs observability to a TypeScript/Node.js project that uses LangChain or LangGraph (depends on `@langchain/*` / `@langchain/langgraph`).
Use when adding neatlogs observability to a Go project — Google Gemini (genai), Google ADK agents, or custom code. Covers Init, WrapGenAI, ADK passthrough, Trace, and Identify (sessions & end-users).
Use when adding neatlogs observability to a Python project that uses the Agno agent framework (imports `agno`, constructs Agno `Agent`s).
Use when adding neatlogs observability to a Python project that uses DSPy (imports `dspy`, defines `dspy.Module`s / signatures).
Use when adding neatlogs observability to a Python project that uses the Google Agent Development Kit (imports `google.adk`, builds an ADK agent/runner).
| name | neatlogs-py-crewai |
| description | Use when adding neatlogs observability to a Python project that uses CrewAI (imports `crewai`, builds a Crew/Flow with agents and tasks). |
| compatibility | Neatlogs Wizard Agent |
| metadata | {"author":"neatlogs","version":"3.1","language":"python","framework":"crewai"} |
This project uses CrewAI. Neatlogs instruments it with neatlogs.wrap(crew) — wrap the Crew (or Flow, or standalone Agent) instance once and the full span hierarchy is auto-traced.
neatlogs.wrap(crew)neatlogs.wrap() detects the CrewAI Crew/Flow/Agent and patches every run entrypoint, the crew's agents and tasks, plus installs class-level hooks on the tool dispatch paths (BaseTool.run AND CrewStructuredTool.invoke) and LLM.call. Span tree:
WORKFLOW crew.kickoff()
↳ AGENT each agent's task execution
↳ TOOL each tool call (BaseTool.run OR CrewStructuredTool.invoke)
↳ LLM LLM.call (the underlying model request)
Covered entrypoints: kickoff / kickoff_async / akickoff / kickoff_for_each / kickoff_for_each_async / akickoff_for_each, plus train / test / replay. Flows: flow.kickoff / kickoff_async / akickoff.
No instrumentations= and no provider pairing. Older guidance paired "crewai" with a provider instrumentor ("openai", "anthropic", …) to get LLM spans. wrap() patches LLM.call directly, so it captures LLM spans regardless of the model backend — you do NOT pass instrumentations=[...] and do NOT need to match a provider to the model string.
wrap() also auto-suppresses CrewAI's own built-in telemetry (the no-I/O Crew Created / Task Created / Flow Creation lifecycle spans), so those don't pollute your traces.
Combine with @neatlogs.span / neatlogs.trace / neatlogs.log for your own orchestration; the crew spans nest under them.
wrap() also handles a standalone agent run — agent.kickoff(messages=...) with no Crew. Wrap the agent before kicking it off:
agent = neatlogs.wrap(Agent(role="...", goal="...", backstory="...", tools=[...]))
result = agent.kickoff(messages="What is 2+2?")
Emits an AGENT span (crewai.agent.<role>) capturing the messages input, with tool/LLM calls nested under it.
wrap() traces tool calls on BOTH dispatch paths — BaseTool.run (for BaseTool subclasses) and CrewStructuredTool.invoke (for @tool function tools) — on every supported crewai version (0.130.x through 1.15.x). This is NOT version-dependent. Leave plain action tools undecorated: adding @neatlogs.span or a manual trace(kind="TOOL") inside a plain tool produces a DUPLICATE span. The only manual span is trace(kind="RETRIEVER") inside retrieval/embedding tools, to add neatlogs.retrieval.* attributes. Step 7 covers this.
crew = neatlogs.wrap(crew) on the Crew/Flow/Agent instance before its run entrypoint (kickoff / train / agent.kickoff / …).@neatlogs.span(kind="WORKFLOW") on YOUR user-facing function that builds + kicks off the crew, so your orchestration code is the trace root and the crew nests under it.references/6-prompt-templates.md.references/1-install-sdk.mdreferences/2-add-init.mdreferences/3-set-env.mdreferences/4-wrap-crew.mdreferences/5-add-workflow.mdreferences/6-prompt-templates.mdreferences/7-verify-tools.mdreferences/8-flush-shutdown.mdneatlogs.init() MUST execute BEFORE any crewai / LLM library imports.load_dotenv() exists, it MUST run BEFORE neatlogs.init().instrumentations=[...] to init() for CrewAI — wrap(crew) captures agents/tasks/tools/LLM.crew = neatlogs.wrap(crew). Returns the same instance.os.getenv().neatlogs.wrap(...)/neatlogs.span(...)/neatlogs.trace(...)/neatlogs.bind_templates(...)/neatlogs.register_crewai_task(...) → add import neatlogs.from neatlogs import SystemPromptTemplate, UserPromptTemplate. No bare import neatlogs.@neatlogs.span() goes BELOW framework decorators, closest to def.@neatlogs.span() to @tool functions, Agent definitions, or Task definitions — wrap() traces them.with neatlogs.trace(kind="TOOL") inside a plain tool body — wrap() already emits a TOOL span, so this DUPLICATES it. The only in-tool span is trace(kind="RETRIEVER") for retrieval/embedding tools (Step 7).references/span-kinds.mdreferences/sessions-and-end-users.md