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.1

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.1
File Size Uploaded Provenance Actions
smaran_pipecat-0.1.1.tar.gz 6.6 kB With provenance Details for smaran_pipecat-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 13.6 kB

Release files / smaran_pipecat-0.1.1.tar.gz

Download URL smaran_pipecat-0.1.1.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
09334f5978754351d917f271ad88333e4bd3d45a36949b9f51fa803ab9cb8efb
BLAKE2b-256 checksum
How to use checksums
b83e8c0c56dade66620d754044ecadc6a3c434a091bae317d00d2fa9ee5e5014
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 5, 2026.

Transparency log

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

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

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 Sep 5, 2026.

Transparency log

Security for smaran-pipecat 0.1.1

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for smaran_pipecat-0.1.1.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 Sep 5, 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.1 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