Conversation
🦋 Changeset detectedLatest commit: 3afda5c The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Greptile SummaryThis PR adds a Key Implementation Details:
Implementation Quality: The implementation is clean and well-architected. Variable substitution uses simple string Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Agent
participant SystemPrompt
participant LLM
participant Tools
participant VariableSubstitution
User->>Agent: execute({variables: {password: {value: "secret123", description: "login password"}}})
Agent->>SystemPrompt: Build prompt with variable descriptions
SystemPrompt-->>LLM: Variables: password (login password)<br/>Use %password% syntax
LLM->>Tools: type("%password%", coordinates)
Tools->>VariableSubstitution: substituteVariables("%password%", variables)
VariableSubstitution-->>Tools: "secret123"
Tools->>Browser: page.type("secret123")
Browser-->>Tools: Success
Note over Tools,LLM: Return original token to LLM
Tools-->>LLM: {success: true, text: "%password%"}
Note over Agent: Cache key uses variable name only
Agent->>Cache: Store with variableKeys: ["password"]
|
There was a problem hiding this comment.
2 issues found across 15 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/core/lib/v3/agent/tools/type.ts">
<violation number="1" location="packages/core/lib/v3/agent/tools/type.ts:58">
P1: Logging `actualText` exposes sensitive values (passwords, API keys) in logs. Since the feature's purpose is to protect sensitive data from exposure, consider logging the original `text` with `%variableName%` tokens instead of the substituted values.</violation>
</file>
<file name="packages/core/lib/v3/agent/prompts/agentSystemPrompt.ts">
<violation number="1" location="packages/core/lib/v3/agent/prompts/agentSystemPrompt.ts:221">
P2: Variable descriptions are interpolated into the XML prompt without escaping/CDATA, so descriptions containing XML characters can break the prompt or allow injection. Escape or wrap descriptions before insertion.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
pirate
left a comment
There was a problem hiding this comment.
We should extend act to support this better variables format, and then use the same format for both.
The type could be {value: string | {description: string, value: string}}
I really dont want to introduce different shapes on different endpoints. Every bit of drift between the shapes that Agent accepts and the shapes the other endpoints accept is a source of confusion for users.
Why
Users need a way to pass sensitive data (passwords, API keys, personal info) to agent executions without exposing the actual values to the LLM. This also enables reusable agent scripts where variable values can change without invalidating cached executions.
Usage
What Changed
variablesoption toagent.execute()acceptingRecord<string, { value: string | number | boolean; description: string }>%variableName%syntax in tool callsact,type,fillForm, andfillFormVisiontoolsexperimental: true, not supported in CUA modeagent/utils/variables.tsTest Plan
%variableName%syntax in tool callsvariablesused withoutexperimental: truevariablesused with CUA modeSummary by cubic
Add first-class variables to agent.execute so agents can use named sensitive values without exposing them to the LLM. Cache now keys on variable names, so changing values doesn't invalidate cached runs.
Written for commit 3afda5c. Summary will update on new commits.