---
title: "How can an AI agent call my own API without me writing an integration?"
description: "Expose it as a remote MCP server, or connect it and let the agent write the calls in a sandbox. Both work in Kazi, with read-only control."
url: "https://kazi.apifunnel.ai/answers/let-an-ai-agent-call-your-own-api"
updated: "2026-11-14"
---

# How can an AI agent call my own API without me writing an integration?

Either put an MCP server in front of your API, or connect the API and let the agent write the calling code itself in a sandbox. Kazi does both: up to 25 of your own remote MCP servers, and Python in an isolated sandbox that can reach only the APIs you've connected. Either way you set the connection to Only read or Can update.

## Option 1: an MCP server

If you control the API, a thin MCP server in front of it gives every MCP-capable agent a typed set of tools. It's the cleanest option when the API is stable and you want the same tools in several agents.

Connect it to Kazi with its HTTPS URL and an API key or OAuth. It stays private to your account.

## Option 2: let the agent write the code

The agent reads what the API offers and writes a short Python script to call it, join results and handle paging. You don't write the glue. This is the better option for one-off or messy jobs, like pulling three months of orders and matching them against invoices.

Kazi runs that code in a sandbox with no open internet. It reaches the APIs you've connected and nothing else.

## Which one I'd pick

Start with code execution. You'll learn what the agent actually needs from your API. When a pattern repeats, wrap it in an MCP tool or save it as a playbook. I've argued the long version in [n8n vs code execution](https://kazi.apifunnel.ai/blog/n8n-vs-code-execution-the-end-is-near).

## Related questions

- [How do I connect my own MCP server to an AI assistant?](https://kazi.apifunnel.ai/answers/connect-your-own-mcp-server-to-an-ai-assistant)
- [Should I build automations in n8n or let an AI agent write the code?](https://kazi.apifunnel.ai/answers/n8n-or-an-ai-agent-for-workflow-automation)
- [How do you stop MCP tool definitions from filling an agent's context window?](https://kazi.apifunnel.ai/answers/stop-mcp-tool-definitions-filling-the-context-window)
