nanoAgent  by sanbuphy

Minimalist AI agent for system interaction

Created 1 week ago

New!

347 stars

Top 80.4% on SourcePulse

GitHubView on GitHub
Project Summary

nanoAgent provides a minimalist framework for building AI agents capable of interacting with a user's system. Targeting developers familiar with Python, it simplifies agent creation by abstracting OpenAI's function calling capabilities, enabling agents to execute bash commands, read, and write files, thereby offering a practical entry point into agent development.

How It Works

The agent operates via a loop powered by OpenAI's function calling. It receives a user task, determines which predefined tools (bash, read_file, write_file) are necessary, executes them, and feeds the results back to the model. This iterative process continues until the task is completed. The core logic is contained within approximately 100 lines of Python code. Recent enhancements ensure the loop's stability by returning malformed tool calls or unknown tool references as explicit errors to the model, rather than causing crashes.

Quick Start & Requirements

  • Install: pip install -r requirements.txt
  • Prerequisites: Set OPENAI_API_KEY environment variable. OPENAI_BASE_URL and OPENAI_MODEL (defaults to gpt-4o-mini) are optional.
  • Examples:
    • python agent.py "list all python files in current directory"
    • python agent.py "create a file called hello.txt with 'Hello World'"
    • python agent.py "read the contents of README.md"

Highlighted Details

  • execute_bash: Enables execution of arbitrary bash commands.
  • read_file: Allows the agent to read the content of specified files.
  • write_file: Permits writing content to files.
  • Core functionality implemented in ~100 lines of Python.
  • Robust error handling for tool execution.

Maintenance & Community

No specific details regarding maintainers, community channels, or project health signals were found in the provided README.

Licensing & Compatibility

The project is licensed under the MIT License, which permits broad commercial use and modification.

Limitations & Caveats

This is a minimal implementation heavily reliant on the OpenAI API and its models. Functionality is strictly limited to the three core tools provided; complex operations or interactions beyond bash commands and file I/O are not supported. The agent's effectiveness is directly tied to the capabilities and cost of the chosen OpenAI model.

Health Check
Last Commit

20 hours ago

Responsiveness

Inactive

Pull Requests (30d)
4
Issues (30d)
0
Star History
351 stars in the last 10 days

Explore Similar Projects

Feedback? Help us improve.