langgraph_agent_toolkit.core.observability.phoenix module

Send isolated agent traces and prompts to Phoenix.

class langgraph_agent_toolkit.core.observability.phoenix.PhoenixObservability(remote_first=False, *, endpoint=None, project_name=None, api_key=None, timeout=None, client=None, http_client=None, tracer_provider=None, trace_config=None)[source][source]

Bases: BaseObservabilityPlatform

Use Phoenix without global tracing or LangChain patches.

Each instance owns its default HTTP client and tracer provider. The caller owns any injected client or provider.

Parameters:
  • remote_first (bool)

  • endpoint (str | None)

  • project_name (str | None)

  • api_key (str | None)

  • timeout (float | None)

  • client (Any)

  • http_client (Client | None)

  • tracer_provider (Any)

  • trace_config (TraceConfig | None)

__init__(remote_first=False, *, endpoint=None, project_name=None, api_key=None, timeout=None, client=None, http_client=None, tracer_provider=None, trace_config=None)[source][source]
Parameters:
  • remote_first (bool)

  • endpoint (str | None)

  • project_name (str | None)

  • api_key (str | None)

  • timeout (float | None)

  • client (Any)

  • http_client (Client | None)

  • tracer_provider (Any)

  • trace_config (TraceConfig | None)

Return type:

None

get_callback_handler(**kwargs)[source][source]

Create one native OpenInference callback for each run.

Parameters:

kwargs (Any)

Return type:

Any

trace_context(run_id, **kwargs)[source]

Start a root trace with the request UUID as its trace ID.

Parameters:
  • run_id (str)

  • kwargs (Any)

update_trace(trace, **attributes)[source][source]

Record root input and output through OpenInference masking.

Parameters:
  • trace (Any)

  • attributes (Any)

Return type:

None

record_feedback(run_id, key, score, **kwargs)[source][source]

Save human feedback as a native trace annotation.

Parameters:
  • run_id (str)

  • key (str)

  • score (float)

  • kwargs (Any)

Return type:

None

push_prompt(name, prompt_template, metadata=None, force_create_new_version=True)[source][source]

Create a native chat prompt version and optional version tags.

Parameters:
  • name (str)

  • prompt_template (str | List[ChatMessageDict])

  • metadata (dict[str, Any] | None)

  • force_create_new_version (bool)

Return type:

None

pull_prompt(name, template_format='f-string', **kwargs)[source][source]

Get the latest, tagged, or explicitly identified prompt version.

Parameters:
  • name (str)

  • template_format (Literal['f-string', 'mustache', 'jinja2'])

  • kwargs (Any)

Return type:

ChatPromptTemplate | str | dict | None

delete_prompt(name)[source][source]

Delete a prompt through the native Phoenix API.

Parameters:

name (str)

Return type:

None

before_shutdown()[source][source]

Flush and close the resources that this instance owns.

Return type:

None