Repository navigation
feat(agentstudio): accept --file for JSON payloads - #291
cmarguta-alg wants to merge 1 commit into
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 21 |
| Duplication | 49 |
TIP This summary will be updated as you push new changes.
|
Status: 🟢 pass · 🔴 fail · 🟡 inconclusive Personal QA Agent — #291 (
|
| Entity | SDK type | Fields |
|---|---|---|
| Agent create | AgentConfigCreate |
name, description, providerId, model, instructions, systemPrompt, templateType, config, tools |
| Agent update | AgentConfigUpdate |
same, nullable |
| Provider create | ProviderAuthenticationCreate |
name, providerName, input |
Provider input |
ProviderInput oneOf |
openai/anthropic/xai: apiKey+baseUrl; azure: apiKey+azureEndpoint+azureDeployment+apiVersion; openai_compatible: apiKey+baseUrl+defaultModel; google_genai/deepseek: apiKey |
| Provider update | ProviderAuthenticationPatch |
name and/or input |
| Tools | ToolConfigInput |
algolia_search_index, client_side, mcp_tools, algolia_recommend |
Round-trip (unmarshal → marshal, same path as --file) and live API:
| Payload | Status | Notes |
|---|---|---|
| Agent: name, description, instructions, systemPrompt, templateType, config, tools | 🟢 | Live: description/systemPrompt/config/templateType persisted. Tools: client_side, algolia_search_index, mcp_tools, algolia_recommend all stored |
Provider openai/anthropic/xai apiKey (+ optional baseUrl) |
🟢 round-trip | Live create 🟡 dummy key → API 422 Invalid API key provided. File reached the API |
Provider azure_openai extra input |
🔴 | File/json azureEndpoint+azureDeployment+apiVersion marshal down to {"apiKey":"…"} only. Live 422 body.azureEndpoint: Field required |
Provider openai_compatible defaultModel |
🔴 | Round-trip drops defaultModel. Live 422 body.defaultModel: Field required |
Cause: generated ProviderInput.UnmarshalJSON fills several oneOf variants at once; MarshalJSON emits Anthropic first, which only has apiKey/baseUrl. --file is not a thinner DTO — it is this SDK type.
Preferred CLI fix: send the file/--json bytes as the request body instead of round-tripping through ProviderAuthenticationCreate / ProviderInput. Validation of name / providerName / input present can stay.
Results
| Check | Status | Notes |
|---|---|---|
task build |
🟢 | |
go test ./pkg/cmdutil ./pkg/cmd/agents/create,update ./pkg/cmd/providers/create,update -count=1 |
🟢 | |
Help documents --file / -f beside --json |
🟢 | agents+providers create/update |
Scenario 1 agents create --file |
🟢 | cli-file-agent id 0b3baef5-… |
Scenario 1 agents create --file - (stdin) |
🟢 | id 353e4820-… |
Scenario 2 providers create --file with dummy key |
🟡 | 422 Invalid API key (same as #290). No live update |
Scenario 3 --json + --file |
🟢 | --json cannot be combined with --file |
Scenario 3 --file + --name |
🟢 | agents and providers |
| Missing file | 🟢 | reading file: open … no such file |
| Invalid JSON file | 🟢 | parsing agent JSON |
Agent update --file (description, instructions, systemPrompt, config, tools) |
🟢 | |
Flag-only agent create (--name + --instructions) |
🟢 | still limited to those two fields; full surface is --file/--json only, as designed |
Notes (not extra 🔴)
allowUnlistedIndices: trueon a search tool 422 unlessmodeisdynamic— API validation; CLI sent the field.- MCP
transport: "sse"422; acceptedstreamable_http. - Recommend tool without
modelName: SDK injects""and API 422. WithmodelName: "related-products"it stored. --jsonhas the same azure / openai_compatible drop (confirmed live).
— Personal QA Agent
9af388a to
aedbc84
Compare
Let create/update take a JSON file or stdin in addition to inline --json so large or secret-bearing bodies do not have to live on the argv. Co-authored-by: Cursor <cursoragent@cursor.com>
aedbc84 to
e52dbcb
Compare
🤔 What
Adds
--file/-f(and-for stdin) next to inline--jsonon Agent Studio create/update commands that take a JSON payload.🤷 Why
#290 ships providers create/update with
--jsononly. Large payloads and API keys are awkward on argv.--fileis an additional source, not a replacement.🔍 How
agentstudio agents create/updateandagentstudio providers create/updateaccept--file/-f.cmdutil.JSONPayloadreads--jsonor--file(including-via existingReadFile).--jsonand--filecannot be combined with each other or with name/instructions flags.--jsonstill works. File contents are trimmed; parsing errors stayparsing agent JSON/parsing provider JSON.🧪 Testing
Stacked on #290. Merge #289, #288, then #290 first, or check out this branch which includes them.
Writes need
editSettings(admin keys skip the CLI ACL check). Replace<APP_ID>with an Agent Studio app. Pass--application-idif the selected profile app does not resolve. Do not commit files that contain real API keys.Quick checks
task build go test ./pkg/cmdutil ./pkg/cmd/agents/create ./pkg/cmd/agents/update ./pkg/cmd/providers/create ./pkg/cmd/providers/update -count=1 ./algolia agentstudio agents create --help ./algolia agentstudio providers create --helpExpect tests green and
--filedocumented beside--json.Scenario 1 — agents create from file
Action: write a payload file, create an agent from it, then from stdin.
Expectation: both commands return JSON with a new
idand the givenname/instructions.Scenario 2 — providers create/update from file
Action: create a provider from a file, then patch
inputfrom a file.Expectation: create returns an
idwithproviderName: "openai". Update exits 0.providerNameis unchanged.Scenario 3 — exclusive flags (failure mode)
Action: pass
--jsonand--filetogether, then--filewith--name.Expectation: each command errors.
--jsoncannot be combined with--file.--jsonand--filecannot be combined with--name(or--instructionson agents).lw-oct-agent-studio-3).Made with Cursor