Gwenflow speaks one format to every provider. You build Message objects (or plain strings and dicts), and each client translates them to its own wire format; what comes back is a ModelResponse from an LLM and an AgentResponse from an agent. All of them live in gwenflow.types.

Input

Models and agents accept three shapes of input:

Message

message.to_dict() and Message.from_dict() round-trip a message, which is how a conversation is saved and restored.

Content parts

A content list mixes parts of several kinds: See Multi-modal input.

ModelResponse: one model call

llm.invoke() returns a ModelResponse. Its parts keep what the model produced in order (text, thinking, tool calls, audio, images); properties regroup them by kind:

AgentResponse: one agent run

agent.run() returns an AgentResponse:
agent.total_usage adds up the usage of every run of the agent, including delegations.

Events

The events of a run share agent_id, run_id, event_type, content and metadata: See Streaming for consuming them live.