Skip to main content

Octogen Python SDK built on langgraph

Project description

Octogen Python SDK for LangGraph

PyPI version Python Version

A Python SDK for building LLM-powered shop agents using LangGraph and LangChain, designed to work with the Octogen platform.

Features

  • Build conversational shop agents with LangGraph's state management
  • Structured output parsing with Pydantic models
  • Built-in recommendation expansion functionality
  • Server deployment capabilities with FastAPI
  • Integration with Octogen MCP tools for product discovery
  • Streamlined agent creation through factory patterns

Installation

pip install octogen-sdk-langgraph

Requirements

  • Python ≥ 3.12
  • Dependencies:
    • langchain ≥ 0.3.25
    • langgraph ≥ 0.4.3
    • pydantic ≥ 2.11.4
    • octogen-api ≥ 0.1.0a4
    • structlog ≥ 25.3.0

Quick Start

from langchain_openai import ChatOpenAI
from octogen.shop_agent import ShopAgent, create_agent
from your_models import ResponseClass, HydratedResponseClass

# Define your recommendation expansion function
def expand_recommendations(response, messages):
    # Process and expand recommendations
    return json.dumps(expanded_response)

# Create a shop agent
async with create_agent(
    model=ChatOpenAI(model="gpt-4"),
    agent_name="MyShopAgent",
    response_class=ResponseClass,
    hydrated_response_class=HydratedResponseClass,
    rec_expansion_fn=expand_recommendations,
    tool_names=["search_products", "get_product_details"],
    hub_prompt_id="your/hub/prompt_id",
) as agent:
    # Use the agent
    result = await agent.run("I'm looking for a new jacket")

Usage Examples

See the examples/ directory for complete implementations:

  • examples/stylist/ - A personal shopping assistant
  • examples/discovery/ - Product discovery agent
  • examples/comparison/ - Product comparison tool

License

This project is licensed under the terms included in the LICENSE file.

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

octogen_sdk_langgraph-0.1.1a0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

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

octogen_sdk_langgraph-0.1.1a0-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file octogen_sdk_langgraph-0.1.1a0.tar.gz.

File metadata

  • Download URL: octogen_sdk_langgraph-0.1.1a0.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for octogen_sdk_langgraph-0.1.1a0.tar.gz
Algorithm Hash digest
SHA256 81c4bad6c2703cacbf3a5ca63fcbf2bca3190794c29eb15a3dd31feda838ef48
MD5 eab30acf36bc8bfc7542846a3cbbad83
BLAKE2b-256 9825cc7a2b2acceeaace7c122997d21c1a6a62839006ea8b9b045352520edcaf

See more details on using hashes here.

Provenance

The following attestation bundles were made for octogen_sdk_langgraph-0.1.1a0.tar.gz:

Publisher: python-publish.yml on octogen-systems/octogen-py-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file octogen_sdk_langgraph-0.1.1a0-py3-none-any.whl.

File metadata

File hashes

Hashes for octogen_sdk_langgraph-0.1.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f5d2d3b941c6316e1341fffa66b47f9eb5d7777b8e2788e4b694bb231ee2310
MD5 be35246db09660cfd75ee936f2664065
BLAKE2b-256 86beac784b1229bf7766e5bfd32bd2e3f0ee0170336b3f9951fe414b1485714d

See more details on using hashes here.

Provenance

The following attestation bundles were made for octogen_sdk_langgraph-0.1.1a0-py3-none-any.whl:

Publisher: python-publish.yml on octogen-systems/octogen-py-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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