Conversation maintains message history across turns. You call send() with a user message, and it appends both the user turn and the assistant response to messages — ready for the next turn.
Basic multi-turn
Streaming conversations
Useconv.stream() for token-by-token output with history tracking:
System prompts
conv.messages.
Controlling generation
Max tokens and temperature set at conversation creation for convenience, or override per turn withclient.chat() directly:
Resetting
Accessing the underlying client
Conversation wraps GatelitClient — you can still use it directly for non-conversation requests:
Tool calling (agents)
Pass tool definitions at conversation creation — the model decides between answering in text and calling tools on every turn:Multi-call turns
A model can call several tools in one turn. Providers require everytool_call_id of a turn to be answered in the next request — sending results one by one fails. Execute all calls, then batch the results:
The agent loop
send → execute tools → sendToolResults → repeat until the model answers in text is the whole loop. Run the full worked example locally:
packages/sdk/examples/agent.ts.)