Skip to content

LangGraph adapter fails to load OciGenAiConfig LlmNode with structured output #232

Description

@JainSajal23

The LangGraph Agent Spec adapter fails while loading a valid Flow containing an LlmNode configured with OciGenAiConfig and a strict nested output schema.

Agent Spec serialization succeeds, but runtime loading fails before any OCI request is sent.

Reproduction

The LlmNode declares a structured output such as:

{
  "title": "result",
  "type": "object",
  "required": ["name", "profile"],
  "properties": {
    "name": {"type": "string"},
    "profile": {
      "type": "object",
      "required": ["score", "active", "tags"]
    }
  }
}

The LangGraph runtime is loaded with:

RUNTIME_CLASS_IMPORT_PATH=langgraphruntime.LanggraphAgentSpecLoader

Actual behavior

Loading the component fails with:

ValueError: Unsupported tool type <class 'dict'>.
Tool must be passed in as a BaseTool instance, TypedDict class, or BaseModel type.

The failure occurs in:

pyagentspec/adapters/langgraph/_node_execution.py
self.llm.with_structured_output(json_schema)

Then:

ChatOCIGenAI.bind_tools([json_schema])

The adapter passes the JSON schema as a raw Python dictionary, but the installed langchain_oci provider rejects dictionary tool definitions.

Expected behavior

The LangGraph adapter should either:

  1. Convert the Agent Spec JSON schema into a supported structured-output representation before calling ChatOCIGenAI; or
  2. Raise a clear unsupported-feature error during configuration validation.

The component should not fail with a low-level Unsupported tool type <class 'dict'> error.

Impact

  • Agent Spec serialization succeeds.
  • LangGraph component loading fails.
  • The OCI endpoint is never called.
  • Structured LlmNode tests cannot execute with OciGenAiConfig.
  • The same Agent Spec may behave differently across LangGraph and WayFlow runtimes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions