Skip to content

LangGraph state and context

OverallState

OverallState extends LangChain AgentState, so messages and agent-runtime fields are inherited. AI Hub adds:

  • structured payloads for objectives, opportunities, trainings, simulations and profile analysis;
  • per-tool dictionaries of already suggested opportunity, talent and training IDs for “show more” requests;
  • processed Mongo message IDs;
  • summary for persisted conversation compaction;
  • the pre-supervisor guardrail decision;
  • turn-local knowledge_requested, knowledge_attempted, knowledge_status and knowledge_handoff_id; raw research evidence belongs to the isolated Knowledge Base run, outside conversation checkpoints;
  • knowledge_source_availability, refreshed at the start of each Career Chat turn to hide the handoff when no source is available;
  • tenant identifiers needed by the response layer.

Tools update structured fields and messages through langgraph.types.Command. Returned-item IDs belong in the appropriate already_suggested_*_dict; the old returned_opportunity_ids and follow_up_options fields are no longer part of the state schema.

ContextSchema

Request context is separate from persisted state. It contains client_id, data_source, user_application_id, source, conversation ID, resolved user, database handles, AI/tenant configuration, language, active agents/tools and the optional validated jwtoken.

Persistence

With DATABASE_URL, normal runtime uses the official AsyncPostgresSaver for checkpoints and AsyncPostgresStore for long-term memory. Without it, the existing MongoDBSaver and MongoDBStore remain active. Tests can request in-memory equivalents. Conversation summaries are persisted in the explicit summary channel so every specialist can reuse context after older messages are trimmed.