Embedded
Last updated Apr 21, 2026
Cloudflare has a unique embedded function calling ↗︎ feature that allows you to execute function code alongside your tool call inference. Our npm package @cloudflare/ai-utils ↗︎ is the developer toolkit to get started.
Embedded function calling can be used to easily make complex agents that interact with websites and APIs, like using natural language to create meetings on Google Calendar, saving data to Notion, automatically routing requests to other APIs, saving data to an R2 bucket - or all of this at the same time. All you need is a prompt and an OpenAPI spec to get started.
REST API support
Embedded function calling depends on features native to the Workers platform. This means that embedded function calling is only supported via Cloudflare Workers, not via the REST API.
Resources
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/workers-ai/features/function-calling/embedded/#page","headline":"Embedded","description":"Execute function code alongside inference calls using Workers AI embedded function calling.","url":"https://developers.cloudflare.com/workers-ai/features/function-calling/embedded/","inLanguage":"en","image":"https://developers.cloudflare.com/workers-ai/features/function-calling/embedded/og.png?v=8834403aa34ffd28","dateModified":"2026-04-21","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Reference for the runWithTools and autoTrimTools methods in embedded function calling. title: API Reference image: https://developers.cloudflare.com/workers-ai/features/function-calling/embedded/api-reference/og.png?v=b717d7f8d4ddf28e
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/workers-ai/llms.txt
Use this file to discover all available pages before exploring further.
Docs