Acts of Emergence

007: Agent/Variables

A special piece of text that looks like †<type>.<location>. It's a shortcut that tells a Tool Call where to find a piece of information the agent already knows, instead of making the agent write out the whole thing.

Variables are what make an agent’s information useful and interactive. Think of them as shortcuts that let an agent’s tools grab information from its memory (like a user's Input or the agent's current State) without having to copy-paste it.

Looking Up Information

When a tool needs information, instead of giving it the actual piece of data, we can give it a Variable Reference—a special shortcut that points to where the data is stored. This avoids making the AI do a lot of slow, clumsy, and error-prone copy-pasting of large amounts of information.

Using a shortcut is faster, cheaper, and safer. It's like giving someone a library card number instead of asking them to copy an entire book by hand. The library card is small, easy to share, and guarantees they get the exact right book without any typos.

The shortcut has a simple format that starts with a dagger symbol (). It looks like this: †<type>.<location>, where <type> is the kind of memory to look in (like state or input) and <location> is the specific address to find the data you want.

Tool instructions using variables

{
  "_tool": "greetUser",
  "userName": "†input.userName"
}

What this means in code

greetUser({
  userName: input.userName,
});

How Variables Connect Everything

  • Data: Variables are what bring the agent's data to life. Variable References read information from Data messages (like Input or State), and Output Paths write new information back. This creates a cycle where data is constantly being used and updated.

  • Input: You can use shortcuts to point to information from the user's initial Input. This lets you create reusable game plans, where the steps are always the same, but the specific details change depending on what the user provides.

  • State: The agent's State is like its short-term memory or a notepad. It's the main place where tools write their results, so that other tools later in the process can pick up where they left off and use that information.

  • Plan: A Plan is basically a flowchart of tool actions connected by variables. Each step uses a shortcut to grab the result from a previous step. This is how an agent can create a complete, ready-to-run workflow all at once.

From Quick Connections to Lasting Memory

Variables are great for connecting tools together in a single step. But for longer tasks that take multiple steps, the agent needs a more lasting memory—a "notepad" where results can be saved and looked up again and again.

The next document, 008: Agent/Output, explains how tools write their results down in the agent's memory.