feat: Set up backend for in-component config assistant#3955
feat: Set up backend for in-component config assistant#3955re-pixel wants to merge 9 commits intosuperplanehq:mainfrom
Conversation
…llm assistance Signed-off-by: re-pixel <relja.brdar@gmail.com>
Signed-off-by: re-pixel <relja.brdar@gmail.com>
|
👋 Commands for maintainers:
|
| produces: "application/json"; | ||
| }; | ||
|
|
||
| service ConfigAssistant { |
There was a problem hiding this comment.
This shouldn't be a separate proto. It should be in agents.proto.
Maybe we can have an API like this:
/api/v1/agents/builder/* => the existing API in agents.proto
/api/v1/agents/config/* => new API for configuration suggestions
…ig assistant scopedJWTs Signed-off-by: re-pixel <relja.brdar@gmail.com>
…r chats moved from /api/v1/agents/chats to /api/v1/agents/builder/chats, new endpoint for config assistant is /api/v1/agents/config/suggest-field Signed-off-by: re-pixel <relja.brdar@gmail.com>
Signed-off-by: re-pixel <relja.brdar@gmail.com>
…imilar to the builder agent browser -> go API -> browser -> agent HTTP -> browser Signed-off-by: re-pixel <relja.brdar@gmail.com>
Signed-off-by: re-pixel <relja.brdar@gmail.com>
Signed-off-by: re-pixel <relja.brdar@gmail.com>
|
@re-pixel @shiroyasha am I reading this right that there's no SSE streaming here? If that's the case, I don't think we need the "generate token and redirect to agent HTTP endpoint", right? We could have an internal agent gRPC endpoint that the public agent API calls for this |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 224a5eb. Configure here.
| node_id=payload.node_id.strip(), | ||
| ) | ||
|
|
||
| agent = build_config_assistant_agent(model=model_name) |
There was a problem hiding this comment.
Agent and prompt rebuilt from disk every request
Low Severity
build_config_assistant_agent is called on every request, which internally calls load_system_prompt() that reads system_prompt.txt from disk each time. The model name and system prompt are stable across requests, so the agent could be constructed once at router-build time (or lazily cached) rather than re-created per request.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 224a5eb. Configure here.


Inline config assistant — backend
Summary
This PR implements the backend for the inline configuration assistant described in docs/prd/inline-config-assistant.md: a stateless, one-shot suggest API that forwards to a dedicated Python path (no AI Builder tool loop, no shared
agent.pyorchestration for this route).Scope: Go public API + gRPC service, authorization, scoped JWT minting, HTTP forward to the agent, and the agent-side FastAPI route + PydanticAI suggest flow. No workflow UI in this PR (PRD client wiring in
lib/configAssistantSuggest.ts/useConfigAssistantSuggestremains a follow-up).End-to-end flow (updated)
POST /api/v1/agents/config/prepare-suggestwith session auth (or user API token) and org context (x-organization-id), same as other org APIs. Body:canvasIdonly.Agents.PrepareConfigAssistantSuggest.pkg/authorization/interceptor.go): user must havecanvases:updateon the canvas referenced bycanvas_id(same bar as editing the workflow).pkg/grpc/actions/configassistant/prepare.go):canvas_id, resolves org/canvas.canvases:read:<canvas_id>) so the agent can validate the token without builder-only semantics.purpose: config-assistant(distinct fromagent-builder).tokenandsuggestUrl={AGENT_HTTP_URL}/config-assistant/suggest(no server-side forward).POST**s tosuggestUrlwithAuthorization: Bearer <token>and JSON bodycanvas_id,node_id,instruction,field_context_json(snake_case; matches PythonSuggestHTTPRequest).agent/src/config_assistant/router.py): unchanged behavior — validate JWT purpose, validate canvas scope, one-shot PydanticAI, structuredvalue+ optionalexplanation.From the product perspective the UI can still expose one “Generate” action; under the hood that is two HTTP requests, encapsulated by
runConfigAssistantSuggestinweb_src/src/lib/configAssistantSuggest.ts.JWT purposes
config-assistantandagent-builderare both allowed by the shared Python validator (agent/src/ai/jwt.py), but the config-assistant route requirespurpose == config-assistantso tokens are not interchangeable (PRD acceptance criteria).Alignment with AI Builder (org “AI off”)
AgentModeEnabledon suggest. We can add a shared server-side gate for both Builder and suggest in a follow-up if product wants strict PRD alignment.Configuration
AGENT_HTTP_URLsuggestUrlreturned to the client (e.g.http://localhost:8090when the agent port is published on the host).JWT_SECRETCONFIG_ASSISTANT_AI_MODEL/AI_MODEL/ANTHROPIC_API_KEYagent/.env.example).Removed:
CONFIG_ASSISTANT_HTTP_URL(no longer used).Testing
make test.agent.unit— JWT and config-assistant agent tests (unchanged).go test ./pkg/grpc/actions/configassistant/...— URL builder unit tests (prepare_test.go).POST …/prepare-suggestwith{ "canvasId": "…" }; (2)POSTreturnedsuggestUrlwithAuthorization: Bearer <token>and snake_case suggest body.