This document provides a reference for the Nexus Python Client SDK APIs.
content = nx.read(path: str, return_metadata: bool = False) -> bytes | dict- Used by:
read_filetool - Returns: File content as bytes, or dict with metadata if
return_metadata=True
result = nx.write(path: str, content: bytes, if_match: str | None = None) -> dict- Used by:
write_filetool - Returns: Dict with
etag,version,modified_at,size
nx.delete(path: str) -> None- Used by: File management operations
exists = nx.exists(path: str) -> bool- Used by:
write_filetool (verification)
files = nx.list(path: str = "/", recursive: bool = True, details: bool = False) -> list[str] | list[dict]- Used by: Directory browsing operations
matches = nx.glob(pattern: str, path: str = "/") -> list[str]- Used by:
glob_filestool - Example:
nx.glob("*.py", "/workspace")→["/workspace/file1.py", "/workspace/file2.py"]
results = nx.grep(
pattern: str,
path: str = "/",
file_pattern: str | None = None,
ignore_case: bool = False,
max_results: int = 1000
) -> list[dict]- Used by:
grep_filestool - Returns: List of dicts with
file,line,content,match - Example:
nx.grep("async def", path="/workspace", file_pattern="*.py")
sandbox = nx.sandbox_create(provider: str = "docker", config: dict | None = None) -> dict- Returns: Dict with
sandbox_id,status, etc.
result = nx.sandbox_run(
sandbox_id: str,
language: str, # "python" or "bash"
code: str,
timeout: int = 300
) -> dict- Used by:
pythonandbashtools - Returns: Dict with
stdout,stderr,exit_code,execution_time
nx.sandbox_pause(sandbox_id: str) -> dict
nx.sandbox_resume(sandbox_id: str) -> dict
nx.sandbox_stop(sandbox_id: str) -> dict
nx.sandbox_status(sandbox_id: str) -> dict
nx.sandbox_list() -> list[dict]memory_id = nx.memory.store(
content: str,
namespace: str | None = None,
importance: float | None = None
) -> str- Stores agent memory/context
memories = nx.memory.query(
query: str,
namespace: str | None = None,
limit: int = 10
) -> list[dict]- Used by:
query_memoriestool - Returns: List of memory dicts with
content,namespace,importance, etc.
memories = nx.memory.list(
scope: str | None = None,
state: str = "active",
limit: int = 50
) -> list[dict]- Used by:
query_memoriestool (when no query provided)
memory = nx.memory.retrieve(
namespace: str | None = None,
path_key: str | None = None
) -> dict | Nonesuccess = nx.memory.delete(memory_id: str) -> boolskills = nx.skills_list(tier: str | None = None, include_metadata: bool = True) -> dict- Used by:
list_skills()function - Returns: Dict with
skills(list) andcount - Tiers:
"all","agent","user","tenant","system"
skill = nx.skills_info(skill_name: str) -> dictresults = nx.skills_search(query: str) -> list[dict]result = nx._call_rpc(method: str, params: dict | None = None) -> Any- Internal method for making RPC calls
- Handles retries, error handling, authentication
- All public methods use this internally
nx = RemoteNexusFS(
server_url: str, # e.g., "http://localhost:8080"
api_key: str, # e.g., "sk-xxx"
timeout: int = 90,
max_retries: int = 3
)# Extracts from config.metadata:
# - x_auth: "Bearer sk-xxx" → api_key
# - nexus_server_url: "http://localhost:8080" → server_url
nx = _get_nexus_client(config: RunnableConfig, state: dict | None = None) -> RemoteNexusFStools = get_nexus_tools() -> list[BaseTool]-
grep_files(pattern, path="/", file_pattern=None, ignore_case=False, max_results=1000)
- Calls:
nx.grep() - Returns: Formatted grep-style output
- Calls:
-
glob_files(pattern, path="/")
- Calls:
nx.glob() - Returns: Formatted file list
- Calls:
-
read_file(read_cmd: str)
- Parses:
"cat path","less path","cat path start end" - Calls:
nx.read() - Returns: Formatted file content
- Parses:
-
write_file(path: str, content: str)
- Calls:
nx.write() - Verifies:
nx.exists() - Returns: Success message
- Calls:
-
python(code: str)
- Requires:
sandbox_idinconfig.metadata - Calls:
nx.sandbox_run(sandbox_id, language="python", code=code) - Returns: Formatted stdout/stderr
- Requires:
-
bash(command: str)
- Requires:
sandbox_idinconfig.metadata - Calls:
nx.sandbox_run(sandbox_id, language="bash", code=command) - Returns: Formatted stdout/stderr
- Requires:
-
query_memories()
- Calls:
nx.memory.query(state="active", limit=100) - Returns: Formatted memory list
- Calls:
NexusError (base)
├── NexusFileNotFoundError
├── InvalidPathError
├── NexusPermissionError
├── ValidationError
├── ConflictError
└── RemoteFilesystemError
├── RemoteConnectionError
└── RemoteTimeoutError
from nexus_client import RemoteNexusFS
from nexus_client.langgraph import get_nexus_tools
# Direct usage
nx = RemoteNexusFS("http://localhost:8080", api_key="sk-xxx")
content = nx.read("/workspace/file.txt")
nx.write("/workspace/output.txt", b"Hello, World!")
files = nx.glob("*.py", "/workspace")
# LangGraph usage
tools = get_nexus_tools()
agent = create_react_agent(model=llm, tools=tools)
result = agent.invoke(
{"messages": [{"role": "user", "content": "Find Python files"}]},
config={"metadata": {"x_auth": "Bearer sk-xxx", "nexus_server_url": "http://localhost:8080"}}
)Must Have (Core Functionality):
- ✅ read, write, delete, exists
- ✅ list, glob, grep
- ✅ memory.store, memory.query, memory.list
- ✅ sandbox_run (for python/bash tools)
Should Have (Full Feature Set): 5. ✅ skills_list, skills_info 6. ✅ sandbox_create, sandbox_status, sandbox_list 7. ✅ stat, read_range, write_batch
Nice to Have (Advanced Features):
8.