Skip to content
Deep Agents

Pipeline RAG z Deep Agents

Zbuduj pipeline Retrieval-Augmented Generation, który przeszukuje dokumenty z embeddingami wektorowymi i odpowiada na pytania z cytatami — używając Deep Agents.

RAGvector storeembeddingsdocuments

Działający kod

Deep Agents
from deepagents import create_deep_agent
from langchain_core.tools import tool
@tool
def search_documents(query: str, top_k: int = 5) -> str:
"""Search uploaded documents for relevant content."""
results = vector_store.similarity_search(query, k=top_k)
return "\n\n".join(
f"[{i+1}] {r.metadata.get('source', 'unknown')}: {r.page_content}"
for i, r in enumerate(results)
)
agent = create_deep_agent(
model="anthropic:claude-sonnet-4-5-20250929",
tools=[search_documents],
system_prompt="You are a document Q&A assistant. Search documents before answering. Cite sources using [1], [2] format.",
)
result = agent.invoke({
"messages": [("user", "What does the refund policy say about digital products?")]
})
print(result["messages"][-1].content)

Krok po kroku

1

Zainstaluj zależności

Zainstaluj Deep Agents i wymagane narzędzia do tego przypadku użycia.

2

Zdefiniuj narzędzia

Stwórz specyficzne dla domeny funkcje narzędzi, których agent będzie używał do interakcji z zewnętrznymi serwisami.

3

Stwórz agenta i uruchom

Zainicjalizuj agenta Deep Agents z narzędziami, ustaw prompt systemowy i wykonaj zapytanie.

Gotowy do budowania z Deep Agents?

Wygeneruj gotowy do produkcji projekt z Deep Agents — FastAPI + Next.js, autoryzacja, streaming i więcej.

Rozpocznij

Gotowy, żeby zbudować swojego pierwszego agenta AI?

Open-source'owe narzędzia, sprawdzone wzorce, zero boilerplate'u. Skonfiguruj swój stos i wyślij w minuty — nie miesiące.