Stable

LangChain Integration

Instrument LangChain tool-calling workflows with decorators around chain entrypoints and tool handlers to generate comparable estimate traces.

Install & Run

Install

Setup
pip install langchainpip install neurovn

Run

Execute
NEUROVN_API_URL=https://agentic-flow.onrender.com python langchain_agent.py

Architecture Flow

Chain entry

Wrap high-level chain invocation as an agent node.

Tool calls

Wrap tool handlers as tool nodes for latency/cost composition.

Results

Publish sessions to Neurovn for scenario comparison.

Implementation Snippets

Pattern

python
from neurovn import trace@trace.agent(name="LangChain Agent", model="Claude-3.5-Sonnet", provider="Anthropic")def run_agent(input_text: str) -> str:    return "response"

Troubleshooting

Wrap the chain entrypoint in `with trace.session(..., source="decorator", canvas_name="...")` to group a full LangChain run into one canvas.

Use one decorated wrapper per logical agent role rather than one monolithic wrapper.

Keep tool names stable to improve cross-run trend analysis.

Capture fallback branches as explicit functions if you want branch-aware cost comparisons.

Related Integrations

Backend contracts: `/api/estimate`, `/api/traces/sessions`, `/api/canvases`