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.0.tar.gz (72.0 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.0-py3-none-any.whl (69.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nexus_fs_python-0.1.0.tar.gz
  • Upload date:
  • Size: 72.0 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.0.tar.gz
Algorithm Hash digest
SHA256 76ad6ca8e1385a9ef5b4ac24a6c87d636e82ca1784f82cf0e5ce36a5c4607b97
MD5 6fd660f252ee5a99be30d22ca0a3cd1b
BLAKE2b-256 47c1c8bb5becc12af47677a2a8cabac504505dadfe634b6fc84b515269db9294

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nexus_fs_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7809f244602a7df511d4f1c1813576dfc59e8cc4b3c191e29a82b86d2a4968f1
MD5 466dff5bd26a5bea65f13af8679c47e7
BLAKE2b-256 03e7ab1a3418bb99f8aa1fb54dbb0a1c6d508797be06e923a518157948450230

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