The LingxiGraph core defines neutral message, model, and tool protocols without depending on LangChain or a provider SDK. Use an official adapter or implement your own ChatModel.
Messages and models
MessagesState.messages uses the add_messages reducer to upsert by stable ID while preserving order. It supports SystemMessage, HumanMessage, AIMessage, ToolMessage, streaming chunks, and RemoveMessage, all of which round-trip through typed JSON checkpoints.
The minimal asynchronous model protocol is:
The decorator generates JSON Schema from ordinary annotated parameters. A secret resolver injects token at the call boundary, so it is never exposed to the model or stored in state. Before execution, LingxiGraph checks static permissions, optional dynamic tool_authorize, the argument schema, timeout, and approval result.
Prebuilt ReAct agent
create_agent builds an agent → tools → agent loop with pre/post-model hooks, parallel tool calls, remaining-step handling, HITL, and structured-output repair. Parent and child graphs share model-call, tool-call, token, and cost budgets.
Permission answers “may this tool run?”, approval answers “is this invocation accepted?”, and idempotency answers “will retry duplicate the business effect?”. Production tools often need all three.