langgraph-functional-api
БесплатноБез исполняемых скриптовНе проверенLangGraph Functional API (Python) — build stateful agent workflows with @entrypoint and @task decorators. Imperative Python style with LangGraph persistence…
от enuno★ 17 звёзд на GitHubОб этом скилле
LangGraph Functional API Skill
Expert assistance for the LangGraph Functional API: imperative, Python-native agent workflows using @entrypoint and @task decorators. Gets you LangGraph persistence, streaming, and human-in-the-loop with minimal boilerplate — especially useful for wrapping existing agents or frameworks.
When to choose Functional API over Graph API:
- You're wrapping an existing agent (CrewAI, AutoGen, Strands, etc.)
- Your workflow is naturally imperative (sequential Python logic with branches)
- You need parallel task execution without defining a graph topology
- You want to add persistence/streaming to an agent you didn't write in LangGraph
Full corpus: ../langgraph/references/llms-txt.md (5.4 MB) and ../../langchain-deepagents/references/llms-full.md (10 MB).
When to Use This Skill
Activate when:
- Writing @entrypoint workflows — defining the top-level entry to a LangGraph application
- Defining @task functions — wrapping individual operations with checkpointing and retries
- Running tasks in parallel — invoking multiple tasks concurrently and awaiting results
- Wrapping third-party agents — integrating CrewAI, AutoGen, Strands, or any framework
- Configuring durable execution — choosing
exit,async, orsyncdurability modes - Using tasks inside Graph API nodes — mixing both APIs in one graph
- Handling RunControl / GraphDrained — controlling graph execution lifecycle programmatically
- Streaming from functional workflows — getting token-level or state-level streaming output
Quick Reference
Minimal @entrypoint + @task
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.func import entrypoint, task
@task
def fetch_data(query: str) -> str:
return call_api(query) # Any IO operation
@task
def process_data(raw: str) -> str:
return transform(raw)
@entrypoint(checkpointer=InMemorySaver())
def my_workflow(inputs: dict) -> dict:
raw = fetch_data(inputs["query"]).result()
processed = process_data(raw).result()
return {"output": processed}
# Invoke with thread_id for persistence
result = my_workflow.invoke(
{"query": "hello"},
config={"configurable": {"thread_id": "1"}},
)
Parallel task execution
from langgraph.func import entrypoint, task
@task
def search_web(query: str) -> str:
return web_search(query)
@task
def search_docs(query: str) -> str:
return doc_search(query)
@entrypoint(checkpointer=InMemorySaver())
def research_workflow(inputs: dict) -> dict:
# Launch both tasks concurrently
web_future = search_web(inputs["query"])
docs_future = search_docs(inputs["query"])
# Collect results (blocks until both done)
web_result = web_future.result()
docs_result = docs_future.result()
return {"web": web_result, "docs": docs_result}
Task retry policy
from langgraph.func import entrypoint, task
from langgraph.types import RetryPolicy
@task(retry=RetryPolicy(max_attempts=3, backoff_factor=2.0))
def flaky_api_call(payload: dict) -> dict:
return requests.post(API_URL, json=payload).json()
@entrypoint(checkpointer=InMemorySaver())
def workflow(inputs: dict) -> dict:
result = flaky_api_call(inputs).result()
return {"result": result}
Durable execution modes
from langgraph.runtime import RunControl
# Choose durability level — trade-off: performance vs crash recovery
control = RunControl(
durability="sync" # "exit" | "async" | "sync"
# exit: fastest, saves only at exit (no mid-run crash recovery)
# async: saves asynchronously (good balance)
# sync: saves before every step (slowest, most durable)
)
Human-in-the-loop interrupt in a task
from langgraph.types import interrupt, Command
from langgraph.func import entrypoint, task
@task
def get_approval(action: str) -> str:
return interrupt({"prompt": f"Approve: {action}?"})
@entrypoint(checkpointer=InMemorySaver())
def workflow(inputs: dict) -> dict:
decision = get_approval(inputs["action"]).result()
if decision == "yes":
return {"status": "approved"}
return {"status": "rejected"}
# Resume after interrupt
workflow.invoke(
Command(resume="yes"),
config={"configurable": {"thread_id": "1"}},
)
Wrap a third-party agent (Strands, CrewAI, AutoGen)
from langgraph.func import entrypoint
from langgraph.checkpoint.memory import InMemorySaver
# Example: wrap a Strands agent
from strands import Agent as StrandsAgent
from strands_tools import http_request
strands_agent = StrandsAgent(tools=[http_request])
@entrypoint(checkpointer=InMemorySaver())
def strands_workflow(inputs: dict) -> dict:
# Your existing agent runs inside @entrypoint
# Gets LangSmith persistence, streaming, HITL for free
result = strands_agent(inputs["prompt"])
return {"output": str(result)}
# Now deployable to LangSmith with full observability
Tasks i
Установить langgraph-functional-api в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл langgraph-functional-api?
LangGraph Functional API (Python) — build stateful agent workflows with @entrypoint and @task decorators. Imperative Python style with LangGraph persistence, streaming, HITL, and durable execution. Ideal for wrapping existing agents (CrewAI, AutoGen, Strands) or complex parallel task logic.
Как установить скилл langgraph-functional-api?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл langgraph-functional-api запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic