Observed since 20 Oct, 22:01 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
agentfs
Simple file management and serving for agents
Simple file management and serving for agents
pip install agentfs
start_server() function:from agentfs import start_server
start_server()
This will start the server at http://localhost:8000.
You can start the server with uvicorn like this:
import os
if __name__ == "__main__":
import uvicorn
uvicorn.run("agentfs:start_server", host="0.0.0.0", port=int(os.getenv("PORT", 8000)))
/file/{path} endpoint, where {path} is the path to the file relative to the server's current storage directory.from agentfs import get_file
# Fetches the content of the file located at "./files/test.txt"
file_content = get_file("test.txt")
print(file_content)
/file/ endpoint, with JSON data containing the path and content parameters.from agentfs import add_file
# Creates a file named "test.txt" in the current storage directory
# and writes "Hello, world!" to it.
add_file("test.txt", "Hello, world!")
AgentFS provides the following public functions:
start_server(storage_path=None)Starts the FastAPI server. If a storage_path is provided, it sets the storage directory to the given path.
Arguments:
storage_path (str, optional): The path to the storage directory.Returns:
Example:
from agentfs import start_server
start_server("/my/storage/directory")
get_server()Returns the FastAPI application instance.
Arguments:
Returns:
Example:
from agentfs import get_server
app = get_server()
set_storage_path(new_path)Sets the storage directory to the provided path.
Arguments:
new_path (str): The path to the new storage directory.Returns:
True if the path was successfully set, False otherwise.Example:
from agentfs import set_storage_path
set_storage_path("/my/storage/directory")
add_file(path, content)Creates a file at the specified path and writes the provided content to it.
Arguments:
path (str): The path to the new file.content (str): The content to be written to the file.Returns:
True if the file was successfully created.Example:
from agentfs import add_file
add_file("test.txt", "Hello, world!")
remove_file(path)Removes the file at the specified path.
Arguments:
path (str): The path to the file to be removed.Returns:
True if the file was successfully removed.Example:
from agentfs import remove_file
remove_file("test.txt")
update_file(path, content)Appends the provided content to the file at the specified path.
Arguments:
path (str): The path to the file to be updated.content (str): The content to be appended to the file.Returns:
True if the file was successfully updated.Example:
from agentfs import update_file
update_file("test.txt", "New content")
list_files(path='.')Lists all files in the specified directory.
Arguments:
path (str, optional): The path to the directory. Defaults to '.' (current directory).Returns:
Example:
from agentfs import list_files
files = list_files()
get_file(path)Returns the content of the file at the specified path.
Arguments:
path (str): The path to the file.Returns:
Example:
from agentfs import get_file
content = get_file("test.txt")
If you like this library and want to contribute in any way, please feel free to submit a PR and I will review it. Please note that the goal here is simplicity and accesibility, using common language and few dependencies.
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
chromadbEnvironment{
"extras": "",
"marker": null,
"requires_python": "",
"evaluation": "NOT_EVALUATED"
} | chromadb | runtime |
richEnvironment{
"extras": "",
"marker": null,
"requires_python": "",
"evaluation": "NOT_EVALUATED"
} | rich | runtime |
bdist_wheel · 5.1 KB · Python py3
sdist · 4.67 KB · Python source
Shared repository data · GitHub
Observed since 20 Oct, 22:01 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:1e9250d522d3a55a605a3a09bdfd4fcd08df1451085e644f9bb31fd16f3308fb