Skip to content

Setup Guide

Get Rover Agent Python running in minutes.

Install these tools before starting:

  • Python 3.11 or later: Check your version with python --version
  • uv package manager: Fast Python package installer (install guide)

Install uv:

Terminal window
curl -LsSf https://astral.sh/uv/install.sh | sh

Verify installation:

Terminal window
uv --version

Clone and set up the project:

Terminal window
# 1. Clone the repository
git clone <repository-url>
cd consumer-agent
# 2. Install dependencies
uv sync
# 3. Install development tools (optional)
uv sync --dev
# 4. Activate the virtual environment
source .venv/bin/activate

The uv sync command creates a virtual environment in .venv/ and installs all dependencies from pyproject.toml.

Create a .env file in the project root. This file stores API keys and configuration.

Copy the example file:

Terminal window
cp .env.example .env

Edit .env with your credentials:

Terminal window
# OpenAI Configuration (Required)
OPENAI_API_KEY=sk-your-openai-api-key-here
# Rover MCP Configuration (Optional - only if using MCP tools)
ROVER_MCP_AUTHORIZATION=your-mcp-auth-token-here
# ROVER_MCP_SERVER_URL=http://localhost:8000/mcp # Override default from settings.yaml
# History Configuration (Optional - for local DynamoDB/S3 testing)
# HISTORY_TABLE_NAME=local-consumer-agent-history
# HISTORY_S3_BUCKET=local-bucket

Environment Variables Loaded into Configuration:

These environment variables are automatically loaded into Dynaconf configuration groups:

VariableLoaded IntoDescription
OPENAI_API_KEYagent_config.openai.api_keyOpenAI API authentication
ROVER_MCP_AUTHORIZATIONsettings.rover_mcp.authorizationRover MCP tool server auth token
ROVER_MCP_SERVER_URLsettings.rover_mcp.server_urlRover MCP server endpoint
HISTORY_TABLE_NAMEsettings.history.table_nameDynamoDB table name
HISTORY_S3_BUCKETsettings.history.s3_bucketS3 bucket name
  1. Go to platform.openai.com/api-keys
  2. Click “Create new secret key”
  3. Copy the key (starts with sk-)
  4. Add to .env:
    Terminal window
    OPENAI_API_KEY=sk-your-key-here

MCP enables the agent to use external tools. Skip this if you don’t need tool execution.

Terminal window
# 1. Login to AWS SSO
aws sso login --profile stage-services-admin
# 2. Retrieve token from Secrets Manager
aws secretsmanager get-secret-value \
--secret-id rover-mcp/auth-tokens \
--profile stage-services-admin \
--query SecretString \
--output text

Add the token to .env:

Terminal window
ROVER_MCP_AUTHORIZATION=your-token-here

Edit agent_config.yaml to customize the agent.

Default configuration:

openai:
model: gpt-5-mini
base_url: https://api.openai.com/v1
max_output_tokens: 2000
reasoning_effort: low
text_verbosity: low
timeout: 90
use_responses_api: true
rover_mcp:
server_url: https://stage-partners-gateway.fetchrewards.com/rover-mcp
timeout: 90.0

GPT-5 series models use reasoning parameters:

  • reasoning_effort: low, medium, high (controls reasoning depth)
  • text_verbosity: low, high (controls response length)
  • max_output_tokens: Token limit (default: 2000)

Do not use temperature, top_p, or frequency_penalty with reasoning models. The config system rejects these parameters.

MCP is optional. Remove the rover_mcp: section if you don’t need external tools.

Required when using MCP:

  • server_url: Rover MCP server endpoint
  • timeout: Request timeout in seconds
  • ROVER_MCP_AUTHORIZATION in .env

The evaluation section in agent_config.yaml provides user context for evaluation runs, ensuring parity with API and CLI behavior:

  • user_id: User ID for MCP tool calls during evaluation
  • latitude/longitude: Location context for offers
  • locale: Language preference (en, es-419)
  • enabled_components: Which prompt components to enable (null = all)

See agent_config.yaml for current configuration.

Test the setup:

Terminal window
# 1. Check CLI is installed
consumer-agent --help
# 2. Verify environment variables
python -c "from consumer_agent.config import agent_config; print('Config loaded')"
# 3. Run tests
pytest

Expected output:

consumer-agent --help
Usage: consumer-agent [OPTIONS] COMMAND [ARGS]...
Options:
--version Show the version and exit.
--help Show this message and exit.
Commands:
chat Start interactive chat with Rover agent

Interactive chat interface:

Terminal window
consumer-agent chat

Features:

  • Real-time streaming responses
  • Conversation history
  • Command shortcuts

Run as a web service:

Terminal window
uvicorn consumer_agent.api.main:app --reload --port 8000

Test the API:

Terminal window
curl -X POST http://localhost:8000/agent/stream \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": "Hello"}],
"agent_id": "conversational",
"enabled_components": []
}'

API endpoints:

  • GET /health - Health check
  • POST /agent/stream - Streaming chat responses

Error: OPENAI_API_KEY environment variable is required

Section titled “Error: OPENAI_API_KEY environment variable is required”

The .env file is missing or the API key is not set.

Fix:

Terminal window
# Check if .env exists
ls -la .env
# If missing, create it
cp .env.example .env
# Edit .env and add your OpenAI API key

Error: openai.use_responses_api missing in agent_config.yaml

Section titled “Error: openai.use_responses_api missing in agent_config.yaml”

The configuration file is outdated.

Fix:

# Add to agent_config.yaml under openai:
use_responses_api: true

Error: ModuleNotFoundError: No module named 'consumer_agent'

Section titled “Error: ModuleNotFoundError: No module named 'consumer_agent'”

Virtual environment is not activated or dependencies are not installed.

Fix:

Terminal window
# Install dependencies
uv sync
# Activate virtual environment
source .venv/bin/activate

The MCP server is unreachable or the auth token is invalid.

Check:

  1. Verify ROVER_MCP_AUTHORIZATION in .env
  2. Test server connection: curl -H "Authorization: Bearer $ROVER_MCP_AUTHORIZATION" <server_url>/health
  3. Increase timeout in settings.yaml: rover_mcp.timeout: 120

The test environment is missing the OpenAI API key.

Fix - add to .env:

Terminal window
OPENAI_API_KEY=test-key-for-unit-tests

Or set environment variable directly:

Terminal window
export OPENAI_API_KEY=test-key-for-unit-tests