# Symptom
`create_agent` rejects your custom state schema, or state updates behave unexpectedly.
## Confirm
Look at your state definition. In v1, custom state must be a TypedDict (optionally subclassing `langchain.agents.AgentState`).
## Cause
v1 narrowed custom state to TypedDict only, defined via `state_schema` or middleware. Pydantic models and other schema styles from older patterns are not accepted.
## Fix
```python
from langchain.agents import create_agent, AgentState
class CustomState(AgentState):
user_name: str
agent = create_agent(model="...", tools=[...], state_schema=CustomState)
```
## Verify
Invoke with the custom key present and confirm a tool or node can read and write it. If tools need to write it, return state updates from the tool (see the agent-with-memory workflow).