AI Function-Calling Agent: Build a Tool-Using Bot on Telegram
Cactus just open-sourced Needle — a 26M parameter model that performs function calling at 6000 tokens/s on consumer devices. It proves something crucial: tool use is not a reasoning problem. It's a retrieval-and-assembly problem. And you don't need GPT-5 to do it.
When Cactus released Needle this week — a tiny, attention-only model that does tool calling on a phone at 1200 tok/s decode — the Hacker News community went deep. 443 points, 150 comments, and a recurring theme: "We've been overcomplicating function calling."
Needle's insight is elegant: tool calling isn't reasoning. Matching a user query to a tool name, extracting argument values, and emitting JSON is a retrieval-and-assembly task. Cross-attention handles that better than bloated FFN layers. The result is a 26M-parameter model that does what a 70B model was doing — for a fraction of the cost, latency, and hardware requirements.
This is the direction the AI agent space is moving: small, fast, tool-oriented models that call external functions rather than hallucinate answers. Instead of asking your LLM to "reason" about weather data, you define a get_weather(location) function and let the model's function-calling layer handle the routing. The model focuses on what it's good at (parsing intent, extracting arguments) and punts computation to real systems.
Why Function-Calling Agents Matter Now
The Needle release accelerates three trends that were already reshaping AI agents:
1. Tool use is the new prompt engineering.
Instead of writing elaborate instructions that ask the model to "think step by step" and then manually format output, you define tools. The model calls search_web(query) instead of pretending it knows the answer. It calls fetch_page(url) instead of fabricating statistics. Your prompt becomes a routing layer, not a wishlist.
2. Latency drops from seconds to milliseconds.
A 26M-parameter model runs locally. No API round trips. No queue time. No per-token pricing. Function-calling agents that used to cost $0.02 per invocation now run effectively free on consumer hardware.
3. Privacy becomes the default.
When the model runs on-device, your queries never leave your machine. For sensitive use cases — contract analysis, medical research, internal data queries — this eliminates the single biggest adoption blocker.
You don't need to train a 26M parameter model to benefit from this pattern. The same tool-use architecture works at any model scale. The prompt below turns your Telegram bot into a function-calling agent that knows how to search, fetch, compute, and act — without requiring custom model training.
The Prompt: Your AI Function-Calling Agent
This prompt turns any OpenClaw-powered Telegram bot into a tool-use agent. It defines a set of "functions" the model can call, and the agent orchestrates them to complete your real-world tasks.
How to use:
- Deploy OpenClaw on GetClawCloud — one click, no server setup
- Paste this prompt as your first message to the Telegram bot
- Send a task — the agent determines which functions to call in what order
💡 The agent uses web search and page fetching tools. Make sure your OpenClaw deployment has web access enabled.
Real-World Examples
Here's what happens when you send different types of requests to this agent:
📊 "Compare the latest GPU pricing between AWS, GCP, and Azure"
The agent calls search_web() three times — one for each cloud provider's GPU pricing page — then fetch_page() for each top result. It extracts pricing per GPU-hour, calls calculate() to normalize across providers, and delivers a formatted comparison.
🔍 "Find the top 3 open-source tools for AI function calling, tell me their GitHub stars and last commit date"
The agent searches, fetches each GitHub repo page, extracts star counts and activity, then presents ranked results with direct links.
📈 "What's the market cap of NVIDIA and AMD right now, and what's the ratio?"
The agent searches for current market caps, fetches data, calls calculate("market_cap_nvidia / market_cap_amd"), and formats a clean comparison briefing.
Scheduling: Turn One Query Into a Recurring Watch
The real power of a function-calling agent is not one-off queries — it's ongoing monitoring. After the agent completes a task, tell it you want the same check daily.
Set up with OpenClaw cron:
# Daily AI function call: monitor competitor pricing
openclaw cron add --every 24h --text "Run the function-calling agent. Search and compare latest pricing for GPT-5 vs Claude 4 vs Gemini 3. Fetch current pricing pages. Calculate cost per million tokens. Deliver a briefing."
The agent runs the same tool chain — search, fetch, calculate, format — on a schedule. You get daily price intelligence delivered to Telegram without touching a browser.
Why This Works Better Than a Raw LLM Prompt
A traditional "ask the LLM" approach has a fundamental flaw: the model has to either know the answer from training data (which may be outdated) or fabricate one (hallucination). A function-calling agent never guesses — it always calls a tool.
| Approach | Data Freshness | Hallucination Risk | Repeatability | Tool Extensibility |
|---|---|---|---|---|
| Raw LLM prompt | Training cut-off | High | Varies by prompt | None |
| Function-calling agent | Real-time | Low (always fetches) | Deterministic tool chain | Add any tool via prompt |
| RAG pipeline | Index freshness | Medium (retrieval quality) | Depends on index | Requires engineering |
The function-calling agent sits in a sweet spot: it's as fresh as RAG, as simple as a prompt, and as reliable as deterministic tool execution.
Scaling: From One Agent to a Fleet
Once you have the function-calling pattern working for one task, you can spin up multiple agents — each with different tool sets and schedules:
- Pricing monitor agent — daily SaaS/cloud pricing comparison, alerts on changes
- Competitor intelligence agent — weekly product launch tracking with GitHub release monitoring
- Market research agent — monthly trend reports using multi-source web analysis
- Security bulletin agent — hourly CVE checks from CERT/NVD feeds
- Lead qualification agent — daily company discovery with fit scoring and decision-maker ID
Each agent shares the same function-calling architecture. Only the tool selection and scheduling differ. The prompt stays the same — you just tell each agent what to watch and how often to run.
Getting Started
- Deploy OpenClaw on GetClawCloud — one click, zero server configuration
- Paste the prompt above into your Telegram bot
- Send your first task — "What's trending on Hacker News today?" or "Compare cloud GPU pricing"
- Schedule recurring checks with cron for hands-free monitoring
Your Telegram bot becomes a function-calling engine — no model training, no API integration, no custom deployment pipeline. The prompt defines the tools; OpenClaw powers the execution.
Deploy Your AI Function-Calling Agent
One click on GetClawCloud, paste the prompt, and your Telegram bot becomes a tool-using AI agent. Real data, no hallucinations, scheduled delivery.
Start on GetClawCloud →