Skip to content

Conversation

@mmabrouk
Copy link
Member

Summary

Add support for variant_slug and variant_version in the request body for the config middleware.

Changes

  • Add body.get('variant_slug') to variant reference parsing
  • Add body.get('variant_version') to variant version parsing
  • Convert variant_version to string since JSON integers need conversion to match the Reference model

Why

Previously, variant_slug only worked via query params or the legacy config body param. This was inconsistent with how environment params work (which support body params).

Now variant_slug and variant_version work directly in the request body:

{
  "app": "my-app",
  "variant_slug": "my-variant",
  "variant_version": 2,
  "inputs": {...}
}

- Add body.get('variant_slug') to variant reference parsing
- Add body.get('variant_version') to variant version parsing
- Convert variant_version to string since JSON integers need conversion
- This makes variant params consistent with how environment params work

Previously, variant_slug only worked via query params or the legacy 'config'
body param. Now 'variant_slug' and 'variant_version' work directly in the
request body, matching the pattern used for 'environment'.
Variant Use API drawer:
- Add 'Invoke LLM' code snippets to VariantUseApiContent, matching the
  deployment drawer functionality
- Use variant_slug and variant_version in request body params
- Reuse LanguageCodeBlock component for consistent UI

Code snippet fixes:
- Fix fetch_variant snippets to use dynamic URL instead of hardcoded
  cloud.agenta.ai
- Fix Authorization header from 'Bearer' to 'ApiKey' for consistency
- Remove inline comments from all snippets (curl, python, typescript)
  that were breaking copy-paste functionality
- Ensure all generated snippets are directly pastable into terminal/editor
@vercel
Copy link

vercel bot commented Dec 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Dec 31, 2025 3:30pm

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Dec 30, 2025
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In new workflows, there will be a proper place to send references.
In legacy applications, I'd discourage from sending agenta-related information via the body other than ag_config. But since this interface is not meant to live for long, I don't mind.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we use the same interface for the environment, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is how it looks like for environment

# Add your API key to the Authorization header
curl -X POST "https://cloud.agenta.ai/services/completion/run" \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey V7CDlfpn.4a28e99bf7ef0cc9ebb4692ba9039de74d71ce67138ec411f70cc2651d5bbaf9" \
-d '{
  "environment": "development",
  "app": "prompt"
}'

@ashrafchowdury ashrafchowdury changed the base branch from main to release/v0.72.4 December 31, 2025 11:03
feat(web): add Invoke LLM snippets for variants & fix code snippets
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Dec 31, 2025
@ashrafchowdury ashrafchowdury merged commit c3eb5b5 into release/v0.72.4 Dec 31, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature SDK size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants