Skip to content

feat(dgw): add an AI client crate for session action descriptions - #2005

Draft
irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 1 commit into
feat/jrec-manifest-logsfrom
feat/ai-crate
Draft

irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 1 commit into
feat/jrec-manifest-logsfrom
feat/ai-crate

Conversation

@irvingoujAtDevolution

@irvingoujAtDevolution irvingouj@Devolutions (irvingoujAtDevolution) commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Adds devolutions-gateway-ai, a small crate Gateway uses to ask an AI provider what a user did in a session.

let ai = AiClient::builder().provider(Provider::Anthropic).model("…").api_key(key).http_client(client).build()?;
let actions = ai.describe_session_actions(text).send().await?;

It calls the providers' HTTP APIs directly with the caller's reqwest client (so Gateway's proxy and TLS policy apply), no AI framework and no new crate in Cargo.lock:

  • OpenAI chat completions: OpenAI, Mistral, any OpenAI-compatible endpoint
  • Anthropic Messages

The prompt lives in the crate (PROMPT_VERSION), the key is a SecretString and gets redacted from errors, error reasons never quote the answer. Nothing calls it yet; the first caller is #2008.

Tested: crate tests 12/12, mock-provider HTTP tests (gateway_ai) 11/11 (paths, auth headers, token fields, error redaction).

Stacked on #2003.

🤖 Generated with Claude Code

`devolutions-gateway-ai` asks a model which actions a user performed in a
session transcript and parses its JSON Lines answer into typed actions.

It talks to the providers' HTTP APIs directly, with the workspace reqwest
client passed by the caller (so Gateway's proxy and TLS policy apply):
OpenAI chat completions (OpenAI, Mistral, any OpenAI-compatible endpoint)
and Anthropic Messages. Only the fields of a single text completion are
modeled, so there is no AI framework dependency and no new crate in the
lockfile. The API key is redacted from every error.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant