A conversation with a large language model (LLM): queue prompts, expose tools, and step the model until it completes its turn.
Summary
Functions
estimated number of tokens currently occupying the context window; unlike tokenUsage this is not cumulative over the session
The model's total context window in tokens, or null if unknown (e.g. a local or uncatalogued model).
Fork the conversation, so that otherwise-identical follow-ups evaluate independently instead of deduplicating to a single cached result.
Report whether anything is queued to send to the model: an unsent prompt or unevaluated tool results. When true, another step will do work; when false, the turn is complete.
A unique identifier for this LLM.
The text of the model's most recent reply.
Send the queued prompt and step the model against the available tools, until it ends its turn: a reply with no tool calls and nothing left queued.
The full message history, as structured messages.
The model the conversation is running against, after resolving any configured default.
A portable, self-contained ID for the conversation that node() can resolve in any session. Unlike id, which may return an engine-local runtime handle valid only within the current session, this returns the recipe form suitable for persisting and later restoring the conversation. The recipe is flattened: bindings superseded during the session (workspace overlays recorded by each mutating tool call, and re-bound toolsets) are dropped, while the current workspace binding — including any pending, un-exported edits — is preserved.
The provider serving the model, e.g. "anthropic", "openai", "google", or "local".
The reasoning effort in use, e.g. "low", "medium", or "high". Empty or "none" when reasoning is disabled.
Re-emit telemetry spans for the full message history, so a loaded conversation displays in the TUI.
The skills visible to the model, exactly as the ListSkills tool serves them: engine-embedded skills, skills installed with withSkills, and skills discovered in the workspace.
Advance the conversation by a single step: send the queued prompt or tool results to the model, evaluate any tool calls it makes, and queue their results. Use loop to step until the model ends its turn.
Force evaluation of the conversation's pending operations (prompts, steps, loops) in the engine.
The cumulative token usage, summed across every API call in the conversation.
Render documentation for the tools currently exposed to the model.
The message history rendered as a plain-text transcript, suitable for feeding back to an LLM (e.g. for summarization).
Add an external MCP server to the LLM
Change the model for the rest of the conversation. The message history is preserved; the new model takes effect on the next step.
Queue a user prompt, to be sent to the model on the next step or loop.
Queue a file's contents as a user prompt, like withPrompt.
Change the reasoning effort for the rest of the conversation, overriding any configured default. The message history is preserved; the new effort takes effect on the next step.
Append an assistant response to the message history without calling the model, e.g. to reconstruct a conversation from another source.
Install skills from a directory, adding them to the skills the model discovers with ListSkills and reads with ReadSkill. Each skill is a directory containing a SKILL.md with name and description frontmatter, discovered anywhere in the tree. Installed skills take precedence over skills discovered in the workspace, but cannot shadow the engine's built-in skills.
Add a system prompt, instructing the model across the whole conversation.
Append the result of a tool call to the message history.
Expose an object's methods as tools. Every eligible method of the bound object becomes a tool; a tool that returns this object's own type replaces it as the new state. Repeatable to bind several objects.
Bind the LLM to a workspace, exposing its modules as tools exactly as the Dagger CLI would serve them for that workspace.
Disable the default system prompt
Clear the message history, keeping only the system prompts.
Clear the user-added system prompts, keeping only the default system prompt.
Return the workspace the LLM is bound to.
Types
Functions
estimated number of tokens currently occupying the context window; unlike tokenUsage this is not cumulative over the session
The model's total context window in tokens, or null if unknown (e.g. a local or uncatalogued model).
Fork the conversation, so that otherwise-identical follow-ups evaluate independently instead of deduplicating to a single cached result.
Report whether anything is queued to send to the model: an unsent prompt or unevaluated tool results. When true, another step will do work; when false, the turn is complete.
A unique identifier for this LLM.
The text of the model's most recent reply.
Send the queued prompt and step the model against the available tools, until it ends its turn: a reply with no tool calls and nothing left queued.
@spec messages(t()) :: {:ok, [Dagger.LLMMessage.t()]} | {:error, term()}
The full message history, as structured messages.
The model the conversation is running against, after resolving any configured default.
A portable, self-contained ID for the conversation that node() can resolve in any session. Unlike id, which may return an engine-local runtime handle valid only within the current session, this returns the recipe form suitable for persisting and later restoring the conversation. The recipe is flattened: bindings superseded during the session (workspace overlays recorded by each mutating tool call, and re-bound toolsets) are dropped, while the current workspace binding — including any pending, un-exported edits — is preserved.
The provider serving the model, e.g. "anthropic", "openai", "google", or "local".
The reasoning effort in use, e.g. "low", "medium", or "high". Empty or "none" when reasoning is disabled.
Re-emit telemetry spans for the full message history, so a loaded conversation displays in the TUI.
@spec skills(t()) :: {:ok, [Dagger.LLMSkill.t()]} | {:error, term()}
The skills visible to the model, exactly as the ListSkills tool serves them: engine-embedded skills, skills installed with withSkills, and skills discovered in the workspace.
Advance the conversation by a single step: send the queued prompt or tool results to the model, evaluate any tool calls it makes, and queue their results. Use loop to step until the model ends its turn.
Force evaluation of the conversation's pending operations (prompts, steps, loops) in the engine.
@spec token_usage(t()) :: Dagger.LLMTokenUsage.t()
The cumulative token usage, summed across every API call in the conversation.
Render documentation for the tools currently exposed to the model.
The message history rendered as a plain-text transcript, suitable for feeding back to an LLM (e.g. for summarization).
@spec with_mcp_server(t(), String.t(), Dagger.Service.t()) :: t()
Add an external MCP server to the LLM
Change the model for the rest of the conversation. The message history is preserved; the new model takes effect on the next step.
Queue a user prompt, to be sent to the model on the next step or loop.
@spec with_prompt_file(t(), Dagger.File.t()) :: t()
Queue a file's contents as a user prompt, like withPrompt.
Change the reasoning effort for the rest of the conversation, overriding any configured default. The message history is preserved; the new effort takes effect on the next step.
@spec with_response(t(), [Dagger.LLMContentBlockInput.t()], input_tokens: integer() | nil, output_tokens: integer() | nil, cached_token_reads: integer() | nil, cached_token_writes: integer() | nil, total_tokens: integer() | nil ) :: t()
Append an assistant response to the message history without calling the model, e.g. to reconstruct a conversation from another source.
@spec with_skills(t(), Dagger.Directory.t()) :: t()
Install skills from a directory, adding them to the skills the model discovers with ListSkills and reads with ReadSkill. Each skill is a directory containing a SKILL.md with name and description frontmatter, discovered anywhere in the tree. Installed skills take precedence over skills discovered in the workspace, but cannot shadow the engine's built-in skills.
Add a system prompt, instructing the model across the whole conversation.
Append the result of a tool call to the message history.
@spec with_tools(t(), Dagger.Node.t(), [{:except, [String.t()]}]) :: t()
Expose an object's methods as tools. Every eligible method of the bound object becomes a tool; a tool that returns this object's own type replaces it as the new state. Repeatable to bind several objects.
@spec with_workspace(t(), Dagger.Workspace.t()) :: t()
Bind the LLM to a workspace, exposing its modules as tools exactly as the Dagger CLI would serve them for that workspace.
Disable the default system prompt
Clear the message history, keeping only the system prompts.
Clear the user-added system prompts, keeping only the default system prompt.
@spec workspace(t()) :: Dagger.Workspace.t()
Return the workspace the LLM is bound to.