Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support referencing agent variables in agent tool form parameters #13166

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

obadakhalili
Copy link
Contributor

Summary

depends on #13165.

this PR proposes a change to support referencing agent variables in tool form parameters. the full context behind this work is explained here: #13080.

Screenshots

image image

Checklist

Important

Please review the checklist below before submitting your pull request.

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • [] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 3, 2025
@dosubot dosubot bot added 🔨 feat:tools Tools for agent, function call related stuff. 🤖 feat:agent Agent related topics labels Feb 3, 2025
@crazywoola crazywoola requested a review from laipz8200 February 4, 2025 01:15
Copy link
Member

@crazywoola crazywoola left a comment

Choose a reason for hiding this comment

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

It seems some changes already included in #13165, please remove those in this PR to make sure only related code is changed.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Feb 4, 2025
app_id: str,
agent_tool: AgentToolEntity,
variables_inputs: Optional[Mapping[str, Any]] = None,
invoke_from: InvokeFrom = InvokeFrom.DEBUGGER,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm a bit skeptical of defining variables_inputs here, because this method is used in contexts where variables_inputs isn't available.

@@ -102,6 +102,7 @@ export type FormShowOnObject = {

export type CredentialFormSchemaBase = {
variable: string
inputs?: Array<{ name: string; value: string }>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

to render a form with an input that accepts variables, the schema is changed to accept inputs property, variables might be a better name, but it is confusing next to variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 feat:agent Agent related topics 🔨 feat:tools Tools for agent, function call related stuff. size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants