AI & MLProduction
Paper Ecosystem
Multi-repo Agentic AI & LLM Inference platform featuring a central gRPC token-streaming inference gateway (paper-core), real-time voice agent runtime (paper-caller), multi-agent tools, and MCP integrations.
⚡ Impact Outcome: Abstracts multi-provider LLM inference (MiniMax, OpenAI, Ollama) behind a high-performance token-streaming gRPC gateway.
Tech Stack
Python 3.12gRPCProtobufFastAPIMiniMax / OpenAI / OllamaDockerPrometheus
Architecture Concepts
gRPC Inference GatewayToken StreamingMulti-Agent RuntimeModel Context Protocol (MCP)
Live GitHub Repository README
Live SyncedPaper Core (paper-core
)
paper-coreCentral LLM Inference Gateway and gRPC Service for the Paper AI Ecosystem.
paper-coreRole in the Ecosystem
Caller Services (paper-caller / paper-mcp / paper-cli)
|
| gRPC Generate() or StreamGenerate()
v
paper-core (Port 50051)
|
+-------------+-------------+
| | |
MiniMax OpenAI Ollama
- What it owns: LLM provider adapters, gRPC server lifecycle (,
AIService), rate limiting per API key, circuit breaker state tracking, and request scheduling.AIStreamService - What it does NOT do: does not handle audio processing (owned by
paper-core), session memory (owned bypaper-caller), or tool execution (owned bypaper-memory).paper-tools
Key Features
- Provider Abstraction: Unified interface for cloud and local language models (MiniMax, OpenAI, Anthropic, Groq, Ollama).
- Token-by-Token gRPC Streaming: Server-streaming gRPC interface for sub-second first-token delivery.
- Resilience Controls: Built-in circuit breakers and exponential backoff retries with jitter via .
paper-common - Token Bucket Rate Limiting: Configurable rate limiting per API key or tenant ID.
- Prometheus Telemetry: Native metrics export on port 9090 for inference latency, token counts, and error rates.
Repository Structure
paper-core/
├── app/
│ ├── main.py # Service entry point and signal handling
│ ├── config.py # Pydantic environment configuration
│ ├── engine/ # AIEngine orchestrator
│ ├── grpc_server/ # gRPC servicers, interceptors, and channels
│ ├── providers/ # LLM provider adapters (MiniMax, OpenAI, etc.)
│ ├── scheduler/ # Priority request queue and scheduler
│ └── throttling/ # Token bucket rate limiter
├── tests/ # Unit and integration test suite
├── Dockerfile # Production container definition
├── pyproject.toml # Python dependencies and build config
└── README.md
Quickstart & Installation
Prerequisites
- Python 3.12+
- Docker & Docker Compose (optional for containerized setup)
Local Setup
bash
# Clone repository
git clone https://github.com/artificialpaper/paper-core.git
cd paper-core
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -e .
# Copy environment template
cp .env.example .env
Running the gRPC Server
bash
# Start gRPC inference server on port 50051
python -m app.main
Configuration Reference
paper-core.env| Variable | Type | Default | Description |
|---|---|---|---|
| int | | gRPC server listening port |
| int | | Prometheus metrics HTTP port |
| string | | Active provider key ( |
| string | | MiniMax API secret key |
| string | | OpenAI API secret key |
| string | | Local Ollama server address |
| int | | Token bucket refill rate |
gRPC API Reference
paper-corepaper-protoUnary Generation (AIService.Generate
)
AIService.Generateprotobuf
rpc Generate(GenerateRequest) returns (GenerateResponse);
Server Streaming (AIStreamService.StreamGenerate
)
AIStreamService.StreamGenerateprotobuf
rpc StreamGenerate(GenerateRequest) returns (stream StreamChunk);
Testing & Quality
bash
# Run pytest test suite
pytest
# Run linter and type checker
ruff check .
mypy app
Related Repositories & Documentation
- paper-caller - Real-time Voice AI Agent Runtime
- paper-common - Shared Platform SDK
- paper-proto - gRPC Protobuf Contracts
- paper-docs - Official Ecosystem Documentation Portal
License
This project is licensed under the MIT License - see the LICENSE file for details.