If your backend is Python langgraph dev, @langchain/react@1.0.1 is not usable with it yet. The Python Agent Server does not expose POST /threads/{thread_id}/commands or POST /threads/{thread_id}/stream/events.
Use the legacy SDK hook instead:
npm install @langchain/langgraph-sdk
import { useStream } from "@langchain/langgraph-sdk/react";
const stream = useStream({
apiUrl: "http://localhost:2024",
assistantId: "agent",
});
Only use @langchain/react@1.x today if you serve the agent with the JS/TS @langchain/langgraph-api>=1.2.0 server. Do not try to fix this with paths - the protocols differ, not just the URLs.