Skip to content

KitsuneKode/ai-agent

Repository files navigation

AI Agent with Tools, Memory, and Movie Search

A Bun-powered CLI agent that combines Gemini, local conversation memory, tool calling, movie retrieval, and an evaluation dashboard.

What It Does

  • Answers normal text prompts with Gemini through Google's OpenAI-compatible API
  • Uses tools for movies, Reddit, weather, location lookup, dad jokes, and image generation
  • Stores conversation state in db.json so later runs can continue the same thread
  • Supports human approval before image generation
  • Includes evals and a React dashboard for browsing experiment results

Project Layout

src/
  ai/
    agent.ts        Agent loop and approval flow
    ai.ts           Gemini client configuration
    llm.ts          Chat and structured output helpers
    memory.ts       Persistent conversation history in db.json
    tools/          Tool definitions and implementations
  evals/            Evaluation runner and experiments
  rag/              Movie ingest and retrieval code
dashboard/          Vite app for visualizing eval results

Requirements

  • Bun
  • A GEMINI_API_KEY
  • Optional API keys for tools you want to use

Environment Variables

Copy .env.example to .env and fill in the keys you need.

GEMINI_API_KEY=
ANTHROPIC_API_KEY=
HF_ACCESS_TOKEN=
OPENAI_API_KEY=
GEO_CODE_API_KEY=
UPSTASH_VECTOR_REST_URL=
UPSTASH_VECTOR_REST_TOKEN=

Notes:

  • GEMINI_API_KEY is required for the main agent.
  • Weather, location, Reddit, RAG, and image-related flows may need additional keys depending on which tools you use.
  • The app now fails early with a clear error if GEMINI_API_KEY is missing.

Install

bun install

Run the Agent

The CLI takes the user message as the first argument:

bun start "recommend me a sci-fi movie"

Examples:

bun start "hi"
bun start "find me a good Christopher Nolan movie"
bun start "generate an image of a neon city at sunset"

Behavior notes:

  • Simple greetings like hi should be answered directly without unnecessary tool calls.
  • The image tool should only run when the user explicitly asks for an image.
  • Image generation requires approval before execution.
  • Conversation history is persisted in db.json, so repeated runs continue prior context unless you clear that file.

Common Commands

bun start "your prompt"
bun eval allTools
bun eval dadJoke
bun eval reddit
bun eval weather
bun eval location
bun eval generateImage
bun ingest

Dashboard

The dashboard is a separate Vite app for exploring eval output.

cd dashboard
npm install
npm run dev

See dashboard/README.md for dashboard-specific notes.

Notes on Memory and State

  • db.json stores the running conversation history and summaries.
  • results.json stores eval output used by the dashboard.
  • Generated images are saved under images/.

If the agent seems to answer with stale context, inspect or clear db.json before rerunning.

About

A sophisticated AI Agent that combines multiple tools such as reddit search, image generation, movie search capabilities, and evaluation frameworks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors