> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pandaprobe.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Framework integrations

> Callbacks, adapters, and native agent tracing hooks

These APIs enable tracing. They do not enable reflection by themselves. Use the same explicit client for tracing and Reflect when combining them.

LangChain, LangGraph, and DeepAgents use callback handlers passed to native invocation configuration. Their inherited callback methods are framework hooks; applications normally construct a handler once and let the framework call it. The callback contracts below include those inherited SDK methods.

Other integrations use the framework's adapter, processor, query wrapper, or agent wrapper. Register instrumentation once at application startup. See [Reflect integrations](https://docs.pandaprobe.com/reflect/integrations/overview.md) for memory tooling and reflection continuation.

Google ADK, Claude Agent SDK, and CrewAI adapters expose synchronous `instrument()` registration. OpenAI Agents uses its native tracing processor hooks. Framework packages remain optional; constructing/importing a particular integration may require its optional dependency. Constructor `**kwargs` on LangChain-family handlers accepts the shared adapter identity options: `client`, `session_id`, `user_id`, `tags`, and `metadata`. LangGraph utility re-exports are included for completeness; prefer the native callback handler for instrumentation.

## On this page

[ClaudeAgentSDKAdapter](#claudeagentsdkadapter), [CrewAIAdapter](#crewaiadapter), [DeepAgentsCallbackHandler](#deepagentscallbackhandler), [GoogleADKAdapter](#googleadkadapter), [LangChainCallbackHandler](#langchaincallbackhandler), [LangGraphCallbackHandler](#langgraphcallbackhandler), [OpenAIAgentsAdapter](#openaiagentsadapter), [\_ROLE\_MAP](#_role_map), [\_normalize\_content\_blocks](#_normalize_content_blocks), [\_normalize\_role](#_normalize_role), [extract\_model\_parameters](#extract_model_parameters), [extract\_name](#extract_name), [extract\_reasoning\_from\_generation](#extract_reasoning_from_generation), [extract\_token\_usage](#extract_token_usage), [normalize\_langchain\_input](#normalize_langchain_input), [normalize\_langchain\_output](#normalize_langchain_output), [normalize\_llm\_generation\_output](#normalize_llm_generation_output), [normalize\_type\_to\_role](#normalize_type_to_role), [safe\_output](#safe_output).

## Example

```python theme={null}
from pandaprobe import Client
from pandaprobe.integrations.langchain import LangChainCallbackHandler

client = Client()
handler = LangChainCallbackHandler(client=client)
invocation_config = {"callbacks": [handler]}
# Pass invocation_config as config=... to your native agent invocation.
# Keep client alive for the agent's lifetime, then call client.shutdown().
```

Full native setup examples are in the [tracing integrations](https://docs.pandaprobe.com/tracing/integrations/overview.md) and [Reflect integrations](https://docs.pandaprobe.com/reflect/integrations/overview.md).

## `ClaudeAgentSDKAdapter`

```python theme={null}
from pandaprobe.integrations.claude_agent_sdk import ClaudeAgentSDKAdapter
```

PandaProbe integration adapter for the Claude Agent SDK.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/claude_agent_sdk/adapter.py#L70)

### Constructor

```text theme={null}
ClaudeAgentSDKAdapter(
  *,
  client: Client | None=None,
  session_id: str | None=None,
  user_id: str | None=None,
  tags: list[str] | None=None,
  metadata: dict[str, Any] | None=None,
)
```

| Parameter | Type | Default / passing |
| - | - | - |
| `client` | `Client \| None` | `None`; keyword only |
| `session_id` | `str \| None` | `None`; keyword only |
| `user_id` | `str \| None` | `None`; keyword only |
| `tags` | `list[str] \| None` | `None`; keyword only |
| `metadata` | `dict[str, Any] \| None` | `None`; keyword only |

### Methods

> [accordion] instrument
>
> Apply monkey-patches to Claude Agent SDK internals.
>
> ```text theme={null}
> instrument() -> bool
> ```

## `CrewAIAdapter`

```python theme={null}
from pandaprobe.integrations.crewai import CrewAIAdapter
```

PandaProbe integration adapter for CrewAI.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/crewai/adapter.py#L72)

### Constructor

```text theme={null}
CrewAIAdapter(
  *,
  client: Client | None=None,
  session_id: str | None=None,
  user_id: str | None=None,
  tags: list[str] | None=None,
  metadata: dict[str, Any] | None=None,
)
```

| Parameter | Type | Default / passing |
| - | - | - |
| `client` | `Client \| None` | `None`; keyword only |
| `session_id` | `str \| None` | `None`; keyword only |
| `user_id` | `str \| None` | `None`; keyword only |
| `tags` | `list[str] \| None` | `None`; keyword only |
| `metadata` | `dict[str, Any] \| None` | `None`; keyword only |

### Methods

> [accordion] instrument
>
> Apply monkey-patches to CrewAI internals.
>
> ```text theme={null}
> instrument() -> bool
> ```

## `DeepAgentsCallbackHandler`

```python theme={null}
from pandaprobe.integrations.deepagents import DeepAgentsCallbackHandler
```

LangChain `BaseCallbackHandler` for `deepagents`-built agents.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/deepagents/callback.py#L18)

### Constructor

```text theme={null}
DeepAgentsCallbackHandler(**kwargs: Any)
```

| Parameter | Type | Default / passing |
| - | - | - |
| `kwargs` | `Any` | Additional arguments |

### Fields and properties

| Name | Type | Default / contract |
| - | - | - |
| `DEFAULT_TRACE_NAME` | `str` | `'DeepAgents'` |

### Methods

> [accordion] on\_chain\_start
>
> ```text theme={null}
> on_chain_start(
>   serialized: dict[str, Any] | None,
>   inputs: dict[str, Any],
>   *,
>   run_id: UUID,
>   parent_run_id: UUID | None=None,
>   name: str | None=None,
>   **kwargs: Any,
> ) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `serialized` | `dict[str, Any] \| None` | Required |
> | `inputs` | `dict[str, Any]` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `parent_run_id` | `UUID \| None` | `None`; keyword only |
> | `name` | `str \| None` | `None`; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_chain\_end
>
> ```text theme={null}
> on_chain_end(outputs: dict[str, Any], *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `outputs` | `dict[str, Any]` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_chain\_error
>
> ```text theme={null}
> on_chain_error(error: BaseException, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `error` | `BaseException` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_llm\_start
>
> ```text theme={null}
> on_llm_start(
>   serialized: dict[str, Any] | None,
>   prompts: list[str],
>   *,
>   run_id: UUID,
>   parent_run_id: UUID | None=None,
>   invocation_params: dict[str, Any] | None=None,
>   name: str | None=None,
>   **kwargs: Any,
> ) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `serialized` | `dict[str, Any] \| None` | Required |
> | `prompts` | `list[str]` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `parent_run_id` | `UUID \| None` | `None`; keyword only |
> | `invocation_params` | `dict[str, Any] \| None` | `None`; keyword only |
> | `name` | `str \| None` | `None`; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_chat\_model\_start
>
> ```text theme={null}
> on_chat_model_start(
>   serialized: dict[str, Any] | None,
>   messages: list[list[Any]],
>   *,
>   run_id: UUID,
>   parent_run_id: UUID | None=None,
>   name: str | None=None,
>   **kwargs: Any,
> ) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `serialized` | `dict[str, Any] \| None` | Required |
> | `messages` | `list[list[Any]]` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `parent_run_id` | `UUID \| None` | `None`; keyword only |
> | `name` | `str \| None` | `None`; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_llm\_end
>
> ```text theme={null}
> on_llm_end(response: Any, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `response` | `Any` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_llm\_error
>
> ```text theme={null}
> on_llm_error(error: BaseException, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `error` | `BaseException` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_tool\_start
>
> ```text theme={null}
> on_tool_start(
>   serialized: dict[str, Any] | None,
>   input_str: str,
>   *,
>   run_id: UUID,
>   parent_run_id: UUID | None=None,
>   name: str | None=None,
>   **kwargs: Any,
> ) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `serialized` | `dict[str, Any] \| None` | Required |
> | `input_str` | `str` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `parent_run_id` | `UUID \| None` | `None`; keyword only |
> | `name` | `str \| None` | `None`; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_tool\_end
>
> ```text theme={null}
> on_tool_end(output: str, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `output` | `str` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_tool\_error
>
> ```text theme={null}
> on_tool_error(error: BaseException, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `error` | `BaseException` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_retriever\_start
>
> ```text theme={null}
> on_retriever_start(
>   serialized: dict[str, Any] | None,
>   query: str,
>   *,
>   run_id: UUID,
>   parent_run_id: UUID | None=None,
>   name: str | None=None,
>   **kwargs: Any,
> ) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `serialized` | `dict[str, Any] \| None` | Required |
> | `query` | `str` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `parent_run_id` | `UUID \| None` | `None`; keyword only |
> | `name` | `str \| None` | `None`; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_retriever\_end
>
> ```text theme={null}
> on_retriever_end(documents: Any, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `documents` | `Any` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

## `GoogleADKAdapter`

```python theme={null}
from pandaprobe.integrations.google_adk import GoogleADKAdapter
```

PandaProbe integration adapter for Google ADK.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/google_adk/adapter.py#L63)

### Constructor

```text theme={null}
GoogleADKAdapter(
  *,
  client: Client | None=None,
  session_id: str | None=None,
  user_id: str | None=None,
  tags: list[str] | None=None,
  metadata: dict[str, Any] | None=None,
)
```

| Parameter | Type | Default / passing |
| - | - | - |
| `client` | `Client \| None` | `None`; keyword only |
| `session_id` | `str \| None` | `None`; keyword only |
| `user_id` | `str \| None` | `None`; keyword only |
| `tags` | `list[str] \| None` | `None`; keyword only |
| `metadata` | `dict[str, Any] \| None` | `None`; keyword only |

### Methods

> [accordion] instrument
>
> Apply monkey-patches to Google ADK internals.
>
> ```text theme={null}
> instrument() -> bool
> ```

## `LangChainCallbackHandler`

```python theme={null}
from pandaprobe.integrations.langchain import LangChainCallbackHandler
```

LangChain `BaseCallbackHandler` for LangChain agents and LCEL chains.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/langchain/callback.py#L15)

### Constructor

```text theme={null}
LangChainCallbackHandler(**kwargs: Any)
```

| Parameter | Type | Default / passing |
| - | - | - |
| `kwargs` | `Any` | Additional arguments |

### Fields and properties

| Name | Type | Default / contract |
| - | - | - |
| `DEFAULT_TRACE_NAME` | `str` | `'LangChain'` |

### Methods

> [accordion] on\_chain\_start
>
> ```text theme={null}
> on_chain_start(
>   serialized: dict[str, Any] | None,
>   inputs: dict[str, Any],
>   *,
>   run_id: UUID,
>   parent_run_id: UUID | None=None,
>   name: str | None=None,
>   **kwargs: Any,
> ) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `serialized` | `dict[str, Any] \| None` | Required |
> | `inputs` | `dict[str, Any]` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `parent_run_id` | `UUID \| None` | `None`; keyword only |
> | `name` | `str \| None` | `None`; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_chain\_end
>
> ```text theme={null}
> on_chain_end(outputs: dict[str, Any], *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `outputs` | `dict[str, Any]` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_chain\_error
>
> ```text theme={null}
> on_chain_error(error: BaseException, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `error` | `BaseException` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_llm\_start
>
> ```text theme={null}
> on_llm_start(
>   serialized: dict[str, Any] | None,
>   prompts: list[str],
>   *,
>   run_id: UUID,
>   parent_run_id: UUID | None=None,
>   invocation_params: dict[str, Any] | None=None,
>   name: str | None=None,
>   **kwargs: Any,
> ) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `serialized` | `dict[str, Any] \| None` | Required |
> | `prompts` | `list[str]` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `parent_run_id` | `UUID \| None` | `None`; keyword only |
> | `invocation_params` | `dict[str, Any] \| None` | `None`; keyword only |
> | `name` | `str \| None` | `None`; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_chat\_model\_start
>
> ```text theme={null}
> on_chat_model_start(
>   serialized: dict[str, Any] | None,
>   messages: list[list[Any]],
>   *,
>   run_id: UUID,
>   parent_run_id: UUID | None=None,
>   name: str | None=None,
>   **kwargs: Any,
> ) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `serialized` | `dict[str, Any] \| None` | Required |
> | `messages` | `list[list[Any]]` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `parent_run_id` | `UUID \| None` | `None`; keyword only |
> | `name` | `str \| None` | `None`; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_llm\_end
>
> ```text theme={null}
> on_llm_end(response: Any, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `response` | `Any` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_llm\_error
>
> ```text theme={null}
> on_llm_error(error: BaseException, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `error` | `BaseException` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_tool\_start
>
> ```text theme={null}
> on_tool_start(
>   serialized: dict[str, Any] | None,
>   input_str: str,
>   *,
>   run_id: UUID,
>   parent_run_id: UUID | None=None,
>   name: str | None=None,
>   **kwargs: Any,
> ) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `serialized` | `dict[str, Any] \| None` | Required |
> | `input_str` | `str` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `parent_run_id` | `UUID \| None` | `None`; keyword only |
> | `name` | `str \| None` | `None`; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_tool\_end
>
> ```text theme={null}
> on_tool_end(output: str, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `output` | `str` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_tool\_error
>
> ```text theme={null}
> on_tool_error(error: BaseException, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `error` | `BaseException` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_retriever\_start
>
> ```text theme={null}
> on_retriever_start(
>   serialized: dict[str, Any] | None,
>   query: str,
>   *,
>   run_id: UUID,
>   parent_run_id: UUID | None=None,
>   name: str | None=None,
>   **kwargs: Any,
> ) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `serialized` | `dict[str, Any] \| None` | Required |
> | `query` | `str` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `parent_run_id` | `UUID \| None` | `None`; keyword only |
> | `name` | `str \| None` | `None`; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_retriever\_end
>
> ```text theme={null}
> on_retriever_end(documents: Any, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `documents` | `Any` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

## `LangGraphCallbackHandler`

```python theme={null}
from pandaprobe.integrations.langgraph import LangGraphCallbackHandler
```

LangChain `BaseCallbackHandler` that maps graph events to PandaProbe traces.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/langgraph/callback.py#L13)

### Constructor

```text theme={null}
LangGraphCallbackHandler(**kwargs: Any)
```

| Parameter | Type | Default / passing |
| - | - | - |
| `kwargs` | `Any` | Additional arguments |

### Fields and properties

| Name | Type | Default / contract |
| - | - | - |
| `DEFAULT_TRACE_NAME` | `str` | `'LangGraph'` |

### Methods

> [accordion] on\_chain\_start
>
> ```text theme={null}
> on_chain_start(
>   serialized: dict[str, Any] | None,
>   inputs: dict[str, Any],
>   *,
>   run_id: UUID,
>   parent_run_id: UUID | None=None,
>   name: str | None=None,
>   **kwargs: Any,
> ) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `serialized` | `dict[str, Any] \| None` | Required |
> | `inputs` | `dict[str, Any]` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `parent_run_id` | `UUID \| None` | `None`; keyword only |
> | `name` | `str \| None` | `None`; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_chain\_end
>
> ```text theme={null}
> on_chain_end(outputs: dict[str, Any], *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `outputs` | `dict[str, Any]` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_chain\_error
>
> ```text theme={null}
> on_chain_error(error: BaseException, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `error` | `BaseException` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_llm\_start
>
> ```text theme={null}
> on_llm_start(
>   serialized: dict[str, Any] | None,
>   prompts: list[str],
>   *,
>   run_id: UUID,
>   parent_run_id: UUID | None=None,
>   invocation_params: dict[str, Any] | None=None,
>   name: str | None=None,
>   **kwargs: Any,
> ) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `serialized` | `dict[str, Any] \| None` | Required |
> | `prompts` | `list[str]` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `parent_run_id` | `UUID \| None` | `None`; keyword only |
> | `invocation_params` | `dict[str, Any] \| None` | `None`; keyword only |
> | `name` | `str \| None` | `None`; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_chat\_model\_start
>
> ```text theme={null}
> on_chat_model_start(
>   serialized: dict[str, Any] | None,
>   messages: list[list[Any]],
>   *,
>   run_id: UUID,
>   parent_run_id: UUID | None=None,
>   name: str | None=None,
>   **kwargs: Any,
> ) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `serialized` | `dict[str, Any] \| None` | Required |
> | `messages` | `list[list[Any]]` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `parent_run_id` | `UUID \| None` | `None`; keyword only |
> | `name` | `str \| None` | `None`; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_llm\_end
>
> ```text theme={null}
> on_llm_end(response: Any, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `response` | `Any` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_llm\_error
>
> ```text theme={null}
> on_llm_error(error: BaseException, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `error` | `BaseException` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_tool\_start
>
> ```text theme={null}
> on_tool_start(
>   serialized: dict[str, Any] | None,
>   input_str: str,
>   *,
>   run_id: UUID,
>   parent_run_id: UUID | None=None,
>   name: str | None=None,
>   **kwargs: Any,
> ) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `serialized` | `dict[str, Any] \| None` | Required |
> | `input_str` | `str` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `parent_run_id` | `UUID \| None` | `None`; keyword only |
> | `name` | `str \| None` | `None`; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_tool\_end
>
> ```text theme={null}
> on_tool_end(output: str, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `output` | `str` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_tool\_error
>
> ```text theme={null}
> on_tool_error(error: BaseException, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `error` | `BaseException` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_retriever\_start
>
> ```text theme={null}
> on_retriever_start(
>   serialized: dict[str, Any] | None,
>   query: str,
>   *,
>   run_id: UUID,
>   parent_run_id: UUID | None=None,
>   name: str | None=None,
>   **kwargs: Any,
> ) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `serialized` | `dict[str, Any] \| None` | Required |
> | `query` | `str` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `parent_run_id` | `UUID \| None` | `None`; keyword only |
> | `name` | `str \| None` | `None`; keyword only |
> | `kwargs` | `Any` | Additional arguments |

> [accordion] on\_retriever\_end
>
> ```text theme={null}
> on_retriever_end(documents: Any, *, run_id: UUID, **kwargs: Any) -> None
> ```
>
> | Parameter | Type | Default / passing |
> | - | - | - |
> | `documents` | `Any` | Required |
> | `run_id` | `UUID` | Required; keyword only |
> | `kwargs` | `Any` | Additional arguments |

## `OpenAIAgentsAdapter`

```python theme={null}
from pandaprobe.integrations.openai_agents import OpenAIAgentsAdapter
```

PandaProbe integration adapter for the OpenAI Agents SDK.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/openai_agents/adapter.py#L68)

### Constructor

```text theme={null}
OpenAIAgentsAdapter(
  *,
  client: Client | None=None,
  session_id: str | None=None,
  user_id: str | None=None,
  tags: list[str] | None=None,
  metadata: dict[str, Any] | None=None,
)
```

| Parameter | Type | Default / passing |
| - | - | - |
| `client` | `Client \| None` | `None`; keyword only |
| `session_id` | `str \| None` | `None`; keyword only |
| `user_id` | `str \| None` | `None`; keyword only |
| `tags` | `list[str] \| None` | `None`; keyword only |
| `metadata` | `dict[str, Any] \| None` | `None`; keyword only |

### Methods

> [accordion] instrument
>
> Register a `TracingProcessor` with the OpenAI Agents SDK.
>
> ```text theme={null}
> instrument() -> bool
> ```

## `_ROLE_MAP`

```python theme={null}
from pandaprobe.integrations.langgraph.utils import _ROLE_MAP
```

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/_langchain_core/utils.py#L13)

```text theme={null}
_ROLE_MAP = {'human': 'user', 'ai': 'assistant', 'HumanMessage': 'user', 'AIMessage': 'assistant', 'SystemMessage': 'system', 'ToolMessage': 'tool'}
```

## `_normalize_content_blocks`

```python theme={null}
from pandaprobe.integrations.langgraph.utils import _normalize_content_blocks
```

Normalize provider-specific content block lists to a universal format.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/_langchain_core/utils.py#L28)

```text theme={null}
_normalize_content_blocks(content: Any) -> Any
```

| Parameter | Type | Default / passing |
| - | - | - |
| `content` | `Any` | Required |

## `_normalize_role`

```python theme={null}
from pandaprobe.integrations.langgraph.utils import _normalize_role
```

Map LangChain role names to the OpenAI-style equivalents.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/_langchain_core/utils.py#L23)

```text theme={null}
_normalize_role(role: str) -> str
```

| Parameter | Type | Default / passing |
| - | - | - |
| `role` | `str` | Required |

## `extract_model_parameters`

```python theme={null}
from pandaprobe.integrations.langgraph.utils import extract_model_parameters
```

Extract whitelisted model parameters, dropping `None` values and secrets.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/_langchain_core/utils.py#L69)

```text theme={null}
extract_model_parameters(invocation_params: Any) -> dict[str, Any] | None
```

| Parameter | Type | Default / passing |
| - | - | - |
| `invocation_params` | `Any` | Required |

## `extract_name`

```python theme={null}
from pandaprobe.integrations.langgraph.utils import extract_name
```

Extract a human-readable name from a LangChain serialized dict.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/_langchain_core/utils.py#L163)

```text theme={null}
extract_name(serialized: dict[str, Any] | None, fallback: str='unknown') -> str
```

| Parameter | Type | Default / passing |
| - | - | - |
| `serialized` | `dict[str, Any] \| None` | Required |
| `fallback` | `str` | `'unknown'` |

## `extract_reasoning_from_generation`

```python theme={null}
from pandaprobe.integrations.langgraph.utils import extract_reasoning_from_generation
```

Extract reasoning/thinking text from a LangChain LLM response.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/_langchain_core/utils.py#L301)

```text theme={null}
extract_reasoning_from_generation(response: Any) -> str | None
```

| Parameter | Type | Default / passing |
| - | - | - |
| `response` | `Any` | Required |

## `extract_token_usage`

```python theme={null}
from pandaprobe.integrations.langgraph.utils import extract_token_usage
```

Extract token usage from LangChain's `usage_metadata` and normalise
to PandaProbe's flat `dict[str, int]` standard (matching the ADK,
Gemini, OpenAI, and Anthropic wrappers):

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/_langchain_core/utils.py#L90)

```text theme={null}
extract_token_usage(response: Any) -> dict[str, int] | None
```

| Parameter | Type | Default / passing |
| - | - | - |
| `response` | `Any` | Required |

## `normalize_langchain_input`

```python theme={null}
from pandaprobe.integrations.langgraph.utils import normalize_langchain_input
```

Convert LangChain input formats to standard `role`/`content` dicts.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/_langchain_core/utils.py#L201)

```text theme={null}
normalize_langchain_input(inputs: Any) -> Any
```

| Parameter | Type | Default / passing |
| - | - | - |
| `inputs` | `Any` | Required |

## `normalize_langchain_output`

```python theme={null}
from pandaprobe.integrations.langgraph.utils import normalize_langchain_output
```

Extract only the last message from outputs, renaming `type` to `role`.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/_langchain_core/utils.py#L243)

```text theme={null}
normalize_langchain_output(outputs: Any) -> Any
```

| Parameter | Type | Default / passing |
| - | - | - |
| `outputs` | `Any` | Required |

## `normalize_llm_generation_output`

```python theme={null}
from pandaprobe.integrations.langgraph.utils import normalize_llm_generation_output
```

Extract the actual message from LangChain's `response.generations`.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/_langchain_core/utils.py#L338)

```text theme={null}
normalize_llm_generation_output(response: Any) -> Any | None
```

| Parameter | Type | Default / passing |
| - | - | - |
| `response` | `Any` | Required |

## `normalize_type_to_role`

```python theme={null}
from pandaprobe.integrations.langgraph.utils import normalize_type_to_role
```

Recursively rename `type` to `role`, normalize roles, and strip thinking blocks.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/_langchain_core/utils.py#L270)

```text theme={null}
normalize_type_to_role(data: Any) -> Any
```

| Parameter | Type | Default / passing |
| - | - | - |
| `data` | `Any` | Required |

## `safe_output`

```python theme={null}
from pandaprobe.integrations.langgraph.utils import safe_output
```

Ensure a callback output is JSON-serialisable.

[Source declaration](https://github.com/chirpz-ai/pandaprobe-sdk/blob/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python/src/pandaprobe/integrations/_langchain_core/utils.py#L176)

```text theme={null}
safe_output(value: Any) -> Any
```

| Parameter | Type | Default / passing |
| - | - | - |
| `value` | `Any` | Required |

***

Signatures and fields are generated from the [SDK source](https://github.com/chirpz-ai/pandaprobe-sdk/tree/92d8c37fba00e87ac6f0104cd293990aa5d5e621/libraries/python). See the [import index](https://docs.pandaprobe.com/reference/python/overview.md#public-import-index) for available entry points.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.