func
Calls another function of the agent and returns that function's return value.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
namerequired | string | Name of the function to call. Must be a literal name, not an expression, and cannot be 'main'. | |
args | dynamic dict | Arguments passed to the function. |
Example
"functions": {
"lookupCustomer": {
"args": { "email": {} },
"commands": {
"db": {
"profile": "crm",
"sql": "select * from customers where email = :email",
"params": { "email": "{ email }" }
},
"return": "{ result[0] if result else None }"
}
},
"main": {
"commands": {
"func": {
"name": "lookupCustomer",
"args": { "email": "{ sys.userEmail }" }
},
"var": { "customer": "{ result }" }
}
}
}Rules
- The function name is a literal, not an expression. The function must exist in the agent, and it cannot be
main. - Arguments become local variables of the called function. An argument that the function declares but the call omits is set to
None. - The called function's
returnvalue is this command's result. A function that reaches the end of its commands without areturnreturnsNone. - A function cannot call itself, directly or through other functions, while the function is still running.
- The
llmcommand uses the same mechanism when a function is offered to the model as a tool.

