> Ready!>> - API: [http://localhost:2024](http://localhost:2024/)>> - Docs: http://localhost:2024/docs>> - LangGraph Studio Web UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024
langgraph dev 명령은 인메모리 모드로 LangGraph Server를 시작합니다. 이 모드는 개발 및 테스트 목적에 적합합니다. 프로덕션 사용을 위해서는 영구 스토리지 백엔드에 액세스할 수 있는 LangGraph Server를 배포하세요. 자세한 내용은 호스팅 개요를 참조하세요.
from langgraph_sdk import get_clientimport asyncioclient = get_client(url="http://localhost:2024")async def main(): async for chunk in client.runs.stream( None, # Threadless run "agent", # Name of assistant. Defined in langgraph.json. input={ "messages": [{ "role": "human", "content": "What is LangGraph?", }], }, ): print(f"Receiving new event of type: {chunk.event}...") print(chunk.data) print("\n\n")asyncio.run(main())
LangGraph Python SDK를 설치합니다:
Copy
pip install langgraph-sdk
어시스턴트에 메시지를 보냅니다 (스레드 없는 실행):
Copy
from langgraph_sdk import get_sync_clientclient = get_sync_client(url="http://localhost:2024")for chunk in client.runs.stream( None, # Threadless run "agent", # Name of assistant. Defined in langgraph.json. input={ "messages": [{ "role": "human", "content": "What is LangGraph?", }], }, stream_mode="messages-tuple",): print(f"Receiving new event of type: {chunk.event}...") print(chunk.data) print("\n\n")