Function Logs
Query tool invocation logs to debug, monitor, and audit function calls made by agents during calls.
Overview
Every time an agent invokes a function tool during a live call, the platform records a FunctionCallLog entry. These logs capture the full input/output cycle — what the agent sent, what the tool returned, how long execution took, and any errors encountered.
Function logs are read-only and append-only. They are the primary surface for:
- Debugging — trace every tool call within a single call session.
- Monitoring — detect failed or slow tool executions across your fleet.
- Auditing — produce compliance-ready records of agent actions over a time range.
Hooks
useGetFunctionLogs
Fetches a paginated list of function call logs.
import { useGetFunctionLogs } from "@scalereal/sr-voice-engine-react-sdk/hooks";
function FunctionLogList({ callSessionId }: { callSessionId: string }) {
const { data, isLoading } = useGetFunctionLogs({
call_session_id: callSessionId,
page: 1,
size: 50,
sort_by: "-created_at",
});
if (isLoading) return <p>Loading logs…</p>;
return (
<ul>
{data?.results.map((log) => (
<li key={log.id}>
[{log.status}] {log.function_name} — {log.execution_time_ms ?? "—"}ms
</li>
))}
</ul>
);
}Parameters
| Parameter | Type | Description |
|---|---|---|
page | number | Page index (1-based). |
size | number | Results per page. |
call_session_id | string | Filter logs to a single call session. |
agent_id | string | Filter logs by agent. |
function_name | string | Filter by tool name. |
function_type | string | Filter by tool type (e.g. "custom_function", "book_appointment"). |
status | string | Filter by execution status (e.g. "success", "error"). |
start_date | string | Inclusive start date — format yyyy-MM-dd. |
end_date | string | Inclusive end date — format yyyy-MM-dd. |
sort_by | string | Sort field. Supports "created_at" and "-created_at" (newest-first). |
Returns UseQueryResult<PaginatedResponse<FunctionCallLog>>.
Types
FunctionCallLog
interface FunctionCallLog {
/** Unique log entry ID. */
id: string;
/** The call session this log belongs to. */
call_session_id: string;
/** Workspace the call occurred in. */
workspace_id: string;
/** Agent that invoked the tool. Null if the agent was deleted. */
agent_id: string | null;
/** Name of the tool that was invoked. */
function_name: string;
/** Category of the tool. */
function_type: string;
/** Execution outcome — e.g. "success" or "error". */
status: string;
/** Arguments the agent passed to the tool. */
input_params: Record<string, unknown> | null;
/** Value returned by the tool to the agent. */
output_result: Record<string, unknown> | null;
/** Wall-clock time the tool took to execute, in milliseconds. */
execution_time_ms: number | null;
/** Human-readable error message, if the call failed. */
error_message: string | null;
/** Provider-level request/response data for deep debugging. */
execution_details: Record<string, unknown> | null;
/** ISO 8601 timestamp when the log was created. */
created_at: string;
}Common query patterns
Debug a single call session
Filter by call_session_id to see every tool invocation that occurred during one call, in chronological order.
const { data } = useGetFunctionLogs({
call_session_id: "cs_abc123",
sort_by: "created_at",
size: 100,
});This is the most effective starting point when a caller reports unexpected agent behavior.
Monitor failed tool calls
Filter by status to build a failure dashboard or alert on error spikes.
const { data } = useGetFunctionLogs({
status: "error",
sort_by: "-created_at",
size: 50,
});Pair with function_name to narrow down which tool is failing most frequently.
Audit agent activity over a date range
Combine agent_id with start_date / end_date for compliance reporting.
const { data } = useGetFunctionLogs({
agent_id: "agent_xyz",
start_date: "2024-01-01",
end_date: "2024-01-31",
sort_by: "-created_at",
size: 200,
});Understanding log fields
input_params
Contains the arguments the agent supplied when invoking the tool — exactly what was sent to your HTTP endpoint (for custom_function) or to the platform executor (for built-in types). Use this to verify the agent extracted the right information from the conversation.
output_result
The value the tool returned to the agent. For custom_function tools this mirrors your API's response body. For built-in tools (calendar, transfer, etc.) this is the platform-normalized result.
execution_details
execution_details contains the raw provider-level request and response data — useful for tracing issues with third-party APIs (e.g. a calendar provider returning an unexpected status code). This field is only populated for integrations that emit provider metadata; it may be null for simple built-in tools.
error_message
A human-readable description of what went wrong. Present this in your debugging UI alongside status === "error" to give engineers a quick summary without parsing execution_details.
execution_time_ms
Wall-clock duration in milliseconds. Use this to identify slow tools that may be degrading conversation quality. Tools that take more than a few seconds can cause noticeable pauses in the agent's response.
Cache keys
import { functionLogKeys } from "@scalereal/sr-voice-engine-react-sdk/hooks";
// Invalidate all function log queries
queryClient.invalidateQueries({ queryKey: functionLogKeys.all });
// Invalidate logs for a specific filter set
queryClient.invalidateQueries({
queryKey: functionLogKeys.list({ call_session_id: "cs_abc123" }),
});Related pages
- Function Tools — create and manage the tools agents can call
- Call History — view call sessions and recording details
- Agents — configure which tools are available to each agent