Repository navigation
Adding a Framework Integration
Naveen Nair edited this page Nov 1, 2026
·
2 revisions
An integration lets people trace an agent framework with one line instead of wrapping every call by hand. Think of it as a plug adapter: the framework has its own socket shape, and the adapter turns its events into Tracedown spans.
- Python:
sdk/python/agent_tracedown/integrations/, one file per framework. - TypeScript:
sdk/typescript/src/integrations/.
Read an existing one first. pydantic_ai.py is a good, compact example; langchain.py shows a callback handler.
| The framework gives you… | Use |
|---|---|
| A place to wrap calls in your own code (you call the model and tools) |
tdn.run, tdn.llm_call, tdn.tool_call context managers. Replay works for free. |
| Callbacks or events, possibly on other threads |
ManualTrace: start(key, name, kind, parent=…), end(key, output=…, error=…), finish(output=…)
|
from ..tracer import ManualTrace
t = ManualTrace("ResearchCrew", input=inputs)
t.start("agent-1", "Researcher", "agent")
t.start("tool-7", "execute_tool web_search", "tool", parent="agent-1", input=args,
attrs={"gen_ai.tool.name": "web_search"})
t.end("tool-7", output=result)
t.finish(output=answer)-
Import the framework lazily (inside functions), so
import agent_tracedownnever needs it. - Never raise from tracing code. If the framework's event shape surprises you, record what you can and carry on.
-
Record what the detectors need: the tool name (
gen_ai.tool.name), tool arguments and errors, model name and token usage, retrieved documents as a list of{id, text, source, score}, and the tools offered to the model (declare_tools). - Failed runs matter most. Make sure an exception inside the framework still produces a finished run with the error recorded.
-
Add an extra in
sdk/python/pyproject.tomlpinning the version you tested, e.g.myframework = ["myframework>=1.2"]. -
Add a test under
sdk/python/tests/integrations/that drives the real library without network (a fake model client), and add the framework to theframeworksmatrix in.github/workflows/ci.yml. -
Document it: a row in the integrations table in the README and
docs/integrations.md, with the one-line usage.
- A failing demo-style run through the framework gives the same root cause as the hand-written equivalent.
-
PYTHONPATH=sdk/python pytest sdk/python/tests/integrationspasses with the extra installed.
Tracedown is Apache-2.0, every feature free · Repository · Documentation · Something out of date? These pages live in wiki/: open a pull request or an issue.
Understand
Contribute
- Your First Contribution
- Development Setup
- Architecture Tour
- Writing a Detector
- Adding a Framework Integration
- Adding a Demo Story
- Reporting a Wrong Diagnosis
Run and maintain