A lightweight coding agent that uses function-calling to safely interact with files and run Python scripts inside a workspace.
This repository implements a small CLI agent that:
- Accepts a natural-language prompt.
- Lets an LLM decide whether to call a predefined function.
- Executes only supported local functions (for file listing, file reading/writing, and Python execution).
- Returns the function result back to the model to generate a final answer.
It is designed as a practical learning project for controlled tool use with an AI assistant.
main.py: CLI entry point and orchestration loop.call_function.py: Routes model-requested function calls to Python implementations.config.py: Centralized configuration.functions/:get_files_info.py: List files and metadata.get_file_content.py: Read file contents.write_file.py: Write/create files.run_python.py: Run Python files safely in workspace context.
calculator/: Example target project used by the agent.test_run_python_file.py: Tests for Python execution behavior.README.md: Project documentation (this file).
- You run the CLI with a prompt, for example:
- “run tests.py”
- “what files are in the root?”
- “create a new README.md file with the contents '# calculator'”
- The model may produce a function call.
call_function.pyvalidates and executes the call against local functions.- The result is fed back into the conversation for a final response.
- Python 3.11+ (recommended)
uvinstalled- Required environment variables/API access for your selected LLM provider (if applicable in your local setup)
# from repo root
uv sync