langgraph_agent_toolkit.service.auth module

Bind conversation storage to authenticated callers.

class langgraph_agent_toolkit.service.auth.Principal(user_id: str, trusted: bool = False)[source][source]

Bases: object

Parameters:
  • user_id (str)

  • trusted (bool)

user_id: str
trusted: bool = False
__init__(user_id, trusted=False)
Parameters:
  • user_id (str)

  • trusted (bool)

Return type:

None

langgraph_agent_toolkit.service.auth.validate_auth_configuration()[source][source]

Reject ambiguous credentials and unauthenticated production startup.

Return type:

None

langgraph_agent_toolkit.service.auth.authenticate(token)[source][source]

Resolve a bearer token to one principal.

Parameters:

token (str | None)

Return type:

Principal

langgraph_agent_toolkit.service.auth.storage_thread_id(user_id, agent_id, thread_id)[source][source]

Scope short-term checkpoints to their owner, agent, and public thread.

This key does not replace the user ID used by long-term memory stores.

Parameters:
  • user_id (str)

  • agent_id (str)

  • thread_id (str)

Return type:

str

langgraph_agent_toolkit.service.auth.authenticated_user_id(request, user_id)[source][source]

Resolve the stable user identity for memory access and observability.

Parameters:
  • request (Request)

  • user_id (str | None)

Return type:

str

langgraph_agent_toolkit.service.auth.conversation_identity(request, agent_id, thread_id, user_id, *, create=False)[source][source]

Validate the caller and return public, owner, and storage identifiers.

Parameters:
  • request (Request)

  • agent_id (str)

  • thread_id (str | None)

  • user_id (str | None)

  • create (bool)

Return type:

tuple[str, str, str]

langgraph_agent_toolkit.service.auth.execution_input(request, agent_id, value)[source][source]

Create execution input with authenticated storage identifiers.

Parameters:
  • request (Request)

  • agent_id (str)