Skip to content
Deep Agents

Agent analizy danych z Deep Agents

Zbuduj agenta AI do analizy danych, który przetwarza zbiory danych, wykonuje obliczenia Python, generuje wykresy i tworzy wnioski — z Deep Agents.

data analysisPythonchartsanalytics

Działający kod

Deep Agents
from deepagents import create_deep_agent
from langchain_core.tools import tool
@tool
def execute_python(code: str) -> str:
"""Execute Python code for data analysis. pandas and matplotlib are available."""
import subprocess
result = subprocess.run(
["python", "-c", code],
capture_output=True, text=True, timeout=30,
)
return result.stdout or f"Error: {result.stderr}"
@tool
def read_csv_info(path: str) -> str:
"""Get info about a CSV file (columns, types, shape)."""
import pandas as pd
df = pd.read_csv(path)
return f"Shape: {df.shape}\nColumns: {list(df.columns)}\nTypes:\n{df.dtypes}"
agent = create_deep_agent(
model="anthropic:claude-sonnet-4-5-20250929",
tools=[execute_python, read_csv_info],
system_prompt="You are a data analyst. Explore datasets using read_csv_info, then use execute_python to run analysis code. Present findings clearly with numbers.",
)
result = agent.invoke({
"messages": [("user", "Analyze sales_data.csv and find the top performing products by revenue")]
})
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.