# JS createAgent
```js
import { createAgent, tool } from "langchain";
const agent = createAgent({
model: "openai:gpt-5.5",
tools: [getWeather],
});
```
## Rules
- Import `createAgent` and `tool` from `"langchain"`. Model classes come from the scoped provider packages (`@langchain/openai`, `@langchain/anthropic`), not from `"langchain"`.
- When an error is thrown, read its `lc_error_code` property first. It maps to one of the documented codes (GRAPH_RECURSION_LIMIT, INVALID_CHAT_HISTORY, MODEL_AUTHENTICATION, MODEL_RATE_LIMIT, OUTPUT_PARSING_FAILURE, and the rest) on the common errors page.
- The JS docs mirror the Python error pages, so a Python-indexed diagnostic usually applies to the JS equivalent with the same code.