Skip to main content

Smaran Pipecat SDK

Memory-enhanced conversational AI pipelines with Smaran and Pipecat.

Installation

pip install smaran-pipecat

Quick Start

import os
from pipecat.pipeline.pipeline import Pipeline
from smaran_pipecat import SmaranPipecatService

# Create memory service
memory = SmaranPipecatService(
    api_key=os.getenv("SMARAN_API_KEY"),
    base_url=os.getenv("SMARAN_URL"),
    user_id="user-123",
    session_id="conversation-456",  # Optional: groups saved memories by session
)

# Add to Pipecat pipeline
pipeline = Pipeline([
    transport.input(),
    stt,
    context_aggregator.user(),
    memory,  # Automatically recalls and injects relevant memories
    llm,
    transport.output(),
    context_aggregator.assistant(),
])

Configuration

Parameters

Parameter Type Required Description
user_id str Yes User identifier memories are scoped to
session_id str No Session/conversation ID for grouping saved memories
api_key str No Smaran API key (or set SMARAN_API_KEY env var)
base_url str No Smaran API base URL (or set SMARAN_URL env var)
params InputParams No Advanced configuration

Advanced Configuration

from smaran_pipecat import SmaranPipecatService

memory = SmaranPipecatService(
    user_id="user-123",
    session_id="conv-456",
    params=SmaranPipecatService.InputParams(
        search_limit=5,             # Max memories to recall per turn
        system_prompt="Based on previous conversations, I recall:\n\n",
        inject_mode="auto",         # "auto", "system", or "user"
        save_memory=True,           # Save new memories after each turn
    ),
)

How It Works

  1. Intercepts context frames — listens for LLMContextFrame in the pipeline
  2. Recalls memories — queries Smaran's /v1/recall API with the user's latest message
  3. Injects memories — formats recalled facts and adds them to the LLM context
  4. Saves messages — sends new user/assistant turns to Smaran's /v1/memories API in the background, non-blocking

Full Example

import asyncio
import os
from fastapi import FastAPI, WebSocket
from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.task import PipelineTask
from pipecat.pipeline.runner import PipelineRunner
from pipecat.processors.aggregators.llm_context import LLMContext, LLMContextAggregatorPair
from pipecat.transports.websocket.fastapi import (
    FastAPIWebsocketTransport,
    FastAPIWebsocketParams,
)
from smaran_pipecat import SmaranPipecatService

app = FastAPI()

@app.websocket("/chat")
async def websocket_endpoint(websocket: WebSocket):
    await websocket.accept()

    transport = FastAPIWebsocketTransport(
        websocket=websocket,
        params=FastAPIWebsocketParams(audio_in_enabled=True, audio_out_enabled=True),
    )

    context = LLMContext([{"role": "system", "content": "You are a helpful assistant."}])
    context_aggregator = LLMContextAggregatorPair(context)

    memory = SmaranPipecatService(
        user_id="alice",
        session_id="session-123",
    )

    pipeline = Pipeline([
        transport.input(),
        context_aggregator.user(),
        memory,
        llm,
        transport.output(),
        context_aggregator.assistant(),
    ])

    runner = PipelineRunner()
    task = PipelineTask(pipeline)
    await runner.run(task)

Check Pipecat's own docs for the current LLM service and context-aggregator setup for your provider — that surface moves fast between Pipecat versions.

License

MIT

Metadata

Release files for smaran-pipecat 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smaran-pipecat 0.1.2
File Size Uploaded Provenance Actions
smaran_pipecat-0.1.2.tar.gz 6.7 kB With provenance Details for smaran_pipecat-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for smaran-pipecat 0.1.2
File Interpreter ABI Platform Actions
smaran_pipecat-0.1.2-py3-none-any.whl Python 3 none any Details for smaran_pipecat-0.1.2-py3-none-any.whl

Total release size: 13.7 kB

Release files / smaran_pipecat-0.1.2.tar.gz

Download URL smaran_pipecat-0.1.2.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8c987754067dce53298b51c3491391c88d79916fb1a13cc5b75b9b5613e8b846
BLAKE2b-256 checksum
How to use checksums
f6b262186c6b4b7d6018ef61ec3edc98dbb3da9cf0870f4b1eef0b779675feb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / smaran_pipecat-0.1.2-py3-none-any.whl

Download URL smaran_pipecat-0.1.2-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
319331bc1d4ac3097f8817709af64c26f131e6323f4bc364a4a9681b568a6e0e
BLAKE2b-256 checksum
How to use checksums
afbad2a6be68fbbfc40242f9d77d52a867bae49cce0934ddd467fc7739d26bcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for smaran-pipecat 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for smaran_pipecat-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page