5 Empowering agents with actions
This chapter explains how agents move beyond static prompts to act in the world through well-defined actions. It clarifies the terminology across frameworks—treating actions as anything an agent can do via functions, skills, or tools—and positions plugins as the proxy that bundles these abilities. Building on OpenAI’s function-calling specification as a common interface, the chapter introduces Microsoft’s Semantic Kernel (SK) as a flexible orchestrator that can both publish and consume plugins, culminating in hosting an agent system that coordinates multiple actions reliably.
The chapter first demonstrates OpenAI function calling: providing tool schemas alongside prompts so the model selects a function and returns its name and arguments (not execution), after which the application runs the function and feeds results back to the model for a natural-language reply. It shows single and parallel tool calls, highlights that simpler models can handle tool delegation, and emphasizes clean separation between choosing and executing tools. With SK, the text then shows how to install/connect services, create semantic functions (prompt-based capabilities), add context variables, and register them as plugins/skills. This establishes a consistent pattern for composing agent abilities with clearer structure and less boilerplate than hand-rolled function-calling loops.
Next, the chapter blends semantic and native functions: crafting a semantic recommender plugin, augmenting it with a native function (e.g., loading a user’s seen-movie list), and even embedding native calls inside semantic prompts. It then builds a GPT Interface around a movie database by wrapping REST endpoints as native SK plugin methods, tests them directly, and integrates the plugins into an interactive chat that automatically selects tools. A key best practice emerges: “think semantically” by returning rich, structured outputs (such as JSON) so the LLM can filter, sort, and transform results on its own. Altogether, the chapter provides a pragmatic blueprint for exposing, registering, and orchestrating actions with SK to create interactive service agents—setting up the transition to memory in the next chapter.
How a ChatGPT plugin operates and how plugins and other external tools like APIs align with the prompt engineering strategy Use External Tools
How an agent uses actions to perform external tasks
How a single LLM request, including tools, gets interpreted by an LLM
How a sample request returns 3 tool function calls and then submits the results back to the LLM to return a natural language response
How the Semantic Kernel integrates as a plugin and can also consume plugins
The process of creating a new skill/plugin
The file-and-folder structure of a semantic function skill/plugin
This layer architecture diagram shows the role of a GPT interface and the Semantic Kernel being exposed to chat or agent interfaces.
The folder-and-file structure of the tmdb plugin
Summary
- Agent actions extend the capabilities of an agent system, such as ChatGPT. This includes the ability to add plugins to ChatGPT and LLMs to function as proxies for actions.
- OpenAI supports function definitions and plugins within an OpenAI API session. This includes adding function definitions to LLM API calls and understanding how these functions allow the LLM to perform additional actions.
- The Semantic Kernel (SK) is an open-source project from Microsoft that can be used to build AI applications and agent systems. Which includes the role of semantic plugins in defining native and semantic functions.
- Semantic functions encapsulate the prompt/profile template used to engage an LLM.
- Native functions encapsulate code that performs or executes an action using an API or other interface.
- Semantic functions can be combined with other semantic or native functions and layered within one another as execution stages.
- SK can be used to create a GPT Interface over top of API calls in a semantic service layer and expose them as chat or agent interface plugins.
- Semantic services represent the interaction between LLMs and plugins, and the practical implementation of these concepts in creating efficient AI agents.