| foundry_agent | R Documentation |
foundry_agent() sends a prompt to the Responses API with user-defined R
tools, executes any returned function calls locally, sends matching
function_call_output items back to the service, and repeats until the model
returns a final answer or max_iterations is reached.
foundry_agent(
input,
tools,
model = NULL,
instructions = NULL,
max_iterations = 8L,
store = TRUE,
reasoning_effort = NULL,
max_output_tokens = NULL,
temperature = NULL,
top_p = NULL,
api_key = NULL,
endpoint = NULL,
...
)
input |
Character scalar or list. Initial user input for the response. |
tools |
A |
model |
Character. The model deployment name. Defaults to the
|
instructions |
Character. Optional system/developer instructions. |
max_iterations |
Integer. Maximum number of model responses in the loop. |
store |
Logical. Whether Responses API objects should be stored.
Defaults to |
reasoning_effort |
Character. Optional reasoning effort for reasoning models. |
max_output_tokens, temperature, top_p |
Optional generation controls passed
to |
api_key |
Character. Optional API key override. |
endpoint |
Character. Optional endpoint override. |
... |
Additional request body parameters passed to |
A tibble with one row per model response. It includes the standard
foundry_response() columns plus iteration, final, and tool_results
list-columns for executed R tools.
Responses API function calling: https://learn.microsoft.com/azure/foundry/openai/how-to/responses#function-calling
## Not run:
# Requires a configured Azure endpoint, credentials, and AZURE_FOUNDRY_MODEL
# naming a deployment that supports Responses API function calling.
get_weather <- function(location) {
list(location = location, temperature = "70 F")
}
weather_tool <- foundry_tool(
get_weather,
description = "Get weather for a location",
parameters = list(
type = "object",
properties = list(location = list(type = "string")),
required = "location"
)
)
foundry_agent(
"What is the weather in San Francisco?",
tools = list(weather_tool)
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.