Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 51 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,61 @@ PREFERRED_DEAL_DISCOUNT_MAX=0.15
# =============================================================================
# LLM Configuration
# =============================================================================
# Only one provider can be active at a time.
# Uncomment the block for your chosen provider and comment out the others.

# Provider: Anthropic (default)
ANTHROPIC_API_KEY=your-anthropic-api-key-here
DEFAULT_LLM_MODEL=anthropic/claude-sonnet-4-5-20250929
MANAGER_LLM_MODEL=anthropic/claude-sonnet-4-5-20250929
MANAGER_LLM_MODEL=anthropic/claude-opus-4-20250514
LLM_TEMPERATURE=0.3
LLM_MAX_TOKENS=4096

# Provider: OpenAI (alternative)
# To switch to OpenAI, set DEFAULT_LLM_MODEL and OPENAI_API_KEY:
# OPENAI_API_KEY=your-openai-api-key-here
# DEFAULT_LLM_MODEL=openai/gpt-4o
# MANAGER_LLM_MODEL=openai/gpt-4o

# Provider: Google Gemini (alternative)
# To switch to Gemini, set DEFAULT_LLM_MODEL and GOOGLE_API_KEY:
# GOOGLE_API_KEY=your-google-api-key-here
# DEFAULT_LLM_MODEL=gemini/gemini-2.5-flash
# MANAGER_LLM_MODEL=gemini/gemini-2.5-flash

# Provider: AWS Bedrock (alternative)
# To switch to Bedrock, set DEFAULT_LLM_MODEL and AWS credentials:
# AWS_ACCESS_KEY_ID=your-aws-access-key
# AWS_SECRET_ACCESS_KEY=your-aws-secret-key
# AWS_REGION=us-west-2
# DEFAULT_LLM_MODEL=bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0
# MANAGER_LLM_MODEL=bedrock/us.anthropic.claude-opus-4-20250514-v1:0

# Provider: Custom OpenAI-compatible endpoint (alternative)
# For endpoints with no CrewAI native provider prefix of their own — NVIDIA
# NIM, Ollama, HuggingFace TGI, vLLM, LM Studio, etc. Set DEFAULT_LLM_MODEL to
# the raw model id the endpoint expects, plus
# OPENAI_COMPATIBLE_LLM_API_BASE_URL. OPENAI_COMPATIBLE_LLM_API_KEY is
# optional — omit it for endpoints (e.g. a local Ollama server) that don't
# require one.
#
# NVIDIA NIM:
# OPENAI_COMPATIBLE_LLM_API_KEY=nvapi-your-nvidia-api-key
# OPENAI_COMPATIBLE_LLM_API_BASE_URL=https://integrate.api.nvidia.com/v1
# DEFAULT_LLM_MODEL=meta/llama-3.1-70b-instruct
# MANAGER_LLM_MODEL=meta/llama-3.1-70b-instruct
#
# Ollama (local or self-hosted):
# OPENAI_COMPATIBLE_LLM_API_BASE_URL=http://localhost:11434/v1
# DEFAULT_LLM_MODEL=llama3
# MANAGER_LLM_MODEL=llama3
#
# HuggingFace TGI (self-hosted):
# OPENAI_COMPATIBLE_LLM_API_KEY=hf_your-huggingface-token
# OPENAI_COMPATIBLE_LLM_API_BASE_URL=https://your-tgi-endpoint.example.com/v1
# DEFAULT_LLM_MODEL=meta-llama/Meta-Llama-3-8B-Instruct
# MANAGER_LLM_MODEL=meta-llama/Meta-Llama-3-8B-Instruct

# =============================================================================
# CrewAI Configuration
# =============================================================================
Expand Down
31 changes: 30 additions & 1 deletion docs/guides/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ ad-seller freewheel-login --provider bc
| `MANAGER_LLM_MODEL` | `str` | `"anthropic/claude-opus-4-20250514"` | Model for manager/orchestrator agents |
| `LLM_TEMPERATURE` | `float` | `0.3` | LLM temperature (lower = more deterministic) |
| `LLM_MAX_TOKENS` | `int` | `4096` | Maximum tokens per LLM response |
| `OPENAI_COMPATIBLE_LLM_API_KEY` | `str` | `None` | API key for a [custom OpenAI-compatible endpoint](#custom-openai-compatible-endpoints) (optional — some endpoints don't require one) |
| `OPENAI_COMPATIBLE_LLM_API_BASE_URL` | `str` | `None` | Base URL for a custom OpenAI-compatible endpoint; when set, `DEFAULT_LLM_MODEL`/`MANAGER_LLM_MODEL` are sent as-is to that endpoint instead of being routed by provider prefix |

### Supported Providers

Expand All @@ -98,7 +100,7 @@ The seller agent uses CrewAI's native provider integrations via `provider/model-
|----------|-------------|-----------------|---------------|
| **Anthropic** (default) | `anthropic/claude-sonnet-4-5-20250929` | `ANTHROPIC_API_KEY` | `crewai[anthropic]` |
| **OpenAI** | `openai/gpt-4o` | `OPENAI_API_KEY` | `crewai[openai]` |
| **Google Gemini** | `gemini/gemini-2.0-flash` | `GOOGLE_API_KEY` | `crewai[gemini]` |
| **Google Gemini** | `gemini/gemini-2.5-flash` | `GOOGLE_API_KEY` | `crewai[gemini]` |
| **Azure OpenAI** | `azure/my-deployment` | `AZURE_API_KEY`, `AZURE_API_BASE` | `crewai[azure]` |
| **AWS Bedrock** | `bedrock/anthropic.claude-3-sonnet` | AWS credentials | `crewai[bedrock]` |

Expand All @@ -116,6 +118,33 @@ OPENAI_API_KEY=sk-xxxxx

For other providers, see the [CrewAI LLM documentation](https://docs.crewai.com/en/learn/litellm-removal-guide).

### Custom OpenAI-Compatible Endpoints

For endpoints that don't have one of the native provider prefixes above —
NVIDIA NIM, Ollama, HuggingFace TGI, vLLM, LM Studio, and similar — set
`OPENAI_COMPATIBLE_LLM_API_BASE_URL`. This pins the request to CrewAI's native OpenAI-compatible
client regardless of the model id's shape, so `DEFAULT_LLM_MODEL` /
`MANAGER_LLM_MODEL` should be set to the raw model id the endpoint expects
(no provider prefix). `OPENAI_COMPATIBLE_LLM_API_KEY` is optional — omit it for endpoints, such
as a local Ollama server, that don't require one.

**Example — NVIDIA NIM:**

```bash
OPENAI_COMPATIBLE_LLM_API_KEY=nvapi-xxxxx
OPENAI_COMPATIBLE_LLM_API_BASE_URL=https://integrate.api.nvidia.com/v1
DEFAULT_LLM_MODEL=meta/llama-3.1-70b-instruct
MANAGER_LLM_MODEL=meta/llama-3.1-70b-instruct
```

**Example — Ollama, local or self-hosted:**

```bash
OPENAI_COMPATIBLE_LLM_API_BASE_URL=http://localhost:11434/v1
DEFAULT_LLM_MODEL=llama3
MANAGER_LLM_MODEL=llama3
```

## Database & Storage

| Variable | Type | Default | Description |
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ classifiers = [
]

dependencies = [
"crewai[anthropic,bedrock]>=1.14.4,<2.0.0",
"crewai[anthropic,bedrock,openai,gemini]>=1.14.4,<2.0.0",
"crewai-tools>=1.14.0,<2.0.0",
"pydantic>=2.0.0",
"pydantic-settings>=2.0.0",
Expand Down
5 changes: 3 additions & 2 deletions src/ad_seller/agents/level1/inventory_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
function, evaluates proposals, and coordinates specialist agents.
"""

from crewai import LLM, Agent
from crewai import Agent

from ...config import get_settings
from ...llm import build_llm


def create_inventory_manager() -> Agent:
Expand All @@ -28,7 +29,7 @@ def create_inventory_manager() -> Agent:
"""
settings = get_settings()

llm = LLM(
llm = build_llm(
model=settings.manager_llm_model,
temperature=0.3,
max_tokens=settings.llm_max_tokens,
Expand Down
5 changes: 3 additions & 2 deletions src/ad_seller/agents/level2/ctv_inventory_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
OTT apps, FAST channels, and household-targeted inventory.
"""

from crewai import LLM, Agent
from crewai import Agent

from ...config import get_settings
from ...llm import build_llm


def create_ctv_inventory_agent() -> Agent:
Expand All @@ -27,7 +28,7 @@ def create_ctv_inventory_agent() -> Agent:
"""
settings = get_settings()

llm = LLM(
llm = build_llm(
model=settings.default_llm_model,
temperature=0.5,
max_tokens=settings.llm_max_tokens,
Expand Down
5 changes: 3 additions & 2 deletions src/ad_seller/agents/level2/display_inventory_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
and premium homepage takeovers.
"""

from crewai import LLM, Agent
from crewai import Agent

from ...config import get_settings
from ...llm import build_llm


def create_display_inventory_agent() -> Agent:
Expand All @@ -26,7 +27,7 @@ def create_display_inventory_agent() -> Agent:
"""
settings = get_settings()

llm = LLM(
llm = build_llm(
model=settings.default_llm_model,
temperature=0.5,
max_tokens=settings.llm_max_tokens,
Expand Down
5 changes: 3 additions & 2 deletions src/ad_seller/agents/level2/linear_tv_inventory_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
integration lands)
"""

from crewai import LLM, Agent
from crewai import Agent

from ...config import get_settings
from ...llm import build_llm


def create_linear_tv_inventory_agent() -> Agent:
Expand All @@ -41,7 +42,7 @@ def create_linear_tv_inventory_agent() -> Agent:
"""
settings = get_settings()

llm = LLM(
llm = build_llm(
model=settings.default_llm_model,
temperature=0.5,
max_tokens=settings.llm_max_tokens,
Expand Down
5 changes: 3 additions & 2 deletions src/ad_seller/agents/level2/mobile_app_inventory_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
SDK inventory, rewarded video, interstitials, and in-app bidding.
"""

from crewai import LLM, Agent
from crewai import Agent

from ...config import get_settings
from ...llm import build_llm


def create_mobile_app_inventory_agent() -> Agent:
Expand All @@ -29,7 +30,7 @@ def create_mobile_app_inventory_agent() -> Agent:
"""
settings = get_settings()

llm = LLM(
llm = build_llm(
model=settings.default_llm_model,
temperature=0.5,
max_tokens=settings.llm_max_tokens,
Expand Down
5 changes: 3 additions & 2 deletions src/ad_seller/agents/level2/native_inventory_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
content recommendations, and sponsored content.
"""

from crewai import LLM, Agent
from crewai import Agent

from ...config import get_settings
from ...llm import build_llm


def create_native_inventory_agent() -> Agent:
Expand All @@ -27,7 +28,7 @@ def create_native_inventory_agent() -> Agent:
"""
settings = get_settings()

llm = LLM(
llm = build_llm(
model=settings.default_llm_model,
temperature=0.5,
max_tokens=settings.llm_max_tokens,
Expand Down
5 changes: 3 additions & 2 deletions src/ad_seller/agents/level2/video_inventory_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
and outstream formats.
"""

from crewai import LLM, Agent
from crewai import Agent

from ...config import get_settings
from ...llm import build_llm


def create_video_inventory_agent() -> Agent:
Expand All @@ -26,7 +27,7 @@ def create_video_inventory_agent() -> Agent:
"""
settings = get_settings()

llm = LLM(
llm = build_llm(
model=settings.default_llm_model,
temperature=0.5,
max_tokens=settings.llm_max_tokens,
Expand Down
5 changes: 3 additions & 2 deletions src/ad_seller/agents/level3/audience_validator_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@

from typing import Any

from crewai import LLM, Agent
from crewai import Agent

from ...config import get_settings
from ...llm import build_llm


def create_audience_validator_agent(
Expand Down Expand Up @@ -41,7 +42,7 @@ def create_audience_validator_agent(
"""
settings = get_settings()

llm = LLM(
llm = build_llm(
model=settings.default_llm_model,
temperature=0.2, # Low temperature for accurate validation
max_tokens=settings.llm_max_tokens,
Expand Down
5 changes: 3 additions & 2 deletions src/ad_seller/agents/level3/availability_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
across all inventory types.
"""

from crewai import LLM, Agent
from crewai import Agent

from ...config import get_settings
from ...llm import build_llm


def create_availability_agent() -> Agent:
Expand All @@ -26,7 +27,7 @@ def create_availability_agent() -> Agent:
"""
settings = get_settings()

llm = LLM(
llm = build_llm(
model=settings.default_llm_model,
temperature=0.2, # Low temperature for accurate forecasting
max_tokens=settings.llm_max_tokens,
Expand Down
5 changes: 3 additions & 2 deletions src/ad_seller/agents/level3/pricing_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
pricing based on buyer identity.
"""

from crewai import LLM, Agent
from crewai import Agent

from ...config import get_settings
from ...llm import build_llm


def create_pricing_agent() -> Agent:
Expand All @@ -27,7 +28,7 @@ def create_pricing_agent() -> Agent:
"""
settings = get_settings()

llm = LLM(
llm = build_llm(
model=settings.default_llm_model,
temperature=0.2, # Low temperature for consistent pricing decisions
max_tokens=settings.llm_max_tokens,
Expand Down
5 changes: 3 additions & 2 deletions src/ad_seller/agents/level3/proposal_review_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
and recommends accept/counter/reject decisions.
"""

from crewai import LLM, Agent
from crewai import Agent

from ...config import get_settings
from ...llm import build_llm


def create_proposal_review_agent() -> Agent:
Expand All @@ -27,7 +28,7 @@ def create_proposal_review_agent() -> Agent:
"""
settings = get_settings()

llm = LLM(
llm = build_llm(
model=settings.default_llm_model,
temperature=0.3,
max_tokens=settings.llm_max_tokens,
Expand Down
5 changes: 3 additions & 2 deletions src/ad_seller/agents/level3/upsell_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
and propose alternatives when rejecting proposals.
"""

from crewai import LLM, Agent
from crewai import Agent

from ...config import get_settings
from ...llm import build_llm


def create_upsell_agent() -> Agent:
Expand All @@ -27,7 +28,7 @@ def create_upsell_agent() -> Agent:
"""
settings = get_settings()

llm = LLM(
llm = build_llm(
model=settings.default_llm_model,
temperature=0.6, # Higher temperature for creative suggestions
max_tokens=settings.llm_max_tokens,
Expand Down
Loading
Loading