LLM
The LLM type initializes a Large Language Model (LLM).
ENV TYPEYou use an LLM in conjunction with Env. The Env type is used to represent the environment in which an LLM operates. It allows the LLM to interact with inputs and outputs, such as directories, containers, and custom modules.
API reference
hasPrompt- Indicates whether there are any queued prompts or tool results to send to the model
history- return the llm message history
historyJSON- return the raw llm message history as json
id- A unique identifier for this LLM.
lastReply- return the last llm reply from the history
model- return the model used by the llm
provider- return the provider used by the llm
tools- print documentation for available tools
attempt- create a branch in the LLM's history
bindResult- returns the type of the current state
env- return the LLM's current environment
loop- Submit the queued prompt, evaluate any tool calls, queue their results, and keep going until the model ends its turn
step- Submit the queued prompt or tool call results, evaluate any tool calls, and queue their results
sync- synchronize LLM state
tokenUsage- returns the token usage of the current state
withBlockedFunction- Return a new LLM with the specified function no longer exposed as a tool
withEnv- allow the LLM to interact with an environment via MCP
withMCPServer- Add an external MCP server to the LLM
withModel- swap out the llm model
withoutDefaultSystemPrompt- Disable the default system prompt
withoutMessageHistory- Clear the message history, leaving only the system prompts
withoutSystemPrompts- Clear the system prompts, leaving only the default system prompt
withPrompt- append a prompt to the llm context
withPromptFile- append the contents of a file to the llm context
withStaticTools- Use a static set of tools for method calls, e.g. for MCP clients that do not support dynamic tool registration
withSystemPrompt- Add a system prompt to the LLM's environment
hasPrompt: Boolean!
Indicates whether there are any queued prompts or tool results to send to the model
history: [String!]!
return the llm message history
historyJSON: JSON!
return the raw llm message history as json
id: ID!
A unique identifier for this LLM.
lastReply: String!
return the last llm reply from the history
model: String!
return the model used by the llm
provider: String!
return the provider used by the llm
tools: String!
print documentation for available tools
bindResult(name: String!): Binding
returns the type of the current state
name: String!
loop: LLM!
Submit the queued prompt, evaluate any tool calls, queue their results, and keep going until the model ends its turn
step: LLM!
Submit the queued prompt or tool call results, evaluate any tool calls, and queue their results
tokenUsage: LLMTokenUsage!
returns the token usage of the current state
withBlockedFunction(typeName: String!, function: String!): LLM!
Return a new LLM with the specified function no longer exposed as a tool
typeName: String!The type name whose function will be blocked
function: String!The function to block
Will be converted to lowerCamelCase if necessary.
withMCPServer(name: String!, service: Service!): LLM!
Add an external MCP server to the LLM
name: String!The name of the MCP server
service: Service!The MCP service to run and communicate with over stdio
withoutDefaultSystemPrompt: LLM!
Disable the default system prompt
withoutMessageHistory: LLM!
Clear the message history, leaving only the system prompts
withoutSystemPrompts: LLM!
Clear the system prompts, leaving only the default system prompt
withPrompt(prompt: String!): LLM!
append a prompt to the llm context
prompt: String!The prompt to send
withPromptFile(file: File!): LLM!
append the contents of a file to the llm context
file: File!The file to read the prompt from
withStaticTools: LLM!
Use a static set of tools for method calls, e.g. for MCP clients that do not support dynamic tool registration
withSystemPrompt(prompt: String!): LLM!
Add a system prompt to the LLM's environment
prompt: String!The system prompt to send