Skip to main content

Claude/ChatGPT Prompt to Build a Gemini Function-Calling Workflow Bot

Use Gemini function calling to build a workflow automator that picks tools, executes, loops on results, with safety and step limits.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt makes the AI a senior AI agent engineer that specifies a Gemini function-calling workflow automator tightly enough to build, returning working code rather than pseudocode. You provide the [model], the [tools] the agent can call, and the [max_steps] limit, and it returns the agent loop code plus an example session transcript showing tool calls and the final result.

The six deliverables pin down the agent loop, which is where these systems fail: tool definitions (name, JSON schema, description) for your [tools], ready for function calling; the control loop where the user states a goal, the model picks a tool and arguments, your code executes, results feed back, and it repeats; argument validation against each tool schema before any execution; safety checks including a confirmation gate for destructive actions and a hard step limit set to [max_steps]; structured logging of each step for replay and debugging; and a termination condition so the loop stops cleanly when the goal is met or the limit is hit. The structure works because the failure mode is always the loop - a model that picks the wrong tool or never decides it is done.

When to use it

  • You are building an agent that selects and calls tools to accomplish a multi-step goal.
  • You need argument validation against tool schemas before anything executes.
  • Some tools are destructive and need a confirmation gate before they run.
  • You want a hard step limit so the loop cannot run away.
  • You need structured per-step logging to replay and debug agent runs.

Example output

You get the agent loop code: tool definitions with JSON schemas for your [tools], the control loop that lets the [model] pick a tool and arguments, validation before execution, a confirmation gate for destructive actions, a hard [max_steps] cap, structured step logging, and a clean termination condition - plus an example session transcript showing the tool calls made and the final result.

Pro tips

  • Put a confirmation gate on anything destructive; an unbounded agent with a send_email or delete tool is a support ticket waiting to happen.
  • Pin the control loop, validation, and [max_steps] before adding more [tools] - the loop is the hard part, the tools are easy.
  • Write tight JSON schemas for each tool so argument validation actually rejects bad calls before execution.
  • Set [max_steps] low enough to bound cost and runaway behaviour but high enough to finish a real goal.
  • Keep structured logging on every step; when the agent misbehaves, the replay log is how you find which tool choice went wrong.
  • Make the termination condition explicit, or the model may loop without ever deciding the goal is met.

Frequently Asked Questions

What stops the agent from looping forever?
Two mechanisms - a hard step limit set to `[max_steps]` and an explicit termination condition that stops the loop when the goal is met. Together they bound both runaway cost and a model that never decides it is finished.
How does it prevent dangerous tool calls?
The safety deliverable adds a confirmation gate before destructive actions execute, so a tool like send_email or a delete operation requires approval rather than firing automatically. Argument validation against each tool schema also rejects malformed calls before they run.
Why validate arguments against a schema before executing?
Models sometimes produce arguments that are malformed or out of range, and executing those can corrupt data or fail unpredictably. Validating against each tool's JSON schema first rejects bad calls cleanly before any side effect happens.
What is the structured logging for?
Each step records the tool chosen, its arguments, and the result, so you can replay and debug a run after the fact. When an agent picks the wrong tool or stalls, that log is how you trace exactly where the loop went wrong.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Gemini AI Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support