beamlit 0.0.24rc20__py3-none-any.whl → 0.0.24rc21__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. beamlit/agents/chat.py +37 -11
  2. beamlit/agents/decorator.py +97 -65
  3. beamlit/api/agents/create_agent.py +9 -14
  4. beamlit/api/agents/delete_agent.py +22 -1
  5. beamlit/api/agents/delete_agent_history.py +2 -6
  6. beamlit/api/agents/get_agent.py +22 -1
  7. beamlit/api/agents/get_agent_environment_logs.py +11 -11
  8. beamlit/api/agents/get_agent_history.py +2 -6
  9. beamlit/api/agents/get_agent_metrics.py +22 -1
  10. beamlit/api/agents/list_agent_history.py +11 -11
  11. beamlit/api/agents/list_agents.py +36 -4
  12. beamlit/api/agents/put_agent_history.py +2 -6
  13. beamlit/api/agents/update_agent.py +9 -14
  14. beamlit/api/functions/create_function.py +9 -14
  15. beamlit/api/functions/delete_function.py +22 -1
  16. beamlit/api/functions/get_function.py +22 -1
  17. beamlit/api/functions/get_function_environment_logs.py +11 -11
  18. beamlit/api/functions/get_function_metrics.py +22 -1
  19. beamlit/api/functions/list_functions.py +36 -4
  20. beamlit/api/functions/update_function.py +9 -14
  21. beamlit/api/history/get_agents_history.py +12 -12
  22. beamlit/api/history/list_agents_history.py +12 -12
  23. beamlit/api/integrations/get_integration_connection.py +16 -12
  24. beamlit/api/integrations/get_integration_connection_model.py +8 -1
  25. beamlit/api/integrations/get_integration_model.py +8 -1
  26. beamlit/api/locations/list_locations.py +12 -12
  27. beamlit/api/models/create_model.py +13 -14
  28. beamlit/api/models/delete_model.py +22 -1
  29. beamlit/api/models/get_model.py +22 -1
  30. beamlit/api/models/get_model_environment_logs.py +11 -11
  31. beamlit/api/models/get_model_metrics.py +38 -13
  32. beamlit/api/models/list_models.py +36 -4
  33. beamlit/api/models/update_model.py +13 -14
  34. beamlit/api/privateclusters/__init__.py +0 -0
  35. beamlit/api/{agents/get_agent_deployment_metrics.py → privateclusters/create_private_cluster.py} +28 -55
  36. beamlit/api/{functions/list_function_deployments.py → privateclusters/delete_private_cluster.py} +38 -37
  37. beamlit/api/{agents/get_agent_deployment.py → privateclusters/get_private_cluster.py} +40 -44
  38. beamlit/api/privateclusters/get_private_cluster_health.py +97 -0
  39. beamlit/api/{agents/list_agent_deployments.py → privateclusters/list_private_clusters.py} +30 -45
  40. beamlit/api/{models/list_model_deployments.py → privateclusters/update_private_cluster.py} +38 -45
  41. beamlit/api/privateclusters/update_private_cluster_health.py +97 -0
  42. beamlit/authentication/device_mode.py +3 -9
  43. beamlit/common/generate.py +47 -34
  44. beamlit/common/settings.py +29 -27
  45. beamlit/deploy/deploy.py +101 -342
  46. beamlit/deploy/format.py +70 -0
  47. beamlit/deploy/parser.py +175 -0
  48. beamlit/functions/decorator.py +8 -11
  49. beamlit/models/__init__.py +64 -78
  50. beamlit/models/acl.py +4 -22
  51. beamlit/models/agent.py +34 -95
  52. beamlit/models/agent_history.py +7 -5
  53. beamlit/models/agent_history_event.py +11 -9
  54. beamlit/models/agent_metadata.py +5 -3
  55. beamlit/models/agent_spec.py +54 -45
  56. beamlit/models/api_key.py +14 -14
  57. beamlit/models/configuration.py +11 -0
  58. beamlit/models/core_spec.py +45 -32
  59. beamlit/models/{model_deployment_metrics_query_per_second_per_region_per_code.py → core_spec_configurations.py} +22 -22
  60. beamlit/models/environment.py +33 -105
  61. beamlit/models/environment_metadata.py +146 -0
  62. beamlit/models/environment_spec.py +8 -6
  63. beamlit/models/function.py +34 -95
  64. beamlit/models/function_metadata.py +5 -3
  65. beamlit/models/function_spec.py +53 -40
  66. beamlit/models/integration_connection.py +31 -137
  67. beamlit/models/integration_connection_spec.py +6 -4
  68. beamlit/models/metadata.py +5 -3
  69. beamlit/models/metadata_labels.py +4 -2
  70. beamlit/models/model.py +33 -94
  71. beamlit/models/model_metadata.py +5 -3
  72. beamlit/models/{function_provider_ref.py → model_private_cluster.py} +23 -14
  73. beamlit/models/model_provider.py +27 -43
  74. beamlit/models/model_spec.py +45 -32
  75. beamlit/models/owner_fields.py +4 -2
  76. beamlit/models/pending_invitation.py +14 -14
  77. beamlit/models/pod_template_spec.py +4 -2
  78. beamlit/models/policy.py +33 -159
  79. beamlit/models/policy_spec.py +24 -28
  80. beamlit/models/private_cluster.py +183 -0
  81. beamlit/models/{model_provider_ref.py → private_location.py} +7 -16
  82. beamlit/models/resource_deployment_metrics.py +0 -108
  83. beamlit/models/resource_environment_metrics.py +143 -71
  84. beamlit/models/{resource_deployment_metrics_inference_per_region.py → resource_environment_metrics_inference_per_region.py} +5 -5
  85. beamlit/models/resource_environment_metrics_inference_per_second_per_region.py +9 -11
  86. beamlit/models/{resource_deployment_metrics_query_per_region_per_code.py → resource_environment_metrics_query_per_region_per_code.py} +5 -5
  87. beamlit/models/resource_environment_metrics_query_per_second_per_region_per_code.py +5 -3
  88. beamlit/models/resource_log.py +4 -2
  89. beamlit/models/runtime.py +20 -2
  90. beamlit/models/serverless_config.py +28 -21
  91. beamlit/models/spec_configuration.py +7 -5
  92. beamlit/models/store_agent.py +14 -14
  93. beamlit/models/store_function.py +14 -14
  94. beamlit/models/time_fields.py +4 -2
  95. beamlit/models/websocket_channel.py +4 -2
  96. beamlit/models/workspace.py +23 -14
  97. beamlit/run.py +0 -1
  98. beamlit/serve/app.py +1 -0
  99. beamlit/serve/middlewares/accesslog.py +3 -1
  100. {beamlit-0.0.24rc20.dist-info → beamlit-0.0.24rc21.dist-info}/METADATA +1 -1
  101. beamlit-0.0.24rc21.dist-info/RECORD +243 -0
  102. beamlit/api/agents/delete_agent_deployment.py +0 -163
  103. beamlit/api/agents/delete_agent_deployment_history.py +0 -172
  104. beamlit/api/agents/get_agent_deployment_history.py +0 -172
  105. beamlit/api/agents/get_agent_deployment_logs.py +0 -164
  106. beamlit/api/agents/list_agent_deployment_history.py +0 -164
  107. beamlit/api/agents/put_agent_deployment.py +0 -185
  108. beamlit/api/agents/put_agent_deployment_history.py +0 -198
  109. beamlit/api/functions/delete_function_deployment.py +0 -163
  110. beamlit/api/functions/get_function_deployment.py +0 -163
  111. beamlit/api/functions/get_function_deployment_logs.py +0 -164
  112. beamlit/api/functions/get_function_deployment_metrics.py +0 -159
  113. beamlit/api/functions/put_function_deployment.py +0 -185
  114. beamlit/api/models/delete_model_deployment.py +0 -171
  115. beamlit/api/models/get_model_deployment.py +0 -171
  116. beamlit/api/models/get_model_deployment_logs.py +0 -168
  117. beamlit/api/models/get_model_deployment_metrics.py +0 -163
  118. beamlit/api/models/put_model_deployment.py +0 -193
  119. beamlit/models/agent_configuration.py +0 -70
  120. beamlit/models/agent_deployment.py +0 -340
  121. beamlit/models/agent_deployment_configuration.py +0 -45
  122. beamlit/models/agent_deployment_configuration_type_0.py +0 -43
  123. beamlit/models/agent_deployment_history.py +0 -185
  124. beamlit/models/agent_deployment_history_event.py +0 -133
  125. beamlit/models/agent_deployment_pod_template.py +0 -45
  126. beamlit/models/agent_deployment_pod_template_type_0.py +0 -43
  127. beamlit/models/agent_with_deployments.py +0 -176
  128. beamlit/models/authentication_provider_model.py +0 -144
  129. beamlit/models/authentication_provider_organization.py +0 -88
  130. beamlit/models/deployment_configuration.py +0 -70
  131. beamlit/models/deployment_configurations.py +0 -58
  132. beamlit/models/deployment_serverless_config.py +0 -131
  133. beamlit/models/deployment_serverless_config_type_0.py +0 -220
  134. beamlit/models/function_configuration.py +0 -70
  135. beamlit/models/function_deployment.py +0 -340
  136. beamlit/models/function_deployment_configuration.py +0 -45
  137. beamlit/models/function_deployment_configuration_type_0.py +0 -43
  138. beamlit/models/function_deployment_pod_template.py +0 -45
  139. beamlit/models/function_deployment_pod_template_type_0.py +0 -43
  140. beamlit/models/function_with_deployments.py +0 -176
  141. beamlit/models/integration.py +0 -198
  142. beamlit/models/integration_config.py +0 -45
  143. beamlit/models/integration_secret.py +0 -61
  144. beamlit/models/labels_type_0.py +0 -45
  145. beamlit/models/location.py +0 -122
  146. beamlit/models/model_deployment.py +0 -296
  147. beamlit/models/model_deployment_log.py +0 -70
  148. beamlit/models/model_deployment_metrics.py +0 -172
  149. beamlit/models/model_deployment_metrics_inference_per_second_per_region.py +0 -77
  150. beamlit/models/model_deployment_pod_template.py +0 -45
  151. beamlit/models/model_deployment_pod_template_type_0.py +0 -43
  152. beamlit/models/model_metrics.py +0 -96
  153. beamlit/models/model_with_deployments.py +0 -176
  154. beamlit/models/resource_deployment_log.py +0 -70
  155. beamlit/models/resource_deployment_metrics_inference_per_region_type_0.py +0 -79
  156. beamlit/models/resource_deployment_metrics_inference_per_second_per_region_type_0.py +0 -79
  157. beamlit/models/resource_deployment_metrics_query_per_region_per_code_type_0.py +0 -73
  158. beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code_type_0.py +0 -73
  159. beamlit/models/runtime_readiness_probe_type_0.py +0 -43
  160. beamlit/models/runtime_type_0.py +0 -111
  161. beamlit/models/runtime_type_0_readiness_probe.py +0 -43
  162. beamlit/models/runtime_type_0_readiness_probe_type_0.py +0 -43
  163. beamlit/models/runtime_type_0_resources.py +0 -59
  164. beamlit/models/standard_fields_dynamo_db.py +0 -88
  165. beamlit/models/store_agent_configuration.py +0 -97
  166. beamlit/models/store_agent_labels_type_0.py +0 -43
  167. beamlit/models/store_function_configuration.py +0 -97
  168. beamlit/models/store_function_labels_type_0.py +0 -43
  169. beamlit-0.0.24rc20.dist-info/RECORD +0 -303
  170. {beamlit-0.0.24rc20.dist-info → beamlit-0.0.24rc21.dist-info}/WHEEL +0 -0
beamlit/agents/chat.py CHANGED
@@ -2,14 +2,14 @@ from logging import getLogger
2
2
 
3
3
  from beamlit.authentication import get_authentication_headers, new_client
4
4
  from beamlit.common.settings import get_settings
5
- from beamlit.models import AgentDeployment
5
+ from beamlit.models import Model
6
6
 
7
7
  logger = getLogger(__name__)
8
8
 
9
9
 
10
- def get_base_url(agent_model: AgentDeployment):
10
+ def get_base_url(agent_model: Model):
11
11
  settings = get_settings()
12
- return f"{settings.run_url}/{settings.workspace}/models/{agent_model.model}/v1"
12
+ return f"{settings.run_url}/{settings.workspace}/models/{agent_model.metadata.name}/v1"
13
13
 
14
14
 
15
15
  def get_mistral_chat_model(**kwargs):
@@ -29,16 +29,25 @@ def get_anthropic_chat_model(**kwargs):
29
29
 
30
30
  return ChatAnthropic(**kwargs)
31
31
 
32
+ def get_xai_chat_model(**kwargs):
33
+ from langchain_xai import ChatXAI # type: ignore
32
34
 
33
- def get_chat_model(agent_model: AgentDeployment):
35
+ return ChatXAI(**kwargs)
36
+
37
+ def get_cohere_chat_model(**kwargs):
38
+ from langchain_cohere import ChatCohere # type: ignore
39
+
40
+ return ChatCohere(**kwargs)
41
+
42
+ def get_chat_model(agent_model: Model):
34
43
  settings = get_settings()
35
44
  client = new_client()
36
45
 
37
46
  headers = get_authentication_headers(settings)
38
- headers["X-Beamlit-Environment"] = agent_model.environment
47
+ headers["X-Beamlit-Environment"] = agent_model.metadata.environment
39
48
 
40
49
  jwt = headers.get("X-Beamlit-Authorization", "").replace("Bearer ", "")
41
- params = {"environment": agent_model.environment}
50
+ params = {"environment": agent_model.metadata.environment}
42
51
  chat_classes = {
43
52
  "openai": {
44
53
  "func": get_openai_chat_model,
@@ -57,19 +66,33 @@ def get_chat_model(agent_model: AgentDeployment):
57
66
  "api_key": jwt,
58
67
  },
59
68
  },
69
+ "xai": {
70
+ "func": get_xai_chat_model,
71
+ "kwargs": {
72
+ "api_key": jwt,
73
+ "xai_api_base": get_base_url(),
74
+ },
75
+ "remove_kwargs": ["base_url"],
76
+ },
77
+ "cohere": {
78
+ "func": get_cohere_chat_model,
79
+ "kwargs": {
80
+ "cohere_api_key": jwt,
81
+ },
82
+ },
60
83
  }
61
84
 
62
85
  if agent_model is None:
63
86
  raise ValueError("agent_model not found in configuration")
64
- if agent_model.runtime is None:
87
+ if agent_model.spec.runtime is None:
65
88
  raise ValueError("runtime not found in agent model")
66
- if agent_model.runtime.type_ is None:
89
+ if agent_model.spec.runtime.type_ is None:
67
90
  raise ValueError("type not found in runtime")
68
- if agent_model.runtime.model is None:
91
+ if agent_model.spec.runtime.model is None:
69
92
  raise ValueError("model not found in runtime")
70
93
 
71
- provider = agent_model.runtime.type_
72
- model = agent_model.runtime.model
94
+ provider = agent_model.spec.runtime.type_
95
+ model = agent_model.spec.runtime.model
73
96
 
74
97
  kwargs = {
75
98
  "model": model,
@@ -85,4 +108,7 @@ def get_chat_model(agent_model: AgentDeployment):
85
108
  chat_class = chat_classes["openai"]
86
109
  if "kwargs" in chat_class:
87
110
  kwargs.update(chat_class["kwargs"])
111
+ if "remove_kwargs" in chat_class:
112
+ for key in chat_class["remove_kwargs"]:
113
+ kwargs.pop(key, None)
88
114
  return chat_class["func"](**kwargs)
@@ -6,11 +6,11 @@ import importlib
6
6
  import os
7
7
  from logging import getLogger
8
8
 
9
- from beamlit.api.models import get_model_deployment
9
+ from beamlit.api.models import get_model
10
10
  from beamlit.authentication import new_client
11
11
  from beamlit.common.settings import get_settings, init
12
12
  from beamlit.errors import UnexpectedStatus
13
- from beamlit.models import AgentDeployment
13
+ from beamlit.models import Agent, AgentSpec, Metadata
14
14
  from langchain_core.tools import Tool
15
15
  from langgraph.checkpoint.memory import MemorySaver
16
16
  from langgraph.prebuilt import create_react_agent
@@ -23,6 +23,8 @@ def get_functions(dir="src/functions", from_decorator="function"):
23
23
  logger = getLogger(__name__)
24
24
 
25
25
  # Walk through all Python files in functions directory and subdirectories
26
+ if not os.path.exists(dir):
27
+ return []
26
28
  for root, _, files in os.walk(dir):
27
29
  for file in files:
28
30
  if file.endswith(".py"):
@@ -37,9 +39,9 @@ def get_functions(dir="src/functions", from_decorator="function"):
37
39
  # Look for function definitions with decorators
38
40
  for node in ast.walk(tree):
39
41
  if (
40
- (not isinstance(node, ast.FunctionDef) and not isinstance(node, ast.AsyncFunctionDef))
41
- or len(node.decorator_list) == 0
42
- ):
42
+ not isinstance(node, ast.FunctionDef)
43
+ and not isinstance(node, ast.AsyncFunctionDef)
44
+ ) or len(node.decorator_list) == 0:
43
45
  continue
44
46
  decorator = node.decorator_list[0]
45
47
 
@@ -76,78 +78,108 @@ def get_functions(dir="src/functions", from_decorator="function"):
76
78
  if not is_kit and hasattr(module, func_name):
77
79
  func = getattr(module, func_name)
78
80
  if asyncio.iscoroutinefunction(func):
79
- functions.append(Tool(name=func.__name__, description=func.__doc__, func=func, coroutine=func))
81
+ functions.append(
82
+ Tool(
83
+ name=func.__name__,
84
+ description=func.__doc__,
85
+ func=func,
86
+ coroutine=func,
87
+ )
88
+ )
80
89
  else:
81
- functions.append(Tool(name=func.__name__, description=func.__doc__, func=func))
90
+ functions.append(
91
+ Tool(
92
+ name=func.__name__,
93
+ description=func.__doc__,
94
+ func=func,
95
+ )
96
+ )
82
97
  except Exception as e:
83
98
  logger.warning(f"Error processing {file_path}: {e!s}")
84
99
  return functions
85
100
 
86
101
 
87
102
  def agent(
88
- bl_agent: AgentDeployment = None,
89
- chat_model=None,
90
- agent=None,
103
+ agent: Agent | dict = None,
104
+ override_chat_model=None,
105
+ override_agent=None,
91
106
  ):
92
- settings = init()
93
107
  logger = getLogger(__name__)
94
-
95
- def wrapper(func):
96
- settings = get_settings()
97
-
98
- @functools.wraps(func)
99
- def wrapped(*args, **kwargs):
100
- return func(
101
- settings.agent.agent,
102
- settings.agent.chat_model,
103
- settings.agent.functions,
104
- *args,
105
- **kwargs,
108
+ try:
109
+ if agent is not None and not isinstance(agent, dict):
110
+ raise Exception(
111
+ 'agent must be a dictionary, example: @agent(agent={"metadata": {"name": "my_agent"}})'
106
112
  )
107
113
 
108
- return wrapped
109
-
110
- # Initialize functions array to store decorated functions
111
- functions = get_functions(dir=settings.agent.functions_directory)
112
- settings.agent.functions = functions
113
-
114
- if bl_agent.model and chat_model is None:
115
- client = new_client()
116
- try:
117
- response = get_model_deployment.sync_detailed(
118
- bl_agent.model, settings.environment, client=client
119
- )
120
- settings.agent.model = response.parsed
121
- except UnexpectedStatus as e:
122
- if e.status_code == 404 and settings.environment != "production":
114
+ chat_model = override_chat_model or None
115
+ settings = init()
116
+
117
+ def wrapper(func):
118
+ @functools.wraps(func)
119
+ def wrapped(*args, **kwargs):
120
+ return func(
121
+ settings.agent.agent,
122
+ settings.agent.chat_model,
123
+ settings.agent.functions,
124
+ *args,
125
+ **kwargs,
126
+ )
127
+
128
+ return wrapped
129
+
130
+ # Initialize functions array to store decorated functions
131
+ functions = get_functions(dir=settings.agent.functions_directory)
132
+ settings.agent.functions = functions
133
+
134
+ if agent is not None:
135
+ metadata = Metadata(**agent.get("metadata", {}))
136
+ spec = AgentSpec(**agent.get("spec", {}))
137
+ agent = Agent(metadata=metadata, spec=spec)
138
+ if agent.spec.model and chat_model is None:
139
+ client = new_client()
123
140
  try:
124
- response = get_model_deployment.sync_detailed(
125
- bl_agent.model, "production", client=client
141
+ response = get_model.sync_detailed(
142
+ agent.spec.model, environment=settings.environment, client=client
126
143
  )
127
144
  settings.agent.model = response.parsed
128
145
  except UnexpectedStatus as e:
129
- if e.status_code == 404:
130
- raise ValueError(f"Model {bl_agent.model} not found")
131
- else:
132
- raise e
133
- chat_model = get_chat_model(settings.agent.model)
134
- settings.agent.chat_model = chat_model
135
- runtime = settings.agent.model.runtime
136
- logger.info(f"Chat model configured, using: {runtime.type_}:{runtime.model}")
137
-
138
- if len(functions) == 0:
139
- raise ValueError(
140
- "You must define at least one function, you can define this function in directory "
141
- f'"{settings.agent.functions_directory}". Here is a sample function you can use:\n\n'
142
- "from beamlit.functions import function\n\n"
143
- "@function()\n"
144
- "def hello_world(query: str):\n"
145
- " return 'Hello, world!'\n"
146
- )
147
-
148
- if agent is None and chat_model is not None:
149
- memory = MemorySaver()
150
- agent = create_react_agent(chat_model, functions, checkpointer=memory)
151
- settings.agent.agent = agent
152
-
153
- return wrapper
146
+ if e.status_code == 404 and settings.environment != "production":
147
+ try:
148
+ response = get_model.sync_detailed(
149
+ agent.spec.model, environment="production", client=client
150
+ )
151
+ settings.agent.model = response.parsed
152
+ except UnexpectedStatus as e:
153
+ if e.status_code == 404:
154
+ raise ValueError(f"Model {agent.spec.model} not found")
155
+ else:
156
+ raise e
157
+ except Exception as e:
158
+ raise e
159
+
160
+ if settings.agent.model:
161
+ chat_model = get_chat_model(settings.agent.model)
162
+ settings.agent.chat_model = chat_model
163
+ runtime = settings.agent.model.spec.runtime
164
+ logger.info(f"Chat model configured, using: {runtime.type_}:{runtime.model}")
165
+
166
+ if override_agent is None and len(functions) == 0:
167
+ raise ValueError(
168
+ "You must define at least one function, you can define this function in directory "
169
+ f'"{settings.agent.functions_directory}". Here is a sample function you can use:\n\n'
170
+ "from beamlit.functions import function\n\n"
171
+ "@function()\n"
172
+ "def hello_world(query: str):\n"
173
+ " return 'Hello, world!'\n"
174
+ )
175
+
176
+ if override_agent is None and chat_model is not None:
177
+ memory = MemorySaver()
178
+ agent = create_react_agent(chat_model, functions, checkpointer=memory)
179
+ settings.agent.agent = agent
180
+ else:
181
+ settings.agent.agent = override_agent
182
+ return wrapper
183
+ except Exception as e:
184
+ logger.error(f"Error in agent decorator: {e!s} at line {e.__traceback__.tb_lineno}")
185
+ raise e
@@ -6,13 +6,12 @@ import httpx
6
6
  from ... import errors
7
7
  from ...client import AuthenticatedClient, Client
8
8
  from ...models.agent import Agent
9
- from ...models.agent_with_deployments import AgentWithDeployments
10
9
  from ...types import Response
11
10
 
12
11
 
13
12
  def _get_kwargs(
14
13
  *,
15
- body: AgentWithDeployments,
14
+ body: Agent,
16
15
  ) -> dict[str, Any]:
17
16
  headers: dict[str, Any] = {}
18
17
 
@@ -53,13 +52,12 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt
53
52
  def sync_detailed(
54
53
  *,
55
54
  client: AuthenticatedClient,
56
- body: AgentWithDeployments,
55
+ body: Agent,
57
56
  ) -> Response[Agent]:
58
57
  """Create agent by name
59
58
 
60
59
  Args:
61
- body (AgentWithDeployments): Logical object representing an agent but with deployment
62
- definition inside
60
+ body (Agent): Agent
63
61
 
64
62
  Raises:
65
63
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -83,13 +81,12 @@ def sync_detailed(
83
81
  def sync(
84
82
  *,
85
83
  client: AuthenticatedClient,
86
- body: AgentWithDeployments,
84
+ body: Agent,
87
85
  ) -> Optional[Agent]:
88
86
  """Create agent by name
89
87
 
90
88
  Args:
91
- body (AgentWithDeployments): Logical object representing an agent but with deployment
92
- definition inside
89
+ body (Agent): Agent
93
90
 
94
91
  Raises:
95
92
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -108,13 +105,12 @@ def sync(
108
105
  async def asyncio_detailed(
109
106
  *,
110
107
  client: AuthenticatedClient,
111
- body: AgentWithDeployments,
108
+ body: Agent,
112
109
  ) -> Response[Agent]:
113
110
  """Create agent by name
114
111
 
115
112
  Args:
116
- body (AgentWithDeployments): Logical object representing an agent but with deployment
117
- definition inside
113
+ body (Agent): Agent
118
114
 
119
115
  Raises:
120
116
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -136,13 +132,12 @@ async def asyncio_detailed(
136
132
  async def asyncio(
137
133
  *,
138
134
  client: AuthenticatedClient,
139
- body: AgentWithDeployments,
135
+ body: Agent,
140
136
  ) -> Optional[Agent]:
141
137
  """Create agent by name
142
138
 
143
139
  Args:
144
- body (AgentWithDeployments): Logical object representing an agent but with deployment
145
- definition inside
140
+ body (Agent): Agent
146
141
 
147
142
  Raises:
148
143
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -6,15 +6,24 @@ import httpx
6
6
  from ... import errors
7
7
  from ...client import AuthenticatedClient, Client
8
8
  from ...models.agent import Agent
9
- from ...types import Response
9
+ from ...types import UNSET, Response
10
10
 
11
11
 
12
12
  def _get_kwargs(
13
13
  agent_name: str,
14
+ *,
15
+ environment: str,
14
16
  ) -> dict[str, Any]:
17
+ params: dict[str, Any] = {}
18
+
19
+ params["environment"] = environment
20
+
21
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
22
+
15
23
  _kwargs: dict[str, Any] = {
16
24
  "method": "delete",
17
25
  "url": f"/agents/{agent_name}",
26
+ "params": params,
18
27
  }
19
28
 
20
29
  return _kwargs
@@ -44,11 +53,13 @@ def sync_detailed(
44
53
  agent_name: str,
45
54
  *,
46
55
  client: AuthenticatedClient,
56
+ environment: str,
47
57
  ) -> Response[Agent]:
48
58
  """Delete agent by name
49
59
 
50
60
  Args:
51
61
  agent_name (str):
62
+ environment (str):
52
63
 
53
64
  Raises:
54
65
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -60,6 +71,7 @@ def sync_detailed(
60
71
 
61
72
  kwargs = _get_kwargs(
62
73
  agent_name=agent_name,
74
+ environment=environment,
63
75
  )
64
76
 
65
77
  response = client.get_httpx_client().request(
@@ -73,11 +85,13 @@ def sync(
73
85
  agent_name: str,
74
86
  *,
75
87
  client: AuthenticatedClient,
88
+ environment: str,
76
89
  ) -> Optional[Agent]:
77
90
  """Delete agent by name
78
91
 
79
92
  Args:
80
93
  agent_name (str):
94
+ environment (str):
81
95
 
82
96
  Raises:
83
97
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -90,6 +104,7 @@ def sync(
90
104
  return sync_detailed(
91
105
  agent_name=agent_name,
92
106
  client=client,
107
+ environment=environment,
93
108
  ).parsed
94
109
 
95
110
 
@@ -97,11 +112,13 @@ async def asyncio_detailed(
97
112
  agent_name: str,
98
113
  *,
99
114
  client: AuthenticatedClient,
115
+ environment: str,
100
116
  ) -> Response[Agent]:
101
117
  """Delete agent by name
102
118
 
103
119
  Args:
104
120
  agent_name (str):
121
+ environment (str):
105
122
 
106
123
  Raises:
107
124
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -113,6 +130,7 @@ async def asyncio_detailed(
113
130
 
114
131
  kwargs = _get_kwargs(
115
132
  agent_name=agent_name,
133
+ environment=environment,
116
134
  )
117
135
 
118
136
  response = await client.get_async_httpx_client().request(**kwargs)
@@ -124,11 +142,13 @@ async def asyncio(
124
142
  agent_name: str,
125
143
  *,
126
144
  client: AuthenticatedClient,
145
+ environment: str,
127
146
  ) -> Optional[Agent]:
128
147
  """Delete agent by name
129
148
 
130
149
  Args:
131
150
  agent_name (str):
151
+ environment (str):
132
152
 
133
153
  Raises:
134
154
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -142,5 +162,6 @@ async def asyncio(
142
162
  await asyncio_detailed(
143
163
  agent_name=agent_name,
144
164
  client=client,
165
+ environment=environment,
145
166
  )
146
167
  ).parsed
@@ -21,9 +21,7 @@ def _get_kwargs(
21
21
  return _kwargs
22
22
 
23
23
 
24
- def _parse_response(
25
- *, client: Union[AuthenticatedClient, Client], response: httpx.Response
26
- ) -> Optional[AgentHistory]:
24
+ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AgentHistory]:
27
25
  if response.status_code == 200:
28
26
  response_200 = AgentHistory.from_dict(response.json())
29
27
 
@@ -34,9 +32,7 @@ def _parse_response(
34
32
  return None
35
33
 
36
34
 
37
- def _build_response(
38
- *, client: Union[AuthenticatedClient, Client], response: httpx.Response
39
- ) -> Response[AgentHistory]:
35
+ def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AgentHistory]:
40
36
  return Response(
41
37
  status_code=HTTPStatus(response.status_code),
42
38
  content=response.content,
@@ -6,15 +6,24 @@ import httpx
6
6
  from ... import errors
7
7
  from ...client import AuthenticatedClient, Client
8
8
  from ...models.agent import Agent
9
- from ...types import Response
9
+ from ...types import UNSET, Response, Unset
10
10
 
11
11
 
12
12
  def _get_kwargs(
13
13
  agent_name: str,
14
+ *,
15
+ environment: Union[Unset, str] = UNSET,
14
16
  ) -> dict[str, Any]:
17
+ params: dict[str, Any] = {}
18
+
19
+ params["environment"] = environment
20
+
21
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
22
+
15
23
  _kwargs: dict[str, Any] = {
16
24
  "method": "get",
17
25
  "url": f"/agents/{agent_name}",
26
+ "params": params,
18
27
  }
19
28
 
20
29
  return _kwargs
@@ -44,11 +53,13 @@ def sync_detailed(
44
53
  agent_name: str,
45
54
  *,
46
55
  client: AuthenticatedClient,
56
+ environment: Union[Unset, str] = UNSET,
47
57
  ) -> Response[Agent]:
48
58
  """Get agent by name
49
59
 
50
60
  Args:
51
61
  agent_name (str):
62
+ environment (Union[Unset, str]):
52
63
 
53
64
  Raises:
54
65
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -60,6 +71,7 @@ def sync_detailed(
60
71
 
61
72
  kwargs = _get_kwargs(
62
73
  agent_name=agent_name,
74
+ environment=environment,
63
75
  )
64
76
 
65
77
  response = client.get_httpx_client().request(
@@ -73,11 +85,13 @@ def sync(
73
85
  agent_name: str,
74
86
  *,
75
87
  client: AuthenticatedClient,
88
+ environment: Union[Unset, str] = UNSET,
76
89
  ) -> Optional[Agent]:
77
90
  """Get agent by name
78
91
 
79
92
  Args:
80
93
  agent_name (str):
94
+ environment (Union[Unset, str]):
81
95
 
82
96
  Raises:
83
97
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -90,6 +104,7 @@ def sync(
90
104
  return sync_detailed(
91
105
  agent_name=agent_name,
92
106
  client=client,
107
+ environment=environment,
93
108
  ).parsed
94
109
 
95
110
 
@@ -97,11 +112,13 @@ async def asyncio_detailed(
97
112
  agent_name: str,
98
113
  *,
99
114
  client: AuthenticatedClient,
115
+ environment: Union[Unset, str] = UNSET,
100
116
  ) -> Response[Agent]:
101
117
  """Get agent by name
102
118
 
103
119
  Args:
104
120
  agent_name (str):
121
+ environment (Union[Unset, str]):
105
122
 
106
123
  Raises:
107
124
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -113,6 +130,7 @@ async def asyncio_detailed(
113
130
 
114
131
  kwargs = _get_kwargs(
115
132
  agent_name=agent_name,
133
+ environment=environment,
116
134
  )
117
135
 
118
136
  response = await client.get_async_httpx_client().request(**kwargs)
@@ -124,11 +142,13 @@ async def asyncio(
124
142
  agent_name: str,
125
143
  *,
126
144
  client: AuthenticatedClient,
145
+ environment: Union[Unset, str] = UNSET,
127
146
  ) -> Optional[Agent]:
128
147
  """Get agent by name
129
148
 
130
149
  Args:
131
150
  agent_name (str):
151
+ environment (Union[Unset, str]):
132
152
 
133
153
  Raises:
134
154
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -142,5 +162,6 @@ async def asyncio(
142
162
  await asyncio_detailed(
143
163
  agent_name=agent_name,
144
164
  client=client,
165
+ environment=environment,
145
166
  )
146
167
  ).parsed