feat(frontend): reference a workflow as an agent tool (type:"reference")#4877
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (9)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds workflow-reference tool support to DrillIn. New types define the bridge and payload shapes, OSS provider code supplies workflow revision and environment data, and the UI now lets users pick, add, list, and render reference-type tools. ChangesWorkflow Reference Tool Feature
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
7162a4d to
4bb6f16
Compare
58f2737 to
dd0bfa8
Compare
dd0bfa8 to
80ee74c
Compare
|
Reworked the FE onto the new #4860 schema ( Took over this branch (thanks @ardaerzin) and rebuilt the frontend on top of #4860's new commit Each FE task from
Judgment call — please confirm: I did not carry over the marker-era Lexical What I need from review:
Notes for the maintainer:
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
Author a workflow reference as a type:"reference" tool (the @ag.reference
marker is dropped). The tool selector's "Reference a workflow" drawer now
picks an axis (variant or environment), a workflow slug, and either a pinned
version (variant axis) or an environment, emitting ReferenceToolConfig
{ref_by, slug, version?, environment?, name, description, input_schema}.
Removes the marker-era @-mention editor plugin; embed stays backend-only and
out of the tool UI.
Claude-Session: https://claude.ai/code/session_01GYo3UEfvsZpncagqb28Mbc
There was a problem hiding this comment.
Actionable comments posted: 8
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f7bfbcb1-5a84-47d6-9e57-b38d84524140
📒 Files selected for processing (10)
web/oss/src/components/DrillInView/OSSdrillInUIProvider.tsxweb/packages/agenta-entity-ui/src/DrillInView/SchemaControls/AgentConfigControl.tsxweb/packages/agenta-entity-ui/src/DrillInView/SchemaControls/ToolItemControl.tsxweb/packages/agenta-entity-ui/src/DrillInView/SchemaControls/ToolSelectorPopover.tsxweb/packages/agenta-entity-ui/src/DrillInView/SchemaControls/WorkflowReferenceSelector.tsxweb/packages/agenta-entity-ui/src/DrillInView/index.tsweb/packages/agenta-ui/src/drill-in/context.tsweb/packages/agenta-ui/src/drill-in/context/DrillInUIContext.tsxweb/packages/agenta-ui/src/drill-in/context/index.tsweb/packages/agenta-ui/src/drill-in/index.ts
| ...revisions.map((r) => ({ | ||
| label: r.label ? `v${r.version} — ${r.label}` : `v${r.version}`, | ||
| value: r.version, | ||
| })), |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Reflow this option label so the web checks pass.
This is the formatter error currently failing the TypeScript lint/format jobs for this file. As per coding guidelines, "Frontend changes require running pnpm lint-fix within the web folder before committing."
🧰 Tools
🪛 GitHub Actions: 11 - check code styling / 2_TypeScript lint.txt
[error] 194-194: prettier/prettier error: Replace formatting around template string. (Rule: prettier/prettier)
🪛 GitHub Actions: 11 - check code styling / TypeScript lint
[error] 194-194: Prettier formatting failed (eslint plugin). Rule: prettier/prettier. Replace ·?·v${r.version}·—·${r.label} with a properly line-broken template string.
🪛 GitHub Check: TypeScript lint
[failure] 194-194:
Replace ·?·v${r.version}·—·${r.label}`` with ⏎············································?·v${r.version}·—·${r.label}`⏎···········································`
Sources: Coding guidelines, Linters/SAST tools, Pipeline failures
| /** Resolve the referenced workflow's input JSON-schema to pre-fill the tool's `input_schema`. | ||
| * Returns null when unavailable; the caller falls back to an empty object schema. */ | ||
| resolveInputSchema: (workflow: WorkflowReferenceUI) => Promise<Record<string, unknown> | null> |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Thread the selected reference target into resolveInputSchema.
This contract only passes the workflow identity, but downstream the tool payload can also pin a version or bind to an environment. As written, a reference to an older revision or environment-specific deployment can only resolve the schema for the workflow’s default/latest revision, so the emitted input_schema can drift from the actual referenced target.
Suggested contract change
- resolveInputSchema: (workflow: WorkflowReferenceUI) => Promise<Record<string, unknown> | null>
+ resolveInputSchema: (
+ workflow: WorkflowReferenceUI,
+ selection: Pick<WorkflowReferencePayload, "refBy" | "version" | "environment">
+ ) => Promise<Record<string, unknown> | null>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /** Resolve the referenced workflow's input JSON-schema to pre-fill the tool's `input_schema`. | |
| * Returns null when unavailable; the caller falls back to an empty object schema. */ | |
| resolveInputSchema: (workflow: WorkflowReferenceUI) => Promise<Record<string, unknown> | null> | |
| /** Resolve the referenced workflow's input JSON-schema to pre-fill the tool's `input_schema`. | |
| * Returns null when unavailable; the caller falls back to an empty object schema. */ | |
| resolveInputSchema: ( | |
| workflow: WorkflowReferenceUI, | |
| selection: Pick<WorkflowReferencePayload, "refBy" | "version" | "environment"> | |
| ) => Promise<Record<string, unknown> | null> |
| type WorkflowReferenceBridge, | ||
| type WorkflowReferenceUI, | ||
| type WorkflowRevisionUI, | ||
| type WorkflowEnvironmentUI, | ||
| type WorkflowReferencePayload, |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Please rerun the required web autofix/format step before merge.
This frontend change set is still failing the TypeScript formatting check in CI. Please run pnpm lint-fix in web and commit the resulting formatting updates. As per coding guidelines, "Frontend changes require running pnpm lint-fix within the web folder before committing".
Sources: Coding guidelines, Pipeline failures
af95f27 to
63318ac
Compare
80ee74c to
20f6636
Compare
- reset axis state (refBy/version/environment) when the chosen workflow changes - gate the workflow list empty-state on not-loading (real workflowsLoading) - read fresh config after the async schema lookup so concurrent edits aren't clobbered - store the workflow display name (not the slug) on the reference tool - dedupe references by type:"reference" slug only, never gateway function names - prettier-format the version-option label
|
🤖 The AI agent says: Addressed the CodeRabbit review on this PR plus the failing TypeScript format + lint check. Failing required check (format + lint)Fixed. CodeRabbit findings
Gates
|
|
🤖 The AI agent says: re-requesting a review now that the review feedback and the format/lint failure are addressed. @coderabbitai review |
|
✅ Action performedReview finished.
|
Context
An agent's
toolscould not be authored as a workflow. Backend PR #4860 added the@ag.referencesyntax: a tool that points at a stored workflow, which Agenta runs server-side as a callback. This is the frontend for it.Changes
A workflow can be referenced as a tool two ways:
+that opens a searchable workflow-picker drawer. Picking one adds the reference tool with the workflow's input schema.@-mentions in the instructions editor: a typeahead inserts a reference chip and registers the tool (dedup-guarded). Hovering a chip shows a read-only details card.Reference tools render with a workflow icon and are classified distinctly from builtin/gateway/code tools.
The
tools[]entry the FE emits:Notes
tscandeslintclean across@agenta/uiand@agenta/entity-ui.big-agentsonce [feat] Reference a workflow as an agent tool (type:"reference") #4860 merges.What to QA
+that opens a drawer; pick a workflow; it shows up as a workflow tool.@and pick a workflow. A chip inserts and the tool is added. Picking one already added does not duplicate it.