---
title: "Perplexity for teams: Spaces, Comet and the Sonar API"
description: "Spaces: organised, reusable research Spaces group research threads around a topic, client or project, with custom instructions and uploaded files (file…"
url: https://optimizeall.com/learn/gemini-copilot-perplexity-and-more/perplexity-api-comet-and-spaces
updated: 2026-10-05
---

Gemini, Microsoft Copilot, Perplexity & the AI Tool Landscape · Perplexity and research engines · lesson 12 of 19 · 18 min

# Perplexity for teams: Spaces, Comet and the Sonar API

## Spaces: organised, reusable research

**Spaces** group research threads around a topic, client or project, with **custom instructions** and **uploaded files** (file uploads require a paid plan; limits vary). Use them to:

- Keep all research for a client in one place with instructions like "Prefer official Saudi and UAE sources; always give dates; flag commercial sources".
- Combine web search with your own files (a brief, previous reports) in one answer.
- Share with colleagues so research is not repeated.

Enterprise plans add admin controls such as SSO, user management, and organisational data settings; check Perplexity's enterprise documentation for current details.

## Comet: an agentic browser

**Comet** is Perplexity's AI browser, free to download on desktop and mobile. Its assistant can summarise pages, compare tabs, and carry out multi-step tasks on websites (filling forms, navigating, collecting information), with your permission. Safety rules for agentic browsers:

- Start with **logged-out, low-risk** tasks (comparing public product pages).
- Avoid letting the agent act on banking, ad accounts, admin consoles or email unless your organisation approves.
- Watch for **prompt injection**: pages can contain hidden instructions aimed at AI agents.
- Review before submitting anything; take over manually for logins and payments.
- On work devices, follow your IT policy; enterprise deployment options exist.

## The Sonar API: cited answers inside your products

Perplexity's developer platform offers the **Sonar** family of search-grounded models (for example `sonar`, `sonar-pro`, and reasoning and deep-research variants) through a chat-completions-style API, plus a **Search API** that returns ranked web results. Responses include **citations** and **search results** your application can display. Check the docs for current model names and pricing (requests are priced per token and per search).

## Hands-on: competitor news digest with the Sonar API

```bash
pip install perplexityai
export PERPLEXITY_API_KEY="pplx-..."    # never commit it
```

```python
import os
from perplexity import Perplexity

client = Perplexity()  # reads PERPLEXITY_API_KEY
MODEL = os.environ.get("PPLX_MODEL", "sonar")

def competitor_digest(company: str, market: str) -> str:
    try:
        resp = client.chat.completions.create(
            model=MODEL,
            messages=[
                {"role": "system", "content": (
                    "You are a market analyst. Use only information from the last 30 days. "
                    "Five bullets maximum, each with a date. Say 'No notable news' if none.")},
                {"role": "user", "content": f"Notable news about {company} in {market}."},
            ],
            search_recency_filter="month",
        )
    except Exception as e:  # log and fall back gracefully in production
        return f"Digest unavailable for {company}: {type(e).__name__}"

    answer = resp.choices[0].message.content
    sources = [f"- {r.title} ({r.date or 'no date'}): {r.url}" for r in (resp.search_results or [])]
    return f"## {company}\n{answer}\n\nSources:\n" + "\n".join(sources)

if __name__ == "__main__":
    for c in ["Competitor A", "Competitor B"]:
        print(competitor_digest(c, "UAE"))
```

You can restrict sources with `search_domain_filter` (for example, to official domains) and schedule the script weekly, posting results to Slack or email through your automation tool. Always show the source links in the digest so readers can verify.

## The Search API for your own pipelines

If you want raw ranked results (to feed your own model or analysis), the Search API returns titles, URLs, dates and snippets:

```python
results = client.search.create(query="UAE influencer advertising permit requirements", max_results=5)
for r in results.results:
    print(r.title, r.url)
```

## Worked example: an agency's Monday digest

A Dubai agency runs the digest script every Monday for eight clients' top competitors, restricted to the last month, and posts it into each client's Slack channel via n8n. Account managers open any source before mentioning it to a client. Research time for weekly updates drops substantially, and clients comment on the timeliness of competitor insights.

## Cost and reliability tips for the API

- Start with the smallest Sonar model that meets quality; use reasoning or deep-research variants only where needed.
- Cache results for identical queries within a day to avoid paying twice.
- Handle errors and timeouts with a clear fallback message, as in the script.
- Log the query, model, cost and sources for every digest so you can audit what was sent to clients.
- Review a sample of digests weekly against their sources; tighten the system prompt when you see drift.

## Choosing between Spaces, Comet and the API

Use **Spaces** when people research interactively and want shared context; **Comet** when a person needs help on live web pages; the **Sonar API** when the same research runs on a schedule or inside another product. Many teams use all three: analysts research in Spaces, the API produces weekly digests, and Comet handles one-off web chores.

## Pitfalls

- Letting an agentic browser act on logged-in, high-risk sites.
- Hard-coding API keys.
- Publishing API answers without showing sources.
- Uploading confidential files to personal accounts or unapproved Spaces.

## How to measure success

Research lives in shared Spaces instead of scattered tabs, agentic browsing stays within safe tasks, and automated digests arrive on schedule with verifiable sources.

## Video lecture: Perplexity for teams: Spaces, Comet and the Sonar API

Lecture coming soon · 15 chapters · about 8 minutes. Read the full transcript below.

1. Perplexity for teams
2. Why this matters
3. Spaces
4. Simple example
5. Comet
6. Agentic browser safety
7. The Sonar API
8. Code walkthrough
9. Business example: Dubai agency Monday digest
10. Common mistakes
11. Cost and reliability
12. Key idea
13. Watch me do it, part 1
14. Watch me do it, part 2
15. Recap and try this now

## Lecture transcript

### Perplexity for teams

Perplexity is great for a quick cited answer. For teams, three things take it further. Spaces organise research so nobody repeats it. Comet, Perplexity's AI browser, can carry out tasks on websites. And the Sonar API puts cited, search grounded answers inside your own tools. In this lecture you will learn all three, with a working competitor digest script.

### Why this matters

Why does this matter for teams? Because research is often repeated, three people looking up the same competitor. It gets lost in browser tabs. And updates arrive late, because nobody had time to check the news this week. Spaces fix the repetition, Comet reduces the tab juggling, and the API automates the regular updates. Think of it as moving from individual detective work to a small, organised research desk.

### Spaces

Spaces group research threads around a topic or client, with custom instructions and uploaded files on paid plans. For example, a Space for a client with instructions like, prefer official Saudi and UAE sources, always give dates, and flag commercial sources, plus the client brief and last quarter's report. Answers can combine the web with your files, and colleagues can share the Space, so research builds up instead of being repeated.

### Simple example

A simple example first. Create a Space called trip to Istanbul, with instructions, family with two young children, mid range budget, show prices in Turkish lira and give dates for every source. Now ask about hotels, airport transport and museums in separate threads. Every answer follows the same instructions, and it is all in one place when you plan. The business version is identical, just with a client name and professional sources.

### Comet

Comet is Perplexity's AI browser, free to download on desktop and mobile. Its assistant can summarise the page you are on, compare what is in several tabs, and carry out multi step tasks on websites, like navigating, collecting information or filling in forms, with your permission. It is genuinely useful for comparison shopping, supplier research and repetitive web chores.

### Agentic browser safety

Agentic browsers need care. Start with logged out, low risk tasks, like comparing public product pages. Avoid letting the agent act on banking, ad accounts, admin consoles or your email unless your organisation has approved it. Watch for prompt injection, where pages hide instructions aimed at AI agents. Review before anything is submitted, and take over manually for logins and payments. On work devices, follow your IT policy.

### The Sonar API

For developers, Perplexity's Sonar API offers search grounded models, like sonar and sonar pro, plus reasoning and deep research variants, through a chat completions style interface. Every response includes citations and search results your application can show. There is also a Search API that returns ranked web results for your own pipelines. Check the documentation for current model names and prices, which are charged per token and per search.

### Code walkthrough

Let's walk through the digest script. Install the perplexityai package and set your API key as an environment variable. The client reads it automatically. The function sends a system message saying use only the last thirty days, five bullets maximum, each with a date, and say no notable news if there is none, plus a user message naming the company and market. The search recency filter is set to month. Then it prints the answer and a list of sources with titles, dates and links. You can also restrict sources to specific domains.

### Business example: Dubai agency Monday digest

A realistic example. A Dubai agency runs the digest script every Monday morning for the top competitors of eight clients, restricted to the last month, and posts each digest into the client's Slack channel through n8n. Account managers open any source before mentioning it to a client. Weekly research time drops substantially, and clients notice how current the competitor insights are. They also reviewed a sample of digests every week. In week three they noticed an old article slipping through for one competitor because a news site had republished it with a new date. They added a rule to the system prompt to prefer original publication dates and to flag republished content, and the problem disappeared. Automation plus a small weekly review worked better than either alone.

### Common mistakes

Four common mistakes. Letting an agentic browser act on logged in, high risk sites. Hard coding API keys into scripts. Publishing API answers without showing the sources. And uploading confidential client files to personal accounts or unapproved Spaces. Each of these is easy to prevent with a simple team rule.

### Cost and reliability

Some cost and reliability tips for the API. Start with the smallest Sonar model that meets your quality bar, and use reasoning or deep research variants only where they are needed. Cache results for identical queries within a day. Handle errors and timeouts with a clear fallback message. Log the query, model, cost and sources for every digest, so you can audit exactly what clients received. And review a sample of digests against their sources every week.

### Key idea

Here is the key idea behind any automated research. Automation multiplies whatever you build. A weekly digest for eight clients runs over four hundred times a year. If it is well sourced and regularly reviewed, that is four hundred useful updates. If it has a subtle flaw, like an old article slipping through, that flaw is also repeated four hundred times. So invest in the prompt, the filters and the review routine before you schedule anything.

### Watch me do it, part 1

Let me set up the Dubai agency's research desk. First a Space. I create one called client Al Noor, and add instructions, prefer official Saudi and UAE sources, always give dates, flag commercial sources. I upload the client brief and last quarter's report. Then I ask, what changed in the regulations for food delivery advertising in the UAE this year, and how does it affect this client's plan? The answer cites a government page and the client's own brief, so it combines the web with our files.

### Watch me do it, part 2

Now the API. In the terminal I set the Perplexity key as an environment variable and run the digest script for two competitors, limited to the last month. For competitor A, it prints five dated bullets and a sources list with titles, dates and links. Competitor B has no notable news, and the script says so instead of inventing any. I open one source to confirm a bullet, and it matches. Then in n8n I build the schedule, every Monday at eight, run the script, and post each digest to the client's Slack channel, with the sources included.

### Recap and try this now

Recap. Use Spaces to organise and share research with instructions and files. Use Comet for low risk web tasks, and keep agents away from sensitive logged in sites. Use the Sonar API to build automated, cited digests, always showing the sources. Try this now. Either create a Space for one client with clear source instructions, or run the digest script for two competitors and open every source it cites.

## Key takeaways

- Spaces organise shared research with custom instructions and files; enterprise plans add admin controls.
- Comet is an agentic AI browser: start with logged-out, low-risk tasks and avoid high-risk logged-in sites; beware prompt injection.
- The Sonar API returns search-grounded answers with citations and search results; the Search API returns ranked results.
- Automate digests with recency and domain filters, keep keys in environment variables, and always show sources.

## Try it

Create a Space for one client or topic with source instructions, or run the Sonar digest script for two competitors. Open every cited source and note any claim that was outdated or unsupported.

- [Previous: Research workflows: from question to verified brief](https://optimizeall.com/learn/gemini-copilot-perplexity-and-more/research-workflows-and-verification)
- [Next: Open-weight models explained](https://optimizeall.com/learn/gemini-copilot-perplexity-and-more/open-weight-models-explained)
- [All lessons of Gemini, Microsoft Copilot, Perplexity & the AI Tool Landscape](https://optimizeall.com/learn/gemini-copilot-perplexity-and-more)
