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.3.tar.gz (73.6 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.3-py3-none-any.whl (70.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nexus_fs_python-0.1.3.tar.gz
  • Upload date:
  • Size: 73.6 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.3.tar.gz
Algorithm Hash digest
SHA256 1ecab1354241ac0c187e87e1aab52cff339573f3d7d75b43ed83aeb68e2dfea5
MD5 8b33889fc57080d17ed731d65f29babb
BLAKE2b-256 13de5eef229f69da8d3f05e62e2c9363751cca4c5ad885141403b5ab66aaf13b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nexus_fs_python-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e6a5a84c497a4755142bdcae3d5d5d690c5796eb96508b93e98301fdfbe51cfa
MD5 4130bb056145cd54f90d59775a860a0f
BLAKE2b-256 3c3ed5cd14f788da07f9cbf0ceb1d3f6d227c7a2640c9044260079c6430c5427

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