Metadata-Version: 2.5
Name: pipecat-specstream
Version: 0.2.1
Summary: SpecStream for Pipecat voice agents: live web search, page reading, Deep Search lists and research reports as function calling tools. Search API at $1 per 1,000 fast searches, $5 standard; Extract API at $0.80 per 1,000 pages. The same key reads the link graph (/v1/authority, /v1/backlinks) and EU DORA sub-processors, and is a drop in for Google Custom Search at $1 per 1,000. $2 free credit, no card.
Project-URL: Homepage, https://specstream.ai
Project-URL: Documentation, https://specstream.ai/docs/api
Project-URL: Repository, https://github.com/specstream/specstream-tools/tree/main/packages/pipecat-specstream
Project-URL: Issues, https://github.com/specstream/specstream-tools/issues
Project-URL: Changelog, https://github.com/specstream/specstream-tools/blob/main/packages/pipecat-specstream/CHANGELOG.md
Project-URL: Pricing, https://specstream.ai/pricing
Author-email: SpecStream <support@specstream.ai>
License-Expression: BSD-2-Clause
License-File: LICENSE
Keywords: backlinks,custom-search-api,deep-search,domain-authority,dora,eu-dora,extract,extract-api,function-calling,google-cse,google-custom-search,live-web,pipecat,rag,search-api,seo,specstream,subprocessors,voice-agents,web-scraping,web-search
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: pipecat-ai<2,>=1.16
Provides-Extra: test
Requires-Dist: pytest-asyncio>=0.24; extra == 'test'
Requires-Dist: pytest>=8; extra == 'test'
Description-Content-Type: text/markdown

# pipecat-specstream

[SpecStream](https://specstream.ai) for [Pipecat](https://pipecat.ai) voice and multimodal agents: live web search, page reading, Deep Search lists and research reports as function-calling tools.

This integration is maintained by SpecStream, the company behind the service.
Tested with Pipecat v1.16.0.

SpecStream has three products:

1. Search API: `GET /v1/web-search`, $5 per 1,000 searches of up to 10 results, or $1 per 1,000 with `speed=fast`, the default here because it suits voice.
2. Extract API: `POST /v1/extract`, up to 20 URLs a call (web pages, PDF, Word, Excel), $0.80 per 1,000 pages. A page with no text is not charged.
3. Deep Search: ask for a list in plain words and get every match on the live web as structured rows, each value with the page it was read from. Each delivered row is charged 5¢, 15¢ or $1 depending on what the row needs.

## Install

```bash
uv add pipecat-specstream
export SPECSTREAM_API_KEY=ss_live_...   # Agents & API in your SpecStream workspace
```

A free account comes with $2 of credit, enough for 2,000 fast searches or 2,500 pages, and needs no card: [specstream.ai](https://specstream.ai/signup).

## Use it in a Pipecat pipeline

```python
from pipecat.processors.aggregators.llm_context import LLMContext
from pipecat_specstream import SpecStreamDeepSearch

specstream = SpecStreamDeepSearch(api_key=os.getenv("SPECSTREAM_API_KEY"), max_price_usd=5)
context = LLMContext(tools=specstream.tools())
```

The schemas carry their handlers, so the LLM service registers them on its own. Put the context in an `LLMContextAggregatorPair` and the pipeline is the usual one: `transport.input(), stt, user_aggregator, llm, tts, transport.output(), assistant_aggregator`. Call `await specstream.close()` at teardown.

| Tool | What it does |
| - | - |
| `specstream_web_search` | One fact or a quick answer from the live web, with the page it came from. |
| `specstream_read_pages` | The text, title and date of 1 to 20 known pages. |
| `specstream_price_list` | The most a Deep Search list can cost. Nothing runs and nothing is charged. |
| `specstream_find_list` | A Deep Search list of every match. It runs as an async function call: the bot keeps talking and the rows reach the model when the list is done. |
| `specstream_get_list_results` | The rows of a list again, for example the next ones. Free. |

## Spending

- `max_price_usd` is the most one list may cost. Only the developer sets it; the model can't raise it, and a list priced above it never starts.
- With `ask_before_buying=True` (the default), the model must call `specstream_price_list`, tell the user the price and pass the price the user accepted as `approved_max_usd`. If the price has grown, nothing runs.
- A repeated call for the same list within the hour gets the list it already started, so it is never bought twice.

| Argument | Default | What it does |
| - | - | - |
| `api_key` | `SPECSTREAM_API_KEY` | Your SpecStream API key. |
| `max_price_usd` | required | The most one list may cost, in dollars. |
| `ask_before_buying` | `True` | Ask the user to accept the price before a list starts. |
| `search_speed` | `"fast"` | `"fast"` for the lowest latency, `"default"` for the most accurate answer. |
| `rows_in_answer` | `10` | How many rows go back to the model at once; the rest are at the list's link. |
| `wait_secs` | `420` | How long a list may run before the rows found so far are returned. |

## Research reports

`SpecStreamResearch` gives the agent a written report that answers a question from the live web, with the page behind each cited sentence. A report costs $0.10 (`quick`), $0.30 (`standard`) or $1.00 (`deep`), charged once, when it is delivered. A failed or cancelled report is not charged.

```python
from pipecat.adapters.llm.schemas.tools_schema import ToolsSchema
from pipecat_specstream import SpecStreamDeepSearch, SpecStreamResearch

search = SpecStreamDeepSearch(max_price_usd=5)
research = SpecStreamResearch(max_price_usd=0.30)   # quick and standard reports, never deep
tools = ToolsSchema(standard_tools=search.function_schemas() + research.function_schemas())
context = LLMContext(tools=tools)
```

| Tool | What it does |
| - | - |
| `specstream_research_price` | The price of a report at each depth the agent may buy. Nothing runs and nothing is charged. |
| `specstream_start_research` | Starts the report. It runs as an async function call: the bot keeps talking and the report reaches the model when it is done, about a minute for a quick one. |
| `specstream_get_research` | A report by its id: its status while it runs, the text and its cited pages when it is completed. Free. |

- `max_price_usd` is the most one report may cost. The model sees only the depths at or under it and can't raise it.
- With `ask_before_buying=True` (the default), the model must tell the user the price and pass the price the user accepted as `approved_max_usd`. Without it, nothing runs.
- A repeated call for the same question within the hour gets the report it already started, so it is never bought twice.
- `length` is `"short"` by default, which suits a spoken answer; `include_domains` and `exclude_domains` choose the sites it reads.

A failed call goes back to the model as `{"status": "error", "error": "..."}`; it never stops the pipeline.

## Run the example

```bash
cd examples
export SPECSTREAM_API_KEY=... DEEPGRAM_API_KEY=... CARTESIA_API_KEY=... OPENAI_API_KEY=...
uv run --with "pipecat-ai[daily,deepgram,cartesia,openai,silero,runner]" --with pipecat-specstream python foundational.py
```

Open the address it prints and ask: "What's in the news today?", "Read https://example.com", or "Find dental clinics in Lisbon with online booking".

`research.py` is the same bot with research reports: ask "Research how the EU and the US regulate stablecoin reserves".

## Moving off Google Custom Search

Google ends its Custom Search JSON API for existing customers on January 1, 2027. SpecStream answers the same call in Google's shape, so the move is one line: change the base address from `https://www.googleapis.com` to `https://api.specstream.ai`.

```bash
curl "https://api.specstream.ai/customsearch/v1?key=$SPECSTREAM_API_KEY&q=open+source+vector+databases&num=10"
```

`items[].title`, `link`, `snippet` and `displayLink` come back as before. `cx` is accepted and not needed. Each call runs on the fast tier at $1 per 1,000, against Google's $5 per 1,000, and the Extract API reads the pages at $0.80 per 1,000. Guide: [specstream.ai/migrate/google-cse](https://specstream.ai/migrate/google-cse).

## Link graph and EU DORA data on the same key

The same API key reads SpecStream's own link graph and its EU DORA register data, from the same balance.

```bash
curl -H "Authorization: Bearer $SPECSTREAM_API_KEY" "https://api.specstream.ai/v1/authority?domains=stripe.com,notion.com"
curl -H "Authorization: Bearer $SPECSTREAM_API_KEY" "https://api.specstream.ai/v1/backlinks?target=stripe.com&mode=domains"
curl -H "Authorization: Bearer $SPECSTREAM_API_KEY" "https://api.specstream.ai/v1/data/dora/subprocessors?domain=stripe.com&format=json"
```

`/v1/authority` gives the authority score (0 to 100), estimated global rank, referring domains and outbound hosts of up to 100 domains in one call: $0.50 per 1,000 calls of 1 to 10 domains, $2 per 1,000 calls of 11 to 100. `/v1/backlinks` lists the referring domains or linking pages of a site, inbound or outbound, $4 per 1,000 calls. Both answer from SpecStream's own web index with no live crawl. `/v1/data/dora/subprocessors` returns a vendor's sub-processors as EU DORA Register of Information rows (`B_05.01` and `B_05.02`) with GLEIF LEIs, $0.05 a lookup; `format=roi_csv` gives the register file.

More from the same engine: the [sub-processor directory](https://specstream.ai/subprocessors), the sub-processor lists of SaaS and AI companies read from each company's own trust center.

## License

BSD 2-Clause.

## More from SpecStream

- **Ready lists first.** The hosted [MCP server](https://specstream.ai/docs/mcp) has `find_ready_list`: it finds a list SpecStream already keeps current (companies, places or records) at no charge, before you pay for a new find. The newest 100 rows of a ready list are $15, tax included. Browse them in the [Dataset Finder](https://specstream.ai/tools/dataset-finder) or the [Hugging Face Space](https://huggingface.co/spaces/SpecStreamAI/global-b2b-dataset-finder).
- **Drop in search routes.** Change one base address and keep your code: Google Custom Search JSON API (Google ends it for existing customers on January 1, 2027), Exa, SerpApi (`google`, `google_news`, `google_images` and `bing_images` engines), Tavily, Brave Search, Firecrawl and Bing Web Search v7. Guides at [specstream.ai/migrate](https://specstream.ai/migrate).
- **Prices.** $1 per 1,000 fast searches, $5 per 1,000 default searches, $0.80 per 1,000 pages read, $4 per 1,000 backlink lookups and $0.50 per 1,000 authority checks. The [Search Pack](https://specstream.ai/deals#packs) is 80,000 fast searches for $49. A top up of $1,000 or more adds 20%, so $1,000 buys $1,200 of credit. The Pro Pass is $49 a month with $49 of API credit and 5,000 ready list rows. New accounts start with $2 of credit, no card.
- **GitHub Marketplace.** [DORA Subprocessor Check](https://github.com/marketplace/actions/specstream-dora-subprocessor-check) and [Backlink and Authority Check](https://github.com/marketplace/actions/specstream-backlink-and-authority-check).
- **Open data on Zenodo.** [SaaS AI subprocessors](https://doi.org/10.5281/zenodo.24808877), [US chain store locations](https://doi.org/10.5281/zenodo.24808908), [industrial manufacturers and B2B suppliers](https://doi.org/10.5281/zenodo.24808956) and [US federal expiring contracts with EU and UK tenders](https://doi.org/10.5281/zenodo.24808928).
- **For agents.** The [AI catalog](https://specstream.ai/.well-known/ai-catalog.json) points agents to the MCP server card, the A2A agent card, the OpenAPI document, x402 and llms.txt.
