No project description provided
Project description
Cascade Knowledge Node SDK
A Python package and CLI proxy to register LLM agents with the Cascade network. The SDK and proxy enable API driven tooling, distributed tracing, and data access control for Langchain type agents.
Architecture
The Cascade Knowledge Node SDK defines a composition class around the Langchain AgentExecutor, or similar interface. The primary purpose of the composer is to register the agent with the Cascade network and enable API driven prompting and tooling. Upon registry, the node subscribes to a Nats pub/sub network to receive and respond to prompt and tooling requests from peer agents. The composer subscribes to:
tools.<agent_name>
- to receive tooling updates
knowledge.<agent-name>
- to receive prompts
This enables other Cascade agents to prompt and mutate tools of the registered agent via the Nats message broker.
When adding a remote agent as a new tool via a tooling event, the composer creates a Langchain Tool
from the event payload. When called, the tool issues a Nats request/reply to the remote agent defined in the event.
Note that agents can be run on and deployed to any environment which has network connectivity to the Nats message broker. This enables Cascade nodes deployed on-prem, in the cloud, or on a local machine, to transact and be traced.
Agent Environment Variables
If your agent requires user-specific environment variables to be set, such as an API token, simply prefix the variale key with CASCADE_ENV_
. These variables will then be requested via the Cascade Hub UI on a per-user basis.
Agent Package Quick Start
Install the package
-
Clone the repository.
git clone https://github3.cisco.com/cilantro/cascade-knowledge-node-sdk.git
-
Install the package locally.
python3.11 -m pip install -e ./cascade-knowledge-node-sdk
Or via the remote package manager server:
pip install --index-url http://10.85.153.74:3141/root/cascade_node_sdk --extra-index-url https://pypi.org/simple cascade_node_sdk==<VERSION}> --trusted-host 10.85.153.74 --no-cache-dir
Usage
Below is an example of how to use the AgentWrapper
class to create a Cascade node.
from cascade_node_sdk.agent import AgentWrapper
from os import environ
# create your agentExecutor object here
agent_executor = ...
cascade_node = AgentWrapper(
controller_host=environ["CONTROLLER_HOST"],
name="my_agent_name",
description="my agent description",
access_level="PRIVATE",
category="Natural Language",
)
cascade_node.run_agent(
agentExecutor=agent_executor,
)
CLI Proxy Quick Start
The CLI proxy can be run via poetry or installed via pipx as a standalone CLI tool.
pipx install git+https://github3.cisco.com/cilantro/cascade-knowledge-node-sdk.git
In the following example we will configure privateGPT as a Cascade RAG node using the CLI proxy. Follow the installation instructions to install privateGPT locally.
Once installed, we can register the node with the Cascade CLI proxy:
poetry run cascade proxy --help
Or via pipx:
cascade proxy --help
Configure the proxy with the following command:
cascade proxy \
-n privateGPT \
-d "privateGPT RAG node, query XYZ documents" \
-c "Natural Language" \
-a "PRIVATE" \
-u "http://localhost:8001/v1/completions"
The node will subsequently be available for use in the Cascade Knowledge Tree Network.
Controller host: localhost
Registering node: privateGPT
Node description: privateGPT RAG node, query XYZ documents
Node access level: PRIVATE
Proxy to URL: http://localhost:8001/v1/completions
INFO:root:Connected to NATS server at localhost:4222
INFO:root:subscribed to topics: [ tools.privateGPT, tool-calling-method.privateGPT, knowledge.privateGPT, set-env.privateGPT ]
Containerization
See the repository cascade-knowledge-nodes for examples of creating a containerized Cascade nodes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cascade_node_sdk-0.1.0.tar.gz
.
File metadata
- Download URL: cascade_node_sdk-0.1.0.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.1 Darwin/23.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 797488caa92589fcce2eb51d54ff44b671af9edf638d5352354fe6de14e9a80a |
|
MD5 | c5ea1da2218e9d68f277485a37d40316 |
|
BLAKE2b-256 | 64caf571ac93a3a5d3d3a90f1bc1aa6914065f64521d1b2e26eec0bd22c75167 |
File details
Details for the file cascade_node_sdk-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: cascade_node_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.1 Darwin/23.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8726db852ff7d97686881167bc47735c99ff566e0ea26cf4b02d598e793e2cc |
|
MD5 | 9e1569a6f2b66de11b9134cac0ca6e13 |
|
BLAKE2b-256 | 93aed848768cdb6eb5d02a07f444625987ccaeab63ca321c7261ea0518d61866 |