Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Tool Calling

Tool execution is the core functionality of Agent Actions that allows you to perform actions on third-party applications using connected accounts. Tools abstract complex API operations into simple, consistent function calls.

Tool execution in Agent Actions enables you to:

  • Perform actions on third-party applications via connected accounts
  • Execute operations like sending emails, creating calendar events, or fetching data on-behalf-of users
  • Handle authentication automatically using connected account tokens
  1. Identify the tool you want to execute (e.g., send_email, create_event)
  2. Select connected account that has the required permissions
  3. Prepare parameters needed for the tool execution
  4. Execute the tool using the Agent Actions API
  5. Handle the response and any errors that occur

Using Scalekit SDK, you can execute any action on behalf of a user using the following parameters:

  • user context
  • tool_name
  • tool_input_parameters
# Fetch recent emails
tool_response = agent_connect.tools.execute(
# connected_account gives the user context
connected_account_id=connected_account.id,
# tool name to execute
tool='gmail_fetch_mails',
# tool input parameters
parameters={
'query': 'is:unread',
'max_results': 5
}
)
print(f'Recent emails: {tool_response.result}')

To execute the tool calls effectively, you first need to understand the required parameters for any given tool. You can inspect the tool schema by fetching the tool metadata information using the scalekit sdk.

tool_schema = agent_connect.tools.get_schema(tool='gmail_fetch_emails')
# tool_schema has description, input schema and output schema