Skip to main content

Tasks to control agentic API calls

Alex Blom

One of the cool things about Aisle Tasks is the integration calls are normal Python API calls. You do not need to worry about agents using the wrong tool, logging confidential information, or burning tokens along the way.

What's covered

  • How Aisle integration calls work as standard Python function calls instead of agent tool invocations
  • Why this matters for confidentiality: credentials and data stay in the execution environment, not in an LLM context window
  • The token and latency cost difference between routing a call through an agent versus calling an API directly

When an agent picks a tool, it sends the tool name, the arguments, and often the surrounding context through the model. That is a token cost, a latency cost, and a surface for the model to choose the wrong tool or leak data into the prompt. A Python function call skips all of that. The call happens, the result comes back, and the agent never sees the credentials or the raw response unless the script hands it over.

Open Aisle →

Video transcript

Hi everybody, Alex from Aisle here. Today I wanted to take you through a quick demo of how we use tasks, specifically the code-driven deterministic tasks that we create, to control and manage API calls that we don't necessarily want an LLM to be involved in. This is something that we run into all the time. We're starting to build integrations, maybe we want to go through and process Gmail, but we don't necessarily want to give an agent access to that connector or it could go off the rails and do things that we don't expect or use tools that we don't want it to. We want it to be a more deterministic process.

We have a little bit of control over that situation. And also we may just not even want to be burning a whole bunch of tokens passing all of these back and forth to an LLM and potentially having those logged somewhere else. So, one of the things we like to use tasks for is they're great at using code, Python, to orchestrate the flow, to go through and make the direct API calls to validate we have the information we want, and only pass the information that we care about into the LLM. So, at that point the prompts that we write are not aware of the surrounding context, the tasks that they're executing inside of, and they don't have direct access to any any APIs or MCP connectors for Gmail or, for example, uh to do a quick demo, maybe I'll focus on GitHub here. So, I have a demo here and we've assigned a GitHub credential to the task already.

So, as a really basic example, what I could do is let's just say one day, and what we're going to do is we'll do uh result equal Aisle.integrations .github.list_commits, for example. And we can do owner equals Isle of Code. Let's do uh repo equals our API, for example, and the branch, let's just go to an SEO branch cuz there won't be too much there. And what we might do, you know, typically as we're running an agent, is once I have this, I might come in and make a quick prompt that is, you know, summarize demo commit, for example, and I might say you are receiving it would be nice if I could type while I'm doing a video. You are receiving a GitHub commit.

Please summarize for me. And obviously we'd usually be doing more for this. One of the things I use a tool like this for is to know when there are changes to certain parts of the application where we need to cascade and update to documentation or something like that. So what I'm going to do is go through and define that variable inside of the prompt. Now I can come back to my task.

And I might write uh let's do the you know response from the AI prompt, for example, would be Aisle .ai.run_prompt. And the slug for that is that summarize demo commit that we did there. And the commit is going to be the result. I'm not going to bother with going through this pagination, for example. And what I'm trying to demonstrate to you here is this is a really easy way to start passing piece of information into an LLM when we want it to process but to basically control the orchestration in code, right?

Code is the run time. These are just normal API calls. These are not hitting an LLM. We're not passing our information. We're not burning a whole lot of tokens along the way.

And we can start to securely process through whatever API calls we'd like to make and just use the LLM where we need it. So one of those understated things about moving your orchestration to an Aisle task where it's written in Python, you can take advantage of this very, very quickly. And just to restate from a security perspective, from a token burn perspective, and even just determinism over your task, you're going to find this is far better before you even consider that usually these API calls are significantly faster than an LLM call. We don't need an agent orchestrating a basic task like this. We don't want it making decisions over what to call.

Typically, we know what we want to call and we need the LLM to action data to help us make decisions further downstream. So very fast demo. Hopefully this was helpful. We'll talk to you all soon.

Stay in the loop

Product updates, tutorials, and AI insights. No spam.