Multimodal orchestration for LLM analysis
Project description
Pollux
Multimodal orchestration for LLM APIs.
You describe what to analyze. Pollux handles source patterns, context caching, deferred delivery, and multimodal content.
Documentation · Getting Started · Building With Deferred Delivery
Quick Start
import asyncio
from pollux import Config, Source, run
result = asyncio.run(
run(
"What are the key findings and their implications?",
source=Source.from_file("earnings-report.pdf"),
config=Config(provider="gemini", model="gemini-2.5-flash-lite"),
)
)
print(result["answers"][0])
# Revenue grew 18% YoY to $4.2B, driven by cloud services. Operating
# margins improved from 29% to 34%. Management's $2B buyback and raised
# guidance signal confidence in sustained growth.
run() returns a ResultEnvelope: answers holds one entry per prompt.
To use OpenAI instead: Config(provider="openai", model="gpt-5-nano").
For Anthropic: Config(provider="anthropic", model="claude-haiku-4-5").
For OpenRouter: Config(provider="openrouter", model="google/gemma-3-27b-it:free").
For a full walkthrough (install, key setup, first result), see Getting Started.
Which Entry Point Should I Use?
| If you want to... | Use |
|---|---|
| Ask one prompt and get an answer now | run() |
| Ask many prompts against shared source(s) | run_many() |
| Submit non-urgent work and collect it later | defer() / defer_many() |
Pollux keeps realtime and deferred work on separate entry points. If the result
can wait, submit it once, persist the handle, and collect the same
ResultEnvelope later.
What Pollux Handles
Say you have a document and ten questions about it. Each API call re-uploads the file, and you're left managing caching, retries, and concurrency yourself. Pollux uploads once, caches the content, fans out your prompts concurrently, and hands back results.
The same Source interface handles PDFs, images, video, YouTube URLs, and arXiv papers. No per-format upload code.
Need structured output? Pass a Pydantic model as response_schema and get a validated instance alongside the raw text. Switching providers is a one-line change: provider="gemini" to provider="openai".
One Upload, Many Prompts
Got three questions about the same paper? run_many() fans them out concurrently:
import asyncio
from pollux import Config, Source, run_many
envelope = asyncio.run(
run_many(
["Summarize the methodology.", "List key findings.", "Identify limitations."],
sources=[Source.from_file("paper.pdf")],
config=Config(provider="gemini", model="gemini-2.5-flash-lite"),
)
)
for answer in envelope["answers"]:
print(answer)
Add more sources and Pollux broadcasts every prompt across every source, uploading each once regardless of how many prompts reference it.
When the Work Can Wait
Deferred delivery is for long fan-out work, backfills, and scheduled analysis where no one is waiting on the answer in the current process.
import asyncio
from pollux import (
Config,
Source,
collect_deferred,
defer,
inspect_deferred,
)
config = Config(provider="openai", model="gpt-5-nano")
handle = asyncio.run(
defer(
"Summarize the report in five bullets.",
source=Source.from_file("market-report.pdf"),
config=config,
)
)
snapshot = asyncio.run(inspect_deferred(handle))
if snapshot.is_terminal:
result = asyncio.run(collect_deferred(handle))
print(result["answers"][0])
In production code, persist handle.to_dict() and restore it later with
DeferredHandle.from_dict(...). For the full lifecycle, read
Submitting Work for Later Collection
and
Building With Deferred Delivery.
Where Pollux Ends
Pollux owns content delivery, context caching, and provider translation. Prompt design, workflow orchestration, and what you do with results are yours. See Core Concepts for the full boundary model.
Installation
pip install pollux-ai
Set your provider's API key:
export GEMINI_API_KEY="your-key-here" # or
export OPENAI_API_KEY="your-key-here" # or
export ANTHROPIC_API_KEY="your-key-here" # or
export OPENROUTER_API_KEY="your-key-here"
Keys from: Google AI Studio · OpenAI · Anthropic · OpenRouter
Documentation
- Getting Started: first result in 2 minutes
- Core Concepts: mental model and vocabulary
- Submitting Work for Later Collection: deferred lifecycle API
- Building With Deferred Delivery: when deferred is worth it
- API Reference: entry points and types
- Cookbook: runnable end-to-end recipes
Full docs at polluxlib.dev.
Contributing
See CONTRIBUTING and TESTING.md for guidelines.
Built during Google Summer of Code 2025 with Google DeepMind. Learn more
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pollux_ai-1.5.0.tar.gz.
File metadata
- Download URL: pollux_ai-1.5.0.tar.gz
- Upload date:
- Size: 646.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b824f0c20e6e728f9f48a9d84ca13f35b3a33703e9c81f174bc2327d579d077
|
|
| MD5 |
5a45e0bdb5edaf2a45d211cfd1e952ea
|
|
| BLAKE2b-256 |
003ad3d95367c01080347cdfaddad19ba3159bdd29abeb4d50a4e58ca6bf8ffb
|
Provenance
The following attestation bundles were made for pollux_ai-1.5.0.tar.gz:
Publisher:
release.yml on seanbrar/pollux
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pollux_ai-1.5.0.tar.gz -
Subject digest:
8b824f0c20e6e728f9f48a9d84ca13f35b3a33703e9c81f174bc2327d579d077 - Sigstore transparency entry: 1114210401
- Sigstore integration time:
-
Permalink:
seanbrar/pollux@5acfeb44517cbae8ef2a590a068f59ff7856a75f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/seanbrar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5acfeb44517cbae8ef2a590a068f59ff7856a75f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pollux_ai-1.5.0-py3-none-any.whl.
File metadata
- Download URL: pollux_ai-1.5.0-py3-none-any.whl
- Upload date:
- Size: 77.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfcc82d00ae1e6b18320e7d7082049ff90f89f23a9ed6ee9685da4279d61a280
|
|
| MD5 |
79debe7e2e1c96e2e5d93819ff837933
|
|
| BLAKE2b-256 |
3b949fef0caa22190d274dee357c55bedc9784a84ad54e7e89880db107a5c1ec
|
Provenance
The following attestation bundles were made for pollux_ai-1.5.0-py3-none-any.whl:
Publisher:
release.yml on seanbrar/pollux
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pollux_ai-1.5.0-py3-none-any.whl -
Subject digest:
bfcc82d00ae1e6b18320e7d7082049ff90f89f23a9ed6ee9685da4279d61a280 - Sigstore transparency entry: 1114210415
- Sigstore integration time:
-
Permalink:
seanbrar/pollux@5acfeb44517cbae8ef2a590a068f59ff7856a75f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/seanbrar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5acfeb44517cbae8ef2a590a068f59ff7856a75f -
Trigger Event:
workflow_dispatch
-
Statement type: