by run-llama
Run Claude Code/Codex within AgentFS, orchestrated by LlamaIndex Workflows
# Add to your Claude Code skills
git clone https://github.com/run-llama/agentfs-claudeA demo where we run Claude Code or Codex within a fully-virtualized file system (AgentFS), orchestrating it with LlamaIndex Workflows and adding the possibility of reading unstructured files (e.g. PDFs or Word/Google docs) with LlamaCloud.
Clone this repository:
git clone https://github.com/run-llama/agentfs-claude
cd agentfs-claude
Install all necessary dependencies:
pnpm install
# you can use other package managers, but pnpm is preferred
If you wish to use the demo with Codex, you need to install the Codex SDK separately (given the size of the library - 140+ MB - its download it disabled by default):
pnpm add @openai/codex-sdk
Moreover, if you wish to run the demo with Codex, you also need to start the MCP server (from a different terminal window, but within the same directory):
pnpm run mcp-start
The MCP will be live on http://localhost:3000/mcp, and you will need to add the MCP configuration in config.toml to the global Codex configuration in $HOME/.codex/config.toml. If you want Codex to use the filesystem MCP by default, you will also need to copy the AGENTS.md file, containing the instructions on how to use the server.
Now run the demo with:
# for the first time
pnpm run start
# If you want to add more files to the database
pnpm run clean-start
No comments yet. Be the first to share your thoughts!
And follow the prompts in the terminal
All the filesystem-bound operations are performed on the AgentFS (and not on the real files), thanks to the filesystem MCP that exposes the following tools:
read_file: read a file, providing its pathwrite_file: write a file, providing its path and contentedit_file: edit a file, providing the old string and the new string to replace the old one withlist_files: list all the available filesfile_exists: check whether or not a file exists, providing its pathWhat happens under the hood when the agent is running:
filesystem MCPPreToolUse hook would deny the tool call and redirect the agent to using the filesystem MCP toolsThe integration with LlamaIndex Workflows offers the perfect harnessed environment:
Run the agent in this directory, and prompt it with:
Explore all the available files to you, find the task file, read it and act in accordance with it. If needed, read other files (such as the document on observability in LlamaIndex Workflows).
In this sense, the agent should first list all the files, then read data/task.docx and follow the task in it, also reading data/observability_in_llamaindex_workflows.pdf since the task asks for instrumentation of a LlamaIndex Workflows.
If you wish to contribute, make sure that your code follows the formatting and linting guidelines, running:
pnpm run check
And that all the tests still pass (add new ones if needed):
# here node v22+ is needed
pnpm run test
Once your code is compliant with formatting and linting and all tests are passing, you can create a pull request from a non-default branch of your fork (e.g. feat/awesome-feature, fix/great-fix).
This project is distributed under an MIT License.