Loading...
Loading...
Expert guidance for LangChain and LangGraph development with Python, covering chain composition, agents, memory, and RAG implementations.
npx skill4agent add mindrally/skills langchain-developmentproject/
├── chains/ # LangChain chain definitions
├── agents/ # Agent configurations and tools
├── tools/ # Custom tool implementations
├── memory/ # Memory and state management
├── prompts/ # Prompt templates and management
├── retrievers/ # RAG and retrieval components
├── callbacks/ # Custom callback handlers
├── utils/ # Utility functions
├── tests/ # Test files
└── config/ # Configuration filescreate_retrieval_chainbuild_agent_executor|RunnableSequenceRunnableParallelRunnableLambdafrom langchain_core.runnables import RunnableParallel, RunnablePassthrough
chain = (
RunnableParallel(
context=retriever,
question=RunnablePassthrough()
)
| prompt
| llm
| output_parser
)invoke()batch()stream()with_config()bind()@toolfrom langchain_core.tools import tool
from pydantic import BaseModel, Field
class SearchInput(BaseModel):
query: str = Field(description="Search query string")
@tool(args_schema=SearchInput)
def search_database(query: str) -> str:
"""Search the database for relevant information."""
# Implementation
return resultscreate_react_agentcreate_tool_calling_agentConversationBufferMemoryConversationSummaryMemoryConversationBufferWindowMemoryfrom typing import TypedDict, Annotated
from langgraph.graph import StateGraph
from operator import add
class AgentState(TypedDict):
messages: Annotated[list, add]
context: str
next_step: str
graph = StateGraph(AgentState)LANGCHAIN_TRACING_V2=truefrom langchain_core.runnables import RunnableWithFallbacks
chain_with_fallback = primary_chain.with_fallbacks(
[fallback_chain],
exceptions_to_handle=(RateLimitError, TimeoutError)
)ainvokeabatch