BLOG POST 7

A Simple Demo

Here's a demo of making a project, creating a little graph, and running it in AInstance.

A Simple Demo cover

Welcome to Demo One, which will provide a digestible example of how AInstance can be used from the command line today.

Getting started

To get started, you'll see me ask the shell for the version of AInstance being used and then run the doctor command. "AInstance doctor" is a quick way to see whether AInstance is ready to be used. For example, you'll see that Docker is running. Docker is a program that AInstance uses to keep agents contained in their folder, so they can't run wild all over your computer. You'll also see in the doctor report that my Anthropic API key is set. An API key needs to be set before any working session, and I set this one before I started recording. I also run "ainstance library list," which provides the user with a readable list of their library tools. Most of the tools you see in this list are built-in AInstance tools that a user will have upon downloading the product, but it's meant for you to create your own tools. Today, we'll be creating our own graph.

Before making a graph, it's a good idea to plan it out "on paper" (in other words, in FigJam). Having a GUI will make it easier to plan out a graph without needing to use an external tool like FigJam, but right not we are just working with a CLI. Here's the graph we're making today:

The graph we're going to make

This graph is a simple poem-writing graph in which the human will converse with a planner agent about what the poem should look like, then the planner agent will make instructions for a builder agent, then a builder agent will write the poem, then the human can ask for revisions or approve the poem. This is not an endorsement of AI-written poetry, but it is a great way to think through how a graph like this can be leveraged for something more complex and technical.

Let's start a new AInstance project and create the graph.

Creating the graph

I'm adding each step one at a time. There are three types of steps: chat steps, agent steps, and checkpoint steps. You can add special routes that map certain steps backwards, creating loops based on conditions. After the graph is created, you'll notice that when I try to run the graph from within the project, it fails. That is because the graph I created is automatically part of my AInstance library, but not yet added to the project. When I add the graph to the mydemo project, all of the other AInstance tools that are used in the graph (skills and agents) are added to the project as well.

Finally, the graph is ready to be run!

Running the graph

There it is! Steps follow one another seamlessly and we were able to successfully place the human at an important place in the process to make an edit to the poem being produced. One special thing worth highlighting here is the early hint of cost optimization. Cost estimates appear after each step and after the entire graph run. In the future, I'd like to implement ways to compare the cost of entire graphs against other graphs. I've talked with my mentor Cody Catalena about providing users with warnings in places that could be racking up extra costs, such as where a backward loop in a graph is overused. I'll continue to brainstorm as I work on AInstance's GUI!

notes

Big thanks to ASCII Magic for your tool, which I used for my cover photo.

Text and image content in this blog will overlap with content in my Capstone slideshows and other documentation.

I'm pretty sure you can tell, but this blog is written by me.

← all posts