# OpenRouter and actual CrewAI service

Set `AGENT_BACKEND=demo` for scripted examples. Live OpenRouter uses `AGENT_BACKEND=openrouter`, `OPENROUTER_API_KEY`, and `OPENROUTER_MODEL` (the exact model identifier from your account). It streams Chat Completions with validated function tools. Select a model/provider supporting the required tool parameters; image support depends on that model.

For CrewAI set the Next.js server's `AGENT_BACKEND=crewai`, `CREWAI_SERVICE_URL=http://127.0.0.1:8008`, and `CREWAI_SERVICE_TOKEN`. Start the private Python service with the same token and its own server-side `OPENROUTER_API_KEY` / `OPENROUTER_MODEL`:

```sh
cd services/commerce-crew
uv sync --locked --python 3.13
uv run uvicorn app:app --host 127.0.0.1 --port 8008
uv run python -m unittest test_crew.py
```

Provide credentials through your environment; never commit keys. Python 3.13 is pinned because this CrewAI version does not support 3.14. The service runs an actual sequential Crew: commerce advisor then response/UI reviewer, with validated Pydantic output. Each request is isolated, bounded, and canceled by terminating its worker when the client disconnects.

Two workers can run at once; telemetry and implicit embedding memory are disabled. The current Crew route is text-only and explicitly rejects images. It waits for the validated final result before presenting separate messages and cards. Live key/model availability and reasoning quality have not been verified with paid requests.

Mock tests execute a real Crew with a stub model. Use HTTPS for a remote private service. Missing settings or provider failures surface as errors, never silent demo replies.