langgraph_agent_toolkit.agents.blueprints.knowledge_base_agent.agent module

class langgraph_agent_toolkit.agents.blueprints.knowledge_base_agent.agent.AgentState[source][source]

Bases: MessagesState

State for the knowledge-base agent.

remaining_steps: Annotated[int, RemainingStepsManager]
retrieved_documents: list[dict[str, Any]]
kb_documents: str
messages: _add_messages at 0x7f1491b2efc0>]
langgraph_agent_toolkit.agents.blueprints.knowledge_base_agent.agent.get_kb_retriever()[source][source]

Create and return a knowledge-base retriever.

langgraph_agent_toolkit.agents.blueprints.knowledge_base_agent.agent.wrap_model(model)[source][source]

Add the knowledge-base system prompt to the model.

Parameters:

model (BaseChatModel)

Return type:

RunnableSerializable[AgentState, AIMessage]

async langgraph_agent_toolkit.agents.blueprints.knowledge_base_agent.agent.retrieve_documents(state, config)[source][source]

Retrieve documents relevant to the latest user message.

Parameters:
Return type:

AgentState

async langgraph_agent_toolkit.agents.blueprints.knowledge_base_agent.agent.prepare_augmented_prompt(state, config)[source][source]

Add retrieved document content to the prompt state.

Parameters:
Return type:

AgentState

async langgraph_agent_toolkit.agents.blueprints.knowledge_base_agent.agent.acall_model(state, config)[source][source]

Generate a response from retrieved documents.

Parameters:
Return type:

AgentState