Metadata-Version: 2.4
Name: netweb-sdk
Version: 0.1.3
Summary: Netweb Enterprise Agent Engineering Framework
Author: Netweb AI Team
Keywords: agent,llm,ai,workflow,tooling,enterprise
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: anthropic==0.100.0
Requires-Dist: ddgs==9.14.2
Requires-Dist: decorator==5.2.1
Requires-Dist: google-genai==1.75.0
Requires-Dist: langchain==1.2.17
Requires-Dist: langchain-anthropic==1.4.3
Requires-Dist: langchain-classic==1.0.7
Requires-Dist: langchain-community==0.4.1
Requires-Dist: langchain-core==1.3.3
Requires-Dist: langchain-google-genai==4.2.2
Requires-Dist: langchain-openai==1.2.1
Requires-Dist: langchain-protocol==0.0.15
Requires-Dist: langchain-text-splitters==1.1.2
Requires-Dist: langgraph==1.1.10
Requires-Dist: langgraph-checkpoint==4.1.0
Requires-Dist: langgraph-checkpoint-postgres==3.1.0
Requires-Dist: langgraph-checkpoint-redis==0.4.1
Requires-Dist: langgraph-prebuilt==1.0.13
Requires-Dist: langgraph-sdk==0.3.14
Requires-Dist: langsmith==0.8.3
Requires-Dist: openai==2.36.0
Requires-Dist: psycopg==3.3.4
Requires-Dist: psycopg-pool==3.3.1
Requires-Dist: pydantic==2.13.4
Requires-Dist: pydantic-settings==2.14.0
Requires-Dist: pydantic_core==2.46.4
Requires-Dist: pytest==9.0.3
Requires-Dist: pytest-asyncio==1.3.0
Requires-Dist: python-dotenv==1.2.2

# Netweb SDK

Netweb SDK is an enterprise-grade agent engineering framework for building, orchestrating, and deploying AI assistants with custom tools and multiple LLM providers.

Key capabilities:

- Custom tool integration with the `@nw_tool` decorator
- Composable agents via `create_agent`
- Deterministic, structured tool invocation (JSON/structured calls)
- Multiple built-in provider adapters (OpenAI, Anthropic, Google, open-source)
- Pluggable memory stores (`ConversationMemory`, `VectorMemory`, `PersistentMemory`)
- Tracing integration (LangSmith-compatible) via `enable_tracing`

## Why use Netweb SDK

Netweb SDK is intended for production AI applications that require:

- Reliable tool invocation from generated outputs
- Reusable agent components and configurable system prompts
- Provider-agnostic integrations for deploying across clouds and local runtimes

## Installation

Install from PyPI:

```bash
pip install netweb-sdk
```

Or install from source:

```bash
pip install .
```

## Quick Start

The SDK exports common helpers from `sdk` (see `sdk/__init__.py`): `create_agent`, `get_tool`, `get_tools`, `list_tools`, `nw_tool`, provider classes, memory helpers, and tracing utilities.

1) Define a custom tool with `@nw_tool`:

```python
from sdk import nw_tool

@nw_tool("add", description="Add two integers together")
def add(a: int, b: int) -> int:
    return a + b
```

2) Create an agent. Note: current `create_agent` signature accepts `name`, `role`, `llm`, `tools`, `memory` (bool or instance), `input_schema`, `output_schema`, `prompt_path`, `system_prompt`, `retries`, and `retry_delay`.

```python
from sdk import create_agent, OpenAIProvider

llm = OpenAIProvider(model="gpt-4o-mini")

agent = create_agent(
    name="calculator_agent",
    role="calculator",
    llm=llm,
    tools=[add],
    system_prompt="You are a precise calculator. Use the add tool for addition operations.",
    memory=True,
)
```

3) Run the agent (sync or streamed):

```python
resp = await agent.nw_run("Add 5 and 3 together")
print(resp.output)

# Streamed
async for chunk in agent.nw_run_streamed("Tell me a short joke"):
    print(chunk, end="", flush=True)
```

## Providers

The SDK includes adapters for multiple LLM providers. Examples exported from `sdk`:

- `OpenAIProvider`
- `AnthropicProvider`
- `GoogleProvider`
- `OpenSourceProvider` (HuggingFace, Ollama, local runtimes)

Provider classes wrap the API surface for sync/async generation and streaming and are pluggable when creating agents.

## Memory

Memory implementations available in the SDK:

- `ConversationMemory`: in-memory conversation history
- `VectorMemory`: vector-store backed memory for retrieval-augmented generation
- `PersistentMemory`: durable stores (e.g., redis/postgres checkpointers supported in runtime)

Pass `memory=True` to `create_agent` to enable default conversation memory (a `ConversationMemory` instance).

## Tools API

Tool utilities exported from `sdk`:

- `nw_tool`: decorator for registering tools
- `get_tools(names: list[str])`: fetch tool instances by name
- `get_tool(name: str)`: fetch a single tool
- `list_tools()`: list available tool metadata

Tools are executed by the agent via `ToolRunner` and are registered in the `ToolRegistry` on agent creation.


## Tracing

Enable LangSmith-compatible tracing using:

```python
from sdk.tracing import enable_tracing
enable_tracing(project_name="my_project")
```

Tracing hooks into execution to capture runs, tool calls, and metadata.

## Prompts and Templates

Prompts are managed via `abstractions.agents.prompts` with utilities for loading prompt files, templating, and prompt composition. You can pass `prompt_path` to `create_agent` to use a custom prompt file, or provide `system_prompt` directly.
