langgraph_agent_toolkit.schema.schema module

class langgraph_agent_toolkit.schema.schema.AgentInfo(*, key, description)[source][source]

Bases: BaseModel

Information about an available agent.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • key (str)

  • description (str)

key: str
description: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.ServiceMetadata(*, agents, default_agent)[source][source]

Bases: BaseModel

Service metadata, including available agents and models.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • agents (list[AgentInfo])

  • default_agent (str)

agents: list[AgentInfo]
default_agent: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.UserComplexInput(*, message=None, **extra_data)[source][source]

Bases: BaseModel

User input for an agent with dynamic fields.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • message (str | list[dict[str, Any]] | None)

  • extra_data (Any)

message: str | list[dict[str, Any]] | None
model_config = {'extra': 'allow'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.UserInput(*, input, model_name=None, model_provider=None, model_config_key=None, thread_id=None, user_id=None, agent_config={}, recursion_limit=None)[source][source]

Bases: BaseModel

User input for an agent.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • input (UserComplexInput)

  • model_name (str | None)

  • model_provider (str | None)

  • model_config_key (str | None)

  • thread_id (str | None)

  • user_id (str | None)

  • agent_config (dict[str, Any])

  • recursion_limit (int | None)

input: UserComplexInput
model_name: str | None
model_provider: str | None
model_config_key: str | None
thread_id: str | None
user_id: str | None
agent_config: dict[str, Any]
recursion_limit: int | None
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.StreamInput(*, input, model_name=None, model_provider=None, model_config_key=None, thread_id=None, user_id=None, agent_config={}, recursion_limit=None, stream_tokens=True)[source][source]

Bases: UserInput

User input for streaming an agent response.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • input (UserComplexInput)

  • model_name (str | None)

  • model_provider (str | None)

  • model_config_key (str | None)

  • thread_id (str | None)

  • user_id (str | None)

  • agent_config (dict[str, Any])

  • recursion_limit (int | None)

  • stream_tokens (bool)

stream_tokens: bool
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.ToolCall[source][source]

Bases: TypedDict

Tool call request.

name: str

Tool name.

args: dict[str, Any]

Tool call arguments.

id: str | None

Tool call identifier.

type: NotRequired[Literal['tool_call']]
class langgraph_agent_toolkit.schema.schema.UsageMetadata[source][source]

Bases: TypedDict

Provider token counts in the LangChain usage format.

input_tokens: int
output_tokens: int
total_tokens: int
input_token_details: NotRequired[dict[str, int]]
output_token_details: NotRequired[dict[str, int]]
class langgraph_agent_toolkit.schema.schema.ChatMessage(*, type, content, tool_calls=[], tool_call_id=None, run_id=None, feedback_token=None, thread_id=None, response_metadata={}, usage_metadata=None, custom_data={})[source][source]

Bases: BaseModel

Chat message.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • type (Literal['human', 'ai', 'tool', 'custom'])

  • content (str | Dict[str, Any] | List[str | Dict[str, Any]])

  • tool_calls (list[ToolCall])

  • tool_call_id (str | None)

  • run_id (str | None)

  • feedback_token (Annotated[str | None, MaxLen(max_length=128)])

  • thread_id (str | None)

  • response_metadata (dict[str, Any])

  • usage_metadata (UsageMetadata | None)

  • custom_data (dict[str, Any])

type: Literal['human', 'ai', 'tool', 'custom']
content: str | Dict[str, Any] | List[str | Dict[str, Any]]
tool_calls: list[ToolCall]
tool_call_id: str | None
run_id: str | None
feedback_token: str | None
thread_id: str | None
response_metadata: dict[str, Any]
usage_metadata: UsageMetadata | None
custom_data: dict[str, Any]
pretty_repr()[source][source]

Get a readable message representation.

Return type:

str

pretty_print()[source][source]
Return type:

None

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.StreamChunk(*, type, content)[source][source]

Bases: BaseModel

One JSON Lines (NDJSON) chunk from an agent stream.

The /stream/jsonl endpoint emits one StreamChunk per line. type=”token” contains an incremental token string. type=”message” contains a complete ChatMessage. type=”error” contains an error description string.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • type (Literal['token', 'message', 'error'])

  • content (str | ChatMessage)

type: Literal['token', 'message', 'error']
content: str | ChatMessage
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.ErrorResponse(*, detail, error_code=None)[source][source]

Bases: BaseModel

Standard error response from service exception handlers.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • detail (str)

  • error_code (str | None)

detail: str
error_code: str | None
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.Feedback(*, run_id, feedback_token=None, key, score, user_id=None, kwargs={})[source][source]

Bases: BaseModel

Feedback for the configured observability platform.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • run_id (str)

  • feedback_token (Annotated[str | None, MaxLen(max_length=128)])

  • key (str)

  • score (float)

  • user_id (str | None)

  • kwargs (dict[str, Any])

run_id: str
feedback_token: str | None
key: str
score: float
user_id: str | None
kwargs: dict[str, Any]
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.FeedbackResponse(*, status='success', run_id, message='Feedback recorded successfully.')[source][source]

Bases: BaseModel

Response after feedback is recorded.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • status (Literal['success'])

  • run_id (str)

  • message (str)

status: Literal['success']
run_id: str
message: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.MessageInput(*, type, content, custom_data=None, tool_call_id=None, tool_calls=<factory>, usage_metadata=None, response_metadata=<factory>)[source][source]

Bases: BaseModel

Input for a chat history message.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • type (Literal['human', 'ai', 'tool', 'custom'])

  • content (str | list[str | dict[str, Any]])

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

  • tool_call_id (str | None)

  • tool_calls (list[ToolCall])

  • usage_metadata (UsageMetadata | None)

  • response_metadata (dict[str, Any])

type: Literal['human', 'ai', 'tool', 'custom']
content: str | list[str | dict[str, Any]]
custom_data: dict[str, Any] | None
tool_call_id: str | None
tool_calls: list[ToolCall]
usage_metadata: UsageMetadata | None
response_metadata: dict[str, Any]
validate_tool_message()[source][source]

Require the call ID for tool responses.

Return type:

MessageInput

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.AddMessagesInput(*, thread_id=None, user_id=None, messages)[source][source]

Bases: BaseModel

Input for adding chat history messages.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • thread_id (str | None)

  • user_id (str | None)

  • messages (list[MessageInput])

thread_id: str | None
user_id: str | None
messages: list[MessageInput]
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.AddMessagesResponse(*, status='success', thread_id=None, user_id=None, message='Messages added successfully.')[source][source]

Bases: BaseModel

Response after chat history messages are added.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • status (Literal['success'])

  • thread_id (str | None)

  • user_id (str | None)

  • message (str)

status: Literal['success']
thread_id: str | None
user_id: str | None
message: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.ClearHistoryInput(*, thread_id=None, user_id=None)[source][source]

Bases: BaseModel

Input for clearing one thread’s checkpoints without changing long-term memory.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • thread_id (str | None)

  • user_id (str | None)

thread_id: str | None
user_id: str | None
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.ClearHistoryResponse(*, status='success', thread_id=None, user_id=None, message='Messages cleared successfully.')[source][source]

Bases: BaseModel

Response after chat history messages are cleared.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • status (Literal['success'])

  • thread_id (str | None)

  • user_id (str | None)

  • message (str)

status: Literal['success']
thread_id: str | None
user_id: str | None
message: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.ChatHistoryInput(*, thread_id=None, user_id=None, offset=0, limit=100)[source][source]

Bases: BaseModel

Input for retrieving chat history.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • thread_id (str | None)

  • user_id (str | None)

  • offset (Annotated[int, Ge(ge=0)])

  • limit (Annotated[int, Ge(ge=1), Le(le=1000)])

thread_id: str | None
user_id: str | None
offset: int
limit: int
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.ChatHistory(*, messages, next_offset=None, total=None)[source][source]

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • messages (list[ChatMessage])

  • next_offset (int | None)

  • total (int | None)

messages: list[ChatMessage]
next_offset: int | None
total: int | None
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.HealthCheck(*, content, version)[source][source]

Bases: BaseModel

Response model for a health check.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • content (str)

  • version (str)

content: str
version: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.LivenessResponse(*, status, version)[source][source]

Bases: BaseModel

Response model for a liveness probe.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • status (Literal['alive', 'unhealthy'])

  • version (str)

status: Literal['alive', 'unhealthy']
version: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.ReadinessResponse(*, status, version, initialized_agents=[], message='')[source][source]

Bases: BaseModel

Response model for a readiness probe.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • status (Literal['ready', 'not_ready'])

  • version (str)

  • initialized_agents (List[str])

  • message (str)

status: Literal['ready', 'not_ready']
version: str
initialized_agents: List[str]
message: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.StartupResponse(*, status, version, message='')[source][source]

Bases: BaseModel

Response model for a startup probe.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • status (Literal['started', 'starting'])

  • version (str)

  • message (str)

status: Literal['started', 'starting']
version: str
message: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class langgraph_agent_toolkit.schema.schema.DatabaseHealthResponse(*, status, message=None, pool_size=None, pool_available=None, requests_waiting=None, connections_num=None)[source][source]

Bases: BaseModel

Response model for a database health check.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • status (Literal['healthy', 'exhausted', 'no_pool', 'error'])

  • message (str | None)

  • pool_size (int | None)

  • pool_available (int | None)

  • requests_waiting (int | None)

  • connections_num (int | None)

status: Literal['healthy', 'exhausted', 'no_pool', 'error']
message: str | None
pool_size: int | None
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

pool_available: int | None
requests_waiting: int | None
connections_num: int | None