Skip to content

andy2mrqz/todoagent

Repository files navigation

To-Do Agent Demo (CLI)

Overview

A small implementation of a TodoAgent with Tools.

This project is designed to run alongside a separate To-Do web app. As you first interact with the To-Dos on the web app, then interact with the TodoAgent, you'll start to feel the similarities, differences, advantages, and disadvantages of each interface.

Why a To-Do app? It's a common "hello world" for CRUD apps, so seemed like a good introduction to AI Agents and Tools.

Features

  • Zero dependencies other than the Anthropic SDK (and node types)
  • Fully-functional agent loop in <100 lines of code.
  • TodoAgent with tools implemented in <150 lines of code.
  • Capable of all CRUD interactions exposed by the To-Do web app

Inspiration

Inspired by Thorsten Ball's blog post for Amp, titled "How to Build an Agent". Largely adapted from Go to Typescript and modified to target a Todo-App.

Quickstart

  • Set up the separate web app somewhere else (for example, /tmp)

    git clone https://github.com/chee86j/nextjstodo.git /tmp/nextjstodo
    # Verified working as of commit: 5afda28
    cd /tmp/nextjstodo
    # follow that project's README to get set up
  • Finish setting up this project

    echo 'ANTHROPIC_API_KEY="sk_ant..."' > .env
    pnpm install
    pnpm dev

Screenshots

Working chat interactions

Reflected in the app (note the date shows a Thursday due to UTC interactions I didn't want to iron out.)

Troubleshooting

  • I'm getting this error TypeError: fetch failed, what's wrong?

Final Note

All code was written by hand with no "Agent" or "Tab" completions enabled, to get the full effect described by Thorsten in his article:

I urge you to follow along. No, really. You might think you can just read this and that you don’t have to type out the code, but it’s less than 400 lines of code. I need you to feel how little code it is and I want you to see this with your own eyes in your own terminal in your own folders.

About

A small implementation of an AI/LLM TodoAgent with Tools.

Topics

Resources

Stars

Watchers

Forks