Creates a new HerokuAgent instance.
Optional
fields: HerokuAgentFieldsOptional configuration options for the Heroku Mia Agent
// Basic usage with defaults
const agent = new HerokuAgent();
// With custom configuration
const agent = new HerokuAgent({
model: "gpt-oss-120b",
temperature: 0.3,
maxTokensPerRequest: 2000,
tools: [
{
type: "heroku_tool",
name: "dyno_run_command",
runtime_params: {
target_app_name: "my-app",
tool_params: {
cmd: "date",
description: "Gets the current date and time on the server.",
parameters: { type: "object", properties: {} },
},
},
}
}
],
apiKey: "your-api-key",
apiUrl: "https://us.inference.heroku.com"
});
Protected
Optional
maxProtected
Optional
toolsProtected
Optional
streamPrivate
toolPrivate
_Protected
modelProtected
Optional
temperatureProtected
Optional
stopProtected
Optional
topProtected
Optional
apiProtected
Optional
apiProtected
Optional
maxProtected
Optional
timeoutProtected
Optional
streamingProtected
Optional
additionalStatic
lc_Returns the LangChain identifier for this agent class.
The string "HerokuAgent"
Returns the LLM type identifier for this agent.
The string "HerokuAgent"
Internal
Get the parameters used to invoke the agent.
This method combines constructor parameters with runtime options to create the final request parameters for the Heroku Agent API. Runtime options take precedence over constructor parameters.
Optional
options: Partial<HerokuAgentCallOptions>Optional runtime parameters that override constructor defaults
Combined parameters for the agent API request
Optional
runManager: CallbackManagerForLLMRunOptional
runManager: CallbackManagerForLLMRunCreate a version of this agent that returns structured output by instructing the model to produce JSON matching the schema (jsonMode-style).
Optional
maybeOptions: {Get the locally bound no-op LangChain tools mirroring server tools.
Protected
enqueuePush a server-provided tool result into the local queue for a tool name
Protected
consumeConsume the oldest queued server tool result for a tool name
Protected
cleanProtected
buildStandard headers for Heroku API calls
Protected
postPOST JSON with retries, timeout, and consistent error wrapping.
HerokuAgent - Heroku Managed Inference Agent Integration
A LangChain-compatible chat model that interfaces with Heroku's Managed Inference Agent API. This class provides access to intelligent agents that can execute tools and perform complex multi-step reasoning tasks. Agents have access to Heroku-specific tools like app management, database operations, and can integrate with external services via MCP (Model Context Protocol).
Unlike the basic ChatHeroku model, agents are designed for autonomous task execution with built-in tool calling capabilities and advanced reasoning patterns.
Example
Example
Example
See