

Over the past 8 years, the ASCN.AI team has tested 43 different approaches to automation. We have honestly documented the results in our internal engineering report. The main technical conclusion is clear: Tool Calling (often referred to as " Function Calling" in documentation) is not just a "bridge" between model reasoning and action. It is a strict control transfer protocol.
Without this mechanism, you are simply building a chatbot locked into static training data. With it? You create a system that can call external APIs, process transactions, and essentially earn money autonomously.
The difference is subtle, but it changes everything.
Tool Calling allows LLM agents to use external tools (APIs, databases, code) to solve tasks beyond their training scope. This article covers architecture, code examples, JSON error handling, security (Human-in-the-loop), and quality metrics. We compare the developer path (Python/OpenAI SDK) with a ready-made solution (ASCN.AI).
So, what exactly is ai agent tool calling? Simply put, it is a mechanism that allows a language model to call external tools and APIs for actions outside its dataset. Language models without access to tools are stuck in stasis; they cannot actually do anything in the external world [OpenAI Developer Docs, 2024].
Tool Calling solves this problem through structured communication (usually JSON) between the model and external systems. When you ask about the weather, the agent does not guess the answer. It calls weather API via the mechanism of AI agents with tool calling. This turns a passive model into an active ASCN Agent capable of using external tools to solve practical tasks.
It all revolves around a JSON schema where you describe available tools and their parameters. The LLM analyses the user’s request and decides which tool to invoke. The call happens automatically on the model side, but physical execution requires your code. It is, essentially, a handshake.
"Tool Calling turns a passive language model into an active agent capable of acting in the real world."
— Founder of ASCN.AI
In the ASCN.AI project, we implemented llm agent tool calling to automate customer communication via Telegram and Gmail. Challenge: Managers spent 4 hours a day on routine replies. Solution: Configured API access to the CRM and calendar. Result (Q4 2025 data): 73% of requests are now handled autonomously, and the median response time has dropped from 2 hours to 47 seconds [Read more in the ASCN.AI case study].
This is not just efficiency. It is a completely different business model.
Agent systems follow a cycle: perception, planning, action, observation to achieve goals [Agent Benchmarks, ArXiv, 2024]. This process is supported by a six-stage interaction cycle, starting with intent analysis.
agent tools api with validated parameters. The system sends the request to the external service.Each step requires precise configuration. In our practice, incorrect parameter validation at the planning stage (due to vague descriptions) increased API errors by 34% [ASCN.AI internal metric, 2024]. Implementing pre-call schema validation reduced failed requests to just 2%.
It sounds simple on paper. In production? This is usually where things break.
Implementing Tool Calling via API requires defining the tool schema in JSON format and passing it to the LLM when initialising the chat. The API handles the function call automatically, returning the result for further use.
from openai import OpenAI
client = OpenAI(api_key="your-api-key")
tools = [
{
"type": "function",
"function": {
"name": "get_crypto_price",
"description": "Get current cryptocurrency price from exchange",
"parameters": {
"type": "object",
"properties": {
"symbol": {"type": "string", "description": "Cryptocurrency symbol (e.g., BTC)"},
"exchange": {"type": "string", "description": "Exchange name (binance, coinbase)"}
},
"required": ["symbol"]
}
}
}
]
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "What is BTC price on Binance?"}],
tools=tools,
tool_choice="auto"
)
# Process tool calls if present
if response.choices[0].message.tool_calls:
tool_call = response.choices[0].message.tool_calls[0]
# Your code executes logic here and returns result to model
The code above defines a function get_crypto_price with parameters. The LLM analyses the request and decides to call this function with specific arguments. Important point: the model does not execute code. It only suggests the call. Your backend must intercept this call, execute it, and return the result.
Developer path (code above) vs ASCN.AI user path: Writing this code manually is not necessary. On the ASCN.AI platform, this process is abstracted. We use a similar architecture under the hood for 100+ ready-made workflows.
Real-world example: a client needed automated monitoring of arbitrage opportunities between exchanges. We configured parallel polling of 5 exchange APIs via an agent. Result: the system finds arbitrage in 3–4 seconds, enabling clients to earn 5-40% on price differences during periods of high volatility [See the Falcon Finance case study].
Speed matters. Especially when money is at stake.
Real-time API access eliminates model hallucinations by providing verified information from external systems. This allows complex processes to be automated without constant human involvement.
Tool Use scenarios:
In 2023–24, the crypto arbitrage niche saw 40+ competitors emerge (Crypto Automation Market Data 2024). Many promised automation but failed to deliver stable infrastructure. We invested in reliable server-side implementation and proper ai agent external tool use. The result: when the market dipped, competitors shut down while we secured leading positions.
Stability is a real competitive advantage.
The ecosystem includes OpenAI Functions, LangChain Agents, LlamaIndex Tools, and AutoGen. The choice depends on flexibility requirements and the level of abstraction.
| Framework/Platform | Complexity | Flexibility (Custom Tools) | Target Audience |
|---|---|---|---|
| OpenAI Functions API | Low | Medium | Developers, Quick Start |
| LangChain Agents | Medium | High | Advanced Development |
| AutoGen | High | Very high | Multi-agent systems |
| ASCN.AI | No-Code | High (via configs) | Business, Automation |
In our ASCN.AI platform, we support connections to Gmail, Google Calendar, Telegram, Notion, Supabase and other tools via API. AI sales assistant can operate within your infrastructure without manual data transfer. We offer a no-code environment, where you can deploy an agent for lead processing and CRM in hours.
Why build from scratch if you don't have to?
State management ensures context preservation between calls in long dialogues. The agent stores results of previous tool calls in memory for use in subsequent steps. Without proper state management, the agent "forgets" the context. We use a vector database to store interaction history with metadata. This allows referencing previous results when forming new requests.
In multi-agent systems, state is synchronised via a shared memory layer. Each agent accesses its portion of data based on its role, which prevents conflicts and ensures data consistency across the system.
Asynchronous API calls reduce latency by 70–80% compared to sequential execution [IEEE Cloud Computing Report, 2024]. This technique is critical for time-sensitive tasks such as arbitrage monitoring or trading.
Sequential execution increases latency proportionally to the number of tools. Parallel execution allows running 5–10 API calls simultaneously, reducing total time from 15 seconds to 3–4. We use asyncio in Python to implement concurrent calls without blocking the main thread.
Dependency rule: If Tool B depends on the output of Tool A, they run sequentially. If not, they run in parallel. Rate limiting requires careful management during parallel calls. We use request queues to comply with limits.
APIs may return errors, timeouts, or blocks. Simply repeating a request without delay worsens problems during provider outages. We use exponential backoff with jitter (random delay). Formula: delay = base_delay * (2 ^ attempt) + random_jitter. This distributes the load.
The circuit breaker pattern reduces cascading failures by 65% in distributed systems [ACM Computing Surveys, 2023]. After N consecutive failures, the agent stops calling the tool for a “cool-down” period. This protects the system from resource exhaustion.
Important: An empty array [] on error is poor practice. The model does not understand what happened. Use structured errors:
{
"error": "rate_limited",
"retry_after": 30,
"tool": "get_crypto_price",
"message": "Exchange API limit exceeded"
}
The model sees the field retry_after and knows: wait 30 seconds, do not retry immediately. This significantly improves agent stability.
Apply the principle of least privilege. Each tool receives only the minimum necessary permissions. Using keys at the admin level for all calls creates a catastrophic risk in case of a breach. We create separate service accounts with limited permissions (scoped permissions and role-based access control). Regular key rotation (e.g., every 30 days) reduces the vulnerability window.
Protection against injections via tool parameters. The agent must validate all input data before calling external APIs. We use parameterized queries and allowlist validation. User input should never be concatenated directly with system commands. JSON schema validation ensures that parameters match the expected types.
Systems with human oversight reduce critical errors by 89% in financial operations Journal of AI Safety, 2024. Full autonomy is unacceptable for all actions. We classify operations by risk level: low risk — automatic, high risk — requires confirmation (Human Approval). Notifications are sent to Telegram/Email. If there is no response within N hours, the action is escalated to a backup approver.
End-to-end accuracy hides problems at the tool level. An agent may solve a task, but do so inefficiently or with risks. Track 4 key metrics:
Collecting metrics requires step-level tracing: logs of each tool call, arguments, results, and the next reasoning step. Without tracing, debugging in production is impossible.
Adding tools predictably reduces selection accuracy. A model choosing from 5 tools is significantly more accurate than one scanning 50. Large catalogs consume context tokens.
Scaling solutions:
calendar_*, crm_*, email_*). This turns flat search into a two-stage process: "which category, then which tool".Tool definitions must evolve based on evaluation signals:
Iteration cycle:
Tool Calling is a broader concept that includes APIs, databases, and web search. Function Calling refers specifically to executing code functions. In this article, we use the terms interchangeably, but technically Tool Calling is broader.
No. Tools must be predefined by the developer. The agent cannot dynamically create new API endpoints, but it can combine existing tools into new workflows through orchestration logic.
Security depends on implementation. Strict access control, call logging, and auditing are required. Proper configuration (Isolated Credentials) ensures enterprise-grade security levels.
Tool Calling connects LLM outputs with action execution via external APIs. With it, you build a system that autonomously interacts with the outside world.
Launch checklist:
At ASCN.AI, we offer 100+ ready-made templates for a quick start. You can deploy an agent in hours, not months, and immediately start automating routine tasks, without a development team.
Ready to stop talking and start doing?