# car-external-agents

Detection of installed agentic CLIs — Claude Code, Codex, Gemini —
so CAR can treat them as agents the user can dispatch tasks to,
sharing their existing subscription auth instead of forcing the user
to register an API key.

This crate is the **discovery side** of the third kind of agent in
CAR's taxonomy, sibling to `car-registry::supervisor` (lifecycle
agents) and `car_multi::AgentRunner` (in-process runners). External
agents are caller-installed CLIs spawned per task — the daemon
discovers them but does not own their lifecycle.

See `docs/proposals/external-agent-detection.md` for the
architectural rationale and phasing.

## Phase 1 (this crate today)

- `detect()` — scan `$PATH` for known adapter binaries, probe
  version + auth state, return a stable `ExternalAgentSpec` list.
- Per-tool adapters are static descriptors (binary name,
  capabilities, auth heuristic). Adding a fourth adapter is a
  ~50-line file under `src/adapters/`.

Phase 2 (next) adds the per-task adapter that speaks each tool's
JSON stdio protocol natively in Rust, exposed as `agents.invoke_external`.

## What this is not

- Not a model provider — the SDKs are agents (own planning loop,
  tool use, sessions), not `generate()` calls. Modeling them as
  `ProtocolHandler` would be the wrong abstraction.
- Not a lifecycle supervisor — external agents are spawned per
  task, not kept running. `car-registry::supervisor` handles
  long-lived services.
- Not a credential reader — auth-kind probing inspects credential
  file *shape* only. We never read credential values.
