The built in tool definition
Adds a Javascript function as a tool using callable
Function will be called when the tool invocation occured
Tool descriotion
Adds a REST API tool that performs external HTTP requests
REST API tool definition
Optional
auth: ToolAuthenticatorOptional authenticator to inject into the request
Adds a custom tool to the agent
Tool instance to be added
Create a MCP server and register its tools to agent.
The unique name of the MCP server. If there's already a MCP server with the same name, it throws Error.
Parameters for connecting to the MCP stdio server
Optional
options: { toolsToAdd?: string[] }Optional
toolsToAdd?: string[]Optional list of tool names to add. If not specified, all tools are added.
Loads tools from a predefined JSON preset file
Name of the tool preset
Optional
args: { authenticator?: ToolAuthenticator }Optional
authenticator?: ToolAuthenticatorOptional authenticator to inject into the request
Clear the history of conversation messages.
Defines the LLM components to the runtime. This must be called before using any other method in the class. If already defined, this is a no-op.
The name of the LLM model to use in this instance
`Additional input used as an attribute in the define call of Runtime
Delete resources from the runtime. This should be called when the VectorStore is no longer needed. If already deleted, this is a no-op.
Get the current conversation history. Each item in the list represents a message from either the user or the assistant.
Prints agent's responses in a pretty format
agent's response yielded from query()
The user message to send to the model
Optional
options: { reasoning?: boolean }Optional
reasoning?: booleanIf True, enables reasoning capabilities (default: False)
Removes the MCP server and its tools from the agent, with terminating the MCP server process.
The unique name of the MCP server. If there's no MCP server matches the name, it throws Error.
The
Agent
class provides a high-level interface for interacting with large language models (LLMs) in Ailoy. It abstracts the underlying runtime and VM logic, allowing users to easily send queries and receive streaming responses. Agents can be extended with external tools or APIs to provide real-time or domain-specific knowledge, enabling more powerful and context-aware interactions.