tinybird 0.0.1.dev269__tar.gz → 0.0.1.dev270__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of tinybird might be problematic. Click here for more details.

Files changed (146) hide show
  1. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/PKG-INFO +1 -1
  2. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/__cli__.py +2 -2
  3. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/agent.py +19 -1
  4. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/prompts.py +104 -21
  5. tinybird-0.0.1.dev270/tinybird/tb/modules/agent/tools/secret.py +113 -0
  6. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/utils.py +1 -0
  7. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/project.py +21 -0
  8. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird.egg-info/PKG-INFO +1 -1
  9. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird.egg-info/SOURCES.txt +1 -0
  10. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/setup.cfg +0 -0
  11. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/__cli__.py +0 -0
  12. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/ch_utils/constants.py +0 -0
  13. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/ch_utils/engine.py +0 -0
  14. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/check_pypi.py +0 -0
  15. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/client.py +0 -0
  16. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/config.py +0 -0
  17. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/connectors.py +0 -0
  18. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/context.py +0 -0
  19. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/datafile/common.py +0 -0
  20. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/datafile/exceptions.py +0 -0
  21. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/datafile/parse_connection.py +0 -0
  22. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/datafile/parse_datasource.py +0 -0
  23. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/datafile/parse_pipe.py +0 -0
  24. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/datatypes.py +0 -0
  25. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/feedback_manager.py +0 -0
  26. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/git_settings.py +0 -0
  27. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/prompts.py +0 -0
  28. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/sql.py +0 -0
  29. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/sql_template.py +0 -0
  30. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/sql_template_fmt.py +0 -0
  31. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/sql_toolset.py +0 -0
  32. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/syncasync.py +0 -0
  33. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/check_pypi.py +0 -0
  34. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/cli.py +0 -0
  35. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/client.py +0 -0
  36. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/config.py +0 -0
  37. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/__init__.py +0 -0
  38. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/animations.py +0 -0
  39. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/banner.py +0 -0
  40. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/command_agent.py +0 -0
  41. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/compactor.py +0 -0
  42. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/explore_agent.py +0 -0
  43. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/memory.py +0 -0
  44. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/models.py +0 -0
  45. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/testing_agent.py +0 -0
  46. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/tools/__init__.py +0 -0
  47. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/tools/analyze.py +0 -0
  48. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/tools/append.py +0 -0
  49. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/tools/build.py +0 -0
  50. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/tools/create_datafile.py +0 -0
  51. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/tools/deploy.py +0 -0
  52. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/tools/deploy_check.py +0 -0
  53. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/tools/diff_resource.py +0 -0
  54. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/tools/execute_query.py +0 -0
  55. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/tools/get_endpoint_stats.py +0 -0
  56. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/tools/get_openapi_definition.py +0 -0
  57. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/tools/mock.py +0 -0
  58. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/tools/plan.py +0 -0
  59. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/tools/request_endpoint.py +0 -0
  60. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/tools/run_command.py +0 -0
  61. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/agent/tools/test.py +0 -0
  62. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/build.py +0 -0
  63. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/build_common.py +0 -0
  64. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/cicd.py +0 -0
  65. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/cli.py +0 -0
  66. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/common.py +0 -0
  67. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/config.py +0 -0
  68. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/connection.py +0 -0
  69. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/copy.py +0 -0
  70. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/create.py +0 -0
  71. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/datafile/build.py +0 -0
  72. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/datafile/build_common.py +0 -0
  73. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
  74. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
  75. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/datafile/diff.py +0 -0
  76. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/datafile/fixture.py +0 -0
  77. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/datafile/format_common.py +0 -0
  78. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
  79. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
  80. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
  81. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/datafile/playground.py +0 -0
  82. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/datafile/pull.py +0 -0
  83. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/datasource.py +0 -0
  84. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/deployment.py +0 -0
  85. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/deployment_common.py +0 -0
  86. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/deprecations.py +0 -0
  87. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/dev_server.py +0 -0
  88. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/endpoint.py +0 -0
  89. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/exceptions.py +0 -0
  90. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/feedback_manager.py +0 -0
  91. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/info.py +0 -0
  92. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/infra.py +0 -0
  93. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/job.py +0 -0
  94. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/llm.py +0 -0
  95. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/llm_utils.py +0 -0
  96. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/local.py +0 -0
  97. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/local_common.py +0 -0
  98. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/login.py +0 -0
  99. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/login_common.py +0 -0
  100. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/logout.py +0 -0
  101. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/materialization.py +0 -0
  102. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/mock.py +0 -0
  103. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/mock_common.py +0 -0
  104. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/open.py +0 -0
  105. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/pipe.py +0 -0
  106. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/regions.py +0 -0
  107. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/secret.py +0 -0
  108. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/secret_common.py +0 -0
  109. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/shell.py +0 -0
  110. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/sink.py +0 -0
  111. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/table.py +0 -0
  112. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/telemetry.py +0 -0
  113. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/test.py +0 -0
  114. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/test_common.py +0 -0
  115. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
  116. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
  117. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/token.py +0 -0
  118. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/watch.py +0 -0
  119. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/workspace.py +0 -0
  120. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb/modules/workspace_members.py +0 -0
  121. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli.py +0 -0
  122. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/auth.py +0 -0
  123. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/branch.py +0 -0
  124. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/cicd.py +0 -0
  125. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/cli.py +0 -0
  126. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/common.py +0 -0
  127. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/config.py +0 -0
  128. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/connection.py +0 -0
  129. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/datasource.py +0 -0
  130. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/exceptions.py +0 -0
  131. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/fmt.py +0 -0
  132. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/job.py +0 -0
  133. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/pipe.py +0 -0
  134. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/regions.py +0 -0
  135. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/tag.py +0 -0
  136. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/telemetry.py +0 -0
  137. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/test.py +0 -0
  138. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  139. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
  140. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/workspace.py +0 -0
  141. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  142. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird/tornado_template.py +0 -0
  143. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird.egg-info/dependency_links.txt +0 -0
  144. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird.egg-info/entry_points.txt +0 -0
  145. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird.egg-info/requires.txt +0 -0
  146. {tinybird-0.0.1.dev269 → tinybird-0.0.1.dev270}/tinybird.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev269
3
+ Version: 0.0.1.dev270
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
4
4
  __url__ = 'https://www.tinybird.co/docs/forward/commands'
5
5
  __author__ = 'Tinybird'
6
6
  __author_email__ = 'support@tinybird.co'
7
- __version__ = '0.0.1.dev269'
8
- __revision__ = '24737f5'
7
+ __version__ = '0.0.1.dev270'
8
+ __revision__ = '77ee059'
@@ -27,7 +27,12 @@ from tinybird.tb.modules.agent.memory import (
27
27
  save_messages,
28
28
  )
29
29
  from tinybird.tb.modules.agent.models import create_model
30
- from tinybird.tb.modules.agent.prompts import agent_system_prompt, load_custom_project_rules, resources_prompt
30
+ from tinybird.tb.modules.agent.prompts import (
31
+ agent_system_prompt,
32
+ load_custom_project_rules,
33
+ resources_prompt,
34
+ secrets_prompt,
35
+ )
31
36
  from tinybird.tb.modules.agent.testing_agent import TestingAgent
32
37
  from tinybird.tb.modules.agent.tools.analyze import analyze_file, analyze_url
33
38
  from tinybird.tb.modules.agent.tools.append import append_file, append_url
@@ -40,6 +45,7 @@ from tinybird.tb.modules.agent.tools.get_endpoint_stats import get_endpoint_stat
40
45
  from tinybird.tb.modules.agent.tools.get_openapi_definition import get_openapi_definition
41
46
  from tinybird.tb.modules.agent.tools.mock import mock
42
47
  from tinybird.tb.modules.agent.tools.plan import plan
48
+ from tinybird.tb.modules.agent.tools.secret import create_or_update_secrets
43
49
  from tinybird.tb.modules.agent.utils import AgentRunCancelled, TinybirdAgentContext, show_confirmation, show_input
44
50
  from tinybird.tb.modules.build_common import process as build_process
45
51
  from tinybird.tb.modules.common import _analyze, _get_tb_client, echo_safe_humanfriendly_tables_format_pretty_table
@@ -51,6 +57,7 @@ from tinybird.tb.modules.local_common import get_tinybird_local_client
51
57
  from tinybird.tb.modules.login_common import login
52
58
  from tinybird.tb.modules.mock_common import append_mock_data, create_mock_data
53
59
  from tinybird.tb.modules.project import Project
60
+ from tinybird.tb.modules.secret_common import load_secrets
54
61
  from tinybird.tb.modules.test_common import run_tests as run_tests_common
55
62
 
56
63
 
@@ -108,6 +115,12 @@ class TinybirdAgent:
108
115
  takes_ctx=True,
109
116
  ),
110
117
  Tool(diff_resource, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
118
+ Tool(
119
+ create_or_update_secrets,
120
+ docstring_format="google",
121
+ require_parameter_descriptions=True,
122
+ takes_ctx=True,
123
+ ),
111
124
  ],
112
125
  history_processors=[compact_messages],
113
126
  )
@@ -207,6 +220,10 @@ class TinybirdAgent:
207
220
  def get_project_files(ctx: RunContext[TinybirdAgentContext]) -> str:
208
221
  return resources_prompt(self.project)
209
222
 
223
+ @self.agent.instructions
224
+ def get_secrets(ctx: RunContext[TinybirdAgentContext]) -> str:
225
+ return secrets_prompt(self.project)
226
+
210
227
  def add_message(self, message: ModelMessage) -> None:
211
228
  self.messages.append(message)
212
229
 
@@ -251,6 +268,7 @@ class TinybirdAgent:
251
268
  local_host=local_client.host,
252
269
  local_token=local_client.token,
253
270
  run_id=run_id,
271
+ load_secrets_local=partial(load_secrets, project=project, client=local_client),
254
272
  )
255
273
 
256
274
  def run(self, user_prompt: str, config: dict[str, Any]) -> None:
@@ -5,16 +5,12 @@ from typing import Any
5
5
  from pydantic_ai import format_as_xml
6
6
 
7
7
  from tinybird.prompts import (
8
- connection_instructions,
9
8
  copy_pipe_instructions,
10
9
  datasource_example,
11
10
  datasource_instructions,
12
- gcs_connection_example,
13
- kafka_connection_example,
14
11
  materialized_pipe_instructions,
15
12
  pipe_example,
16
13
  pipe_instructions,
17
- s3_connection_example,
18
14
  sink_pipe_instructions,
19
15
  )
20
16
  from tinybird.tb.modules.project import Project
@@ -25,18 +21,20 @@ When asked to create a plan, you MUST respond with this EXACT format and NOTHING
25
21
  Plan description: [One sentence describing what will be built]
26
22
 
27
23
  Steps:
28
- 1. Connection: [name] - [description]
29
- 2. Datasource: [name] - [description] - Depends on: [connection_name (optional)]
30
- 3. Endpoint: [name] - [description] - Depends on: [resources]
31
- 4. Materialized pipe: [name] - [description] - Depends on: [resources]
32
- 5. Materialized datasource: [name] - [description] - Depends on: [resources]
33
- 6. Sink: [name] - [description] - Depends on: [resources]
34
- 7. Copy: [name] - [description] - Depends on: [resources]
35
- 8. Generate mock data: [datasource_name]
36
- 9. Append existing fixture: [fixture_pathname] - Target: [datasource_name]
24
+ 1. Create secrets: [key1, key2, ...] - Create all required secrets in .env.local in one step
25
+ 2. Connection: [name] - [description]
26
+ 3. Datasource: [name] - [description] - Depends on: [connection_name (optional)]
27
+ 4. Endpoint: [name] - [description] - Depends on: [resources]
28
+ 5. Materialized pipe: [name] - [description] - Depends on: [resources]
29
+ 6. Materialized datasource: [name] - [description] - Depends on: [resources]
30
+ 7. Sink: [name] - [description] - Depends on: [resources]
31
+ 8. Copy: [name] - [description] - Depends on: [resources]
32
+ 9. Generate mock data: [datasource_name]
33
+ 10. Append existing fixture: [fixture_pathname] - Target: [datasource_name]
37
34
 
38
35
  <dev_notes>
39
36
  You can skip steps where resources will not be created or updated.
37
+ Always add 'Create secrets' as the FIRST step if any secrets/environment variables are required for the implementation. This step should include ALL required secrets at once.
40
38
  Always add 'Generate mock data' step if a landing datasource was created without providing a fixture file.
41
39
  Always add 'Append existing fixture' step if a landing datasource was created after providing a fixture file.
42
40
  Solve the specific user request, do not add extra steps that are not related to the user request.
@@ -103,8 +101,6 @@ sql_instructions = """
103
101
  - ONLY SELECT statements are allowed in any sql query.
104
102
  - When using functions try always ClickHouse functions first, then SQL functions.
105
103
  - Parameters are never quoted in any case.
106
- - Use the following syntax in the SQL section for the iceberg table function: iceberg('s3://bucket/path/to/table', {{tb_secret('aws_access_key_id')}}, {{tb_secret('aws_secret_access_key')}})
107
- - Use the following syntax in the SQL section for the postgres table function: postgresql('host:port', 'database', 'table', {{tb_secret('db_username')}}, {{tb_secret('db_password')}}), 'schema')
108
104
  </sql_instructions>
109
105
  """
110
106
 
@@ -158,6 +154,29 @@ def resources_prompt(project: Project) -> str:
158
154
  return resources_content + "\n" + fixture_content
159
155
 
160
156
 
157
+ def secrets_prompt(project: Project) -> str:
158
+ """Generate a prompt showing available secrets from .env.local file."""
159
+ secrets = project.get_secrets()
160
+
161
+ if not secrets:
162
+ return "# Environment variables from .env.local:\nNo secrets found in .env.local file"
163
+
164
+ secrets_content = "# Environment variables from .env.local:\n"
165
+ secrets_list = []
166
+
167
+ for key, value in sorted(secrets.items()):
168
+ secret = {
169
+ "key": key,
170
+ "value": value,
171
+ }
172
+ secrets_list.append(secret)
173
+
174
+ if secrets_list:
175
+ secrets_content = format_as_xml(secrets_list, root_tag="secrets", item_tag="secret")
176
+
177
+ return secrets_content
178
+
179
+
161
180
  def tests_files_prompt(project: Project) -> str:
162
181
  files = project.get_project_files()
163
182
  test_files = project.get_test_files()
@@ -640,6 +659,72 @@ Do not add additional code explanation summary unless requested by the user. Aft
640
659
  IMPORTANT: DO NOT ADD ANY COMMENTS unless asked by the user.
641
660
  """
642
661
 
662
+ secrets_instructions = """
663
+ # Working with secrets:
664
+ - The syntax to use a secret is `{{ tb_secret("SECRET_NAME", "DEFAULT_VALUE_OPTIONAL") }}`.
665
+ - Secrets are used for sensitive credentials in the following cases:
666
+ - Connection files
667
+ - Pipe files in the SQL section (Remember to add `%` on top of the query to make it dynamic)
668
+ - All credentials needed to access Postgres and Iceberg external tables
669
+ - Do NOT use dynamic parameters instead of secrets, in the cases where secrets are needed.
670
+ - Secrets in pipe files do not allow default values.
671
+ - Secrets in connection files allow default values.
672
+ """
673
+
674
+ external_tables_instructions = """
675
+ # Querying external tables:
676
+ When users ask to query a Postgres or Iceberg table, do not create connections, just use the following syntax in the SQL section:
677
+ ## Iceberg table example:
678
+ ```sql
679
+ FROM iceberg('s3://bucket/path/to/table', {{tb_secret('aws_access_key_id')}}, {{tb_secret('aws_secret_access_key')}})
680
+ ```
681
+ ## Postgres table example:
682
+ ```sql
683
+ FROM postgresql({{ tb_secret("db_host_port") }}, 'database', 'table', {{tb_secret('db_username')}}, {{tb_secret('db_password')}}), 'schema_optional')
684
+ ```
685
+ <dev_notes>
686
+ - Do not split the host and port in multiple secrets, use the secret as a whole.
687
+ </dev_notes>
688
+ """
689
+
690
+ connection_instructions = """
691
+ # Working with connections files:
692
+ - Content cannot be empty.
693
+ - The connection names must be unique.
694
+ - No indentation is allowed for property names
695
+ - We support kafka, gcs and s3 connections for now
696
+ - If a user asks for a non supported connection type, just say that it is not supported and do not try to create it.
697
+
698
+ ## Kafka connection example:
699
+ ```
700
+ TYPE kafka
701
+ KAFKA_BOOTSTRAP_SERVERS {{ tb_secret("PRODUCTION_KAFKA_SERVERS", "localhost:9092") }}
702
+ KAFKA_SECURITY_PROTOCOL SASL_SSL
703
+ KAFKA_SASL_MECHANISM PLAIN
704
+ KAFKA_KEY {{ tb_secret("PRODUCTION_KAFKA_USERNAME", "") }}
705
+ KAFKA_SECRET {{ tb_secret("PRODUCTION_KAFKA_PASSWORD", "") }}
706
+ ```
707
+
708
+ ## S3 connection example:
709
+ ```
710
+ TYPE s3
711
+ S3_REGION {{ tb_secret("PRODUCTION_S3_REGION", "") }}
712
+ S3_ARN {{ tb_secret("PRODUCTION_S3_ARN", "") }}
713
+ ```
714
+
715
+ ## GCS service account connection example:
716
+ ```
717
+ TYPE gcs
718
+ GCS_SERVICE_ACCOUNT_CREDENTIALS_JSON {{ tb_secret("PRODUCTION_GCS_SERVICE_ACCOUNT_CREDENTIALS_JSON", "") }}
719
+ ```
720
+
721
+ ## GCS HMAC connection example:
722
+ ```
723
+ TYPE gcs
724
+ GCS_HMAC_ACCESS_ID {{ tb_secret("gcs_hmac_access_id") }}
725
+ GCS_HMAC_SECRET {{ tb_secret("gcs_hmac_secret") }}
726
+ ```
727
+ """
643
728
 
644
729
  agent_system_prompt = f"""
645
730
  You are a Tinybird Code, an agentic CLI that can help users to work with Tinybird.
@@ -720,13 +805,11 @@ IMPORTANT: Every time you finish a plan and start a new resource creation or upd
720
805
  {sql_agent_instructions}
721
806
  {sql_instructions}
722
807
 
723
- # Working with connections files:
724
- {connection_instructions}
808
+ {secrets_instructions}
725
809
 
726
- # Connection examples:
727
- Kafka: {kafka_connection_example}
728
- S3: {s3_connection_example}
729
- GCS: {gcs_connection_example}
810
+ {external_tables_instructions}
811
+
812
+ {connection_instructions}
730
813
 
731
814
  {explore_data_instructions}
732
815
 
@@ -0,0 +1,113 @@
1
+ from pathlib import Path
2
+
3
+ import click
4
+ from pydantic_ai import RunContext
5
+
6
+ from tinybird.tb.modules.agent.utils import (
7
+ AgentRunCancelled,
8
+ TinybirdAgentContext,
9
+ create_terminal_box,
10
+ show_confirmation,
11
+ show_input,
12
+ )
13
+ from tinybird.tb.modules.exceptions import CLIBuildException
14
+ from tinybird.tb.modules.feedback_manager import FeedbackManager
15
+
16
+
17
+ def create_or_update_secrets(ctx: RunContext[TinybirdAgentContext], secrets: dict[str, str]) -> str:
18
+ """Creates or updates multiple secrets in the .env.local file in the project folder.
19
+
20
+ This function will:
21
+ 1. Check if .env.local exists in the project folder, create it if it doesn't
22
+ 2. Create or update all specified secret keys with their given values
23
+ 3. Handle existing keys by updating their values
24
+ 4. Show a single confirmation for all secrets
25
+
26
+ Args:
27
+ secrets (dict[str, str]): Dictionary of environment variable keys and values. Required.
28
+
29
+ Returns:
30
+ str: Confirmation message about the secrets creation/update.
31
+ """
32
+ try:
33
+ ctx.deps.thinking_animation.stop()
34
+
35
+ env_file_path = Path(ctx.deps.folder) / ".env.local"
36
+
37
+ # Read existing content if file exists
38
+ existing_content = ""
39
+ if env_file_path.exists():
40
+ existing_content = env_file_path.read_text()
41
+
42
+ # Parse existing environment variables
43
+ env_vars = {}
44
+ for line in existing_content.splitlines():
45
+ line = line.strip()
46
+ if line and not line.startswith("#") and "=" in line:
47
+ k, v = line.split("=", 1)
48
+ env_vars[k.strip()] = v.strip()
49
+
50
+ # Update or add the new secrets
51
+ new_keys = []
52
+ updated_keys = []
53
+ for key, value in secrets.items():
54
+ if key in env_vars:
55
+ updated_keys.append(key)
56
+ else:
57
+ new_keys.append(key)
58
+ env_vars[key] = value
59
+
60
+ # Generate new content
61
+ new_content = "\n".join([f"{k}={v}" for k, v in sorted(env_vars.items())])
62
+ if new_content:
63
+ new_content += "\n"
64
+
65
+ # Show preview
66
+ action = "Update" if env_file_path.exists() and updated_keys else "Create"
67
+ if new_keys and updated_keys:
68
+ action = "Create/Update"
69
+
70
+ preview_content = create_terminal_box(new_content, title=".env.local")
71
+ click.echo(preview_content)
72
+
73
+ confirmation = show_confirmation(
74
+ title=f"{action} {len(secrets)} secret(s) in .env.local?",
75
+ skip_confirmation=ctx.deps.dangerously_skip_permissions,
76
+ )
77
+
78
+ if confirmation == "review":
79
+ feedback = show_input(ctx.deps.workspace_name)
80
+ ctx.deps.thinking_animation.start()
81
+ return f"User did not confirm the secret changes and gave the following feedback: {feedback}"
82
+
83
+ # Write the file
84
+ action = "Updating" if env_file_path.exists() and updated_keys else "Creating"
85
+ click.echo(FeedbackManager.highlight(message=f"» {action} secrets in .env.local..."))
86
+ env_file_path.write_text(new_content)
87
+ ctx.deps.load_secrets_local()
88
+ ctx.deps.build_project(test=False, silent=True, load_fixtures=False)
89
+
90
+ # Generate success message
91
+ result_parts = []
92
+ if new_keys:
93
+ result_parts.append(f"created {len(new_keys)} new secret(s): {', '.join(new_keys)}")
94
+ if updated_keys:
95
+ result_parts.append(f"updated {len(updated_keys)} existing secret(s): {', '.join(updated_keys)}")
96
+
97
+ result_msg = " and ".join(result_parts)
98
+ ctx.deps.thinking_animation.start()
99
+
100
+ return f"Successfully {result_msg} in .env.local. Project built successfully."
101
+
102
+ except AgentRunCancelled as e:
103
+ raise e
104
+ except CLIBuildException as e:
105
+ ctx.deps.thinking_animation.stop()
106
+ click.echo(FeedbackManager.error(message=e))
107
+ ctx.deps.thinking_animation.start()
108
+ return f"Error building project: {e}. If the error is related to another resource, fix it and try again."
109
+ except Exception as e:
110
+ ctx.deps.thinking_animation.stop()
111
+ click.echo(FeedbackManager.error(message=f"Error managing secrets: {e}"))
112
+ ctx.deps.thinking_animation.start()
113
+ return f"Error creating/updating secrets: {e}"
@@ -61,6 +61,7 @@ class TinybirdAgentContext(BaseModel):
61
61
  get_connection_datafile_cloud: Callable[..., str]
62
62
  get_connection_datafile_local: Callable[..., str]
63
63
  run_tests: Callable[..., Optional[str]]
64
+ load_secrets_local: Callable[..., None]
64
65
  dangerously_skip_permissions: bool
65
66
  token: str
66
67
  user_token: str
@@ -82,6 +82,27 @@ class Project:
82
82
  test_files.append(test_file)
83
83
  return test_files
84
84
 
85
+ def get_secrets(self) -> dict[str, str]:
86
+ """Load secrets from .env.local file in the project folder."""
87
+ secrets: dict[str, str] = {}
88
+ env_file_path = Path(self.folder) / ".env.local"
89
+
90
+ if not env_file_path.exists():
91
+ return secrets
92
+
93
+ try:
94
+ content = env_file_path.read_text()
95
+ for line in content.splitlines():
96
+ line = line.strip()
97
+ if line and not line.startswith("#") and "=" in line:
98
+ key, value = line.split("=", 1)
99
+ secrets[key.strip()] = value.strip()
100
+ except Exception:
101
+ # If there's any error reading the file, return empty dict
102
+ pass
103
+
104
+ return secrets
105
+
85
106
  def get_resource_path(self, resource_name: str, resource_type: str) -> str:
86
107
  full_path = next(
87
108
  (p for p in self.get_project_files() if p.endswith("/" + resource_name + f".{resource_type}")), ""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev269
3
+ Version: 0.0.1.dev270
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -106,6 +106,7 @@ tinybird/tb/modules/agent/tools/mock.py
106
106
  tinybird/tb/modules/agent/tools/plan.py
107
107
  tinybird/tb/modules/agent/tools/request_endpoint.py
108
108
  tinybird/tb/modules/agent/tools/run_command.py
109
+ tinybird/tb/modules/agent/tools/secret.py
109
110
  tinybird/tb/modules/agent/tools/test.py
110
111
  tinybird/tb/modules/datafile/build.py
111
112
  tinybird/tb/modules/datafile/build_common.py