Skip to main content

Lightweight Python 3.11+ client SDK for Nexus filesystem, designed for LangGraph deployments

Project description

Nexus Python Client SDK

Lightweight Python 3.11+ client SDK for Nexus filesystem, designed for LangGraph deployments

Python 3.11+ License

Overview

A standalone Python client SDK for Nexus that enables LangGraph agents to interact with Nexus servers. This package is designed for Python 3.11+ compatibility, making it suitable for LangGraph Platform deployments (which support Python 3.11 and 3.12).

Key Features:

  • ✅ Python 3.11+ compatible (works with LangGraph Platform)
  • ✅ Lightweight - Minimal dependencies, fast installation
  • ✅ Complete API - All APIs needed by LangGraph agents
  • ✅ LangGraph Ready - Pre-built tool adaptors included
  • ✅ 100% API compatible with nexus-ai-fs remote client

Installation

# Core package
pip install nexus-fs-python

# With LangGraph support
pip install nexus-fs-python[langgraph]

Quick Start

Direct Client Usage

from nexus_client import RemoteNexusFS

# Initialize client
nx = RemoteNexusFS("http://localhost:8080", api_key="sk-your-api-key")

# File operations
content = nx.read("/workspace/file.txt")
nx.write("/workspace/output.txt", b"Hello, World!")
files = nx.list("/workspace")

# File discovery
python_files = nx.glob("*.py", "/workspace")
results = nx.grep("def ", path="/workspace", file_pattern="*.py")

# Cleanup
nx.close()

LangGraph Integration

from nexus_client.langgraph import get_nexus_tools
from langgraph.prebuilt import create_react_agent
from langchain_anthropic import ChatAnthropic

# Get Nexus tools
tools = get_nexus_tools()

# Create agent
llm = ChatAnthropic(model="claude-sonnet-4-5-20250929")
agent = create_react_agent(model=llm, tools=tools)

# Use agent
result = agent.invoke(
    {"messages": [{"role": "user", "content": "Find all Python files"}]},
    config={
        "metadata": {
            "x_auth": "Bearer sk-your-api-key",
            "nexus_server_url": "http://localhost:8080"
        }
    }
)

Async Usage

import asyncio
from nexus_client import AsyncRemoteNexusFS

async def main():
    async with AsyncRemoteNexusFS("http://localhost:8080", api_key="sk-xxx") as nx:
        # Parallel operations
        paths = ["/file1.txt", "/file2.txt", "/file3.txt"]
        contents = await asyncio.gather(*[nx.read(p) for p in paths])

asyncio.run(main())

LangGraph Tools

The SDK provides 7 ready-to-use LangGraph tools:

  1. grep_files - Search file content with regex patterns
  2. glob_files - Find files by glob pattern
  3. read_file - Read file content (supports cat/less style commands)
  4. write_file - Write content to filesystem
  5. python - Execute Python code in Nexus-managed sandbox
  6. bash - Execute bash commands in sandbox
  7. query_memories - Query and retrieve stored memory records

Core APIs

File Operations

  • read(), write(), delete(), exists(), stat()
  • list(), glob(), grep()
  • mkdir(), rename()

Sandbox Operations

  • sandbox_create(), sandbox_run(), sandbox_status()
  • sandbox_pause(), sandbox_resume(), sandbox_stop()

Memory Operations

  • memory.store(), memory.query(), memory.list()
  • memory.retrieve(), memory.delete()
  • memory.start_trajectory(), memory.log_step(), memory.complete_trajectory()

Skills Operations

  • skills_list(), skills_info(), skills_search()

Dependencies

Core (Required)

  • httpx>=0.27.0 - HTTP client
  • tenacity>=8.0.0 - Retry logic
  • pydantic>=2.0.0 - Data validation

Optional: LangGraph

pip install nexus-client[langgraph]
  • langchain-core>=0.3.0
  • langgraph>=0.2.0

API Compatibility

This package maintains 100% API compatibility with nexus-ai-fs remote client. Migration is simple:

# Before (nexus-ai-fs)
from nexus.remote import RemoteNexusFS
from nexus.tools.langgraph import get_nexus_tools

# After (nexus-client)
from nexus_client import RemoteNexusFS
from nexus_client.langgraph import get_nexus_tools

No code changes needed beyond imports!

Documentation

Requirements

  • Python 3.11, 3.12, or 3.13
  • Nexus server (remote or local)

License

Apache 2.0 - see LICENSE for details.

Contributing

Contributions welcome! Please see the main Nexus repository for contribution guidelines.

Related

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nexus_fs_python-0.1.4.tar.gz (73.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nexus_fs_python-0.1.4-py3-none-any.whl (70.9 kB view details)

Uploaded Python 3

File details

Details for the file nexus_fs_python-0.1.4.tar.gz.

File metadata

  • Download URL: nexus_fs_python-0.1.4.tar.gz
  • Upload date:
  • Size: 73.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nexus_fs_python-0.1.4.tar.gz
Algorithm Hash digest
SHA256 0975691d8b941cd0457baf10e97d577717e980d0622357b5cd3ca1797d05b9b1
MD5 4bbfd4cd0a640fad8e7dd6272f6f1453
BLAKE2b-256 7597a3664f5c674fd3b63252bc05d8a882eeb51bd7295e296503a590b9b9f6b6

See more details on using hashes here.

File details

Details for the file nexus_fs_python-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for nexus_fs_python-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 670bec76a8c0cb784e6714138f3cebcdb315e6d0c3831e2f4d826b9062bdbad8
MD5 10ba793d69c91e106a6097c82e0c0d1c
BLAKE2b-256 1aafcdd3f7d92aaed7132a544bc0bccb4e7f96c5cb6a2fc04bcfe5e10f746353

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page