Repository: run-llama/llama_deploy

Issue:
Error: 'ModelWrapper' object has no attribute 'tasks'
I did nothing else than set up the quickstart to run it locally.
python -m llama_deploy.apiserver                                          
INFO:     Started server process [98674]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:4501 (Press CTRL+C to quit)
INFO:     127.0.0.1:55026 - "POST /deployments/create HTTP/1.1" 200 OK
INFO:llama_deploy.message_queues.simple - Launching message queue server at 127.0.0.1:8001
INFO:     Started server process [98674]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8001 (Press CTRL+C to quit)
INFO:llama_deploy.message_queues.simple - Consumer ControlPlaneServer-d5a9b353-e3e1-4a09-ace2-46960fd4724f: control_plane has been registered.
INFO:     127.0.0.1:55027 - "POST /register_consumer HTTP/1.1" 200 OK
INFO:llama_deploy.control_plane.server - Launching control plane server at 127.0.0.1:8000
INFO:     Started server process [98674]
INFO:     Waiting for application startup.
INFO:llama_deploy.services.workflow - Launching echo_workflow server at 0.0.0.0:8002
INFO:     Started server process [98674]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:llama_deploy.services.workflow - Processing initiated.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Uvicorn running on http://0.0.0.0:8002 (Press CTRL+C to quit)
INFO:llama_deploy.message_queues.simple - Consumer WorkflowService-413b09e4-a3ee-462d-98e0-8c0052b98b92: echo_workflow has been registered.
INFO:     127.0.0.1:55028 - "POST /register_consumer HTTP/1.1" 200 OK
INFO:     127.0.0.1:55029 - "POST /services/register HTTP/1.1" 200 OK
^CINFO:     Shutting down
INFO:     Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:     Finished server process [98674]

llamactl deploy deployment.yml                                            
Deployment successful: QuickStart

However when I try to send a message to it:
llamactl run --deployment QuickStart --arg message 'Hello from my shell!'
Error: 'ModelWrapper' object has no attribute 'tasks'

Any idea?

pydantic==2.9.2
python-dotenv==1.0.1
llama-index==0.12.1
llama-index-core==0.12.1
llama-deploy==0.3.4
llama-index-llms-azure-openai==0.3.0


Discussion:
This should fix it https://github.com/run-llama/llama_deploy/pull/384



Patch:
diff --git a/llama_deploy/cli/run.py b/llama_deploy/cli/run.py
index f0cc791b..65e71803 100644
--- a/llama_deploy/cli/run.py
+++ b/llama_deploy/cli/run.py
@@ -36,7 +36,8 @@ def run(
         payload["agent_id"] = service
 
     try:
-        result = client.sync.apiserver.deployments.tasks.run(TaskDefinition(**payload))
+        d = client.sync.apiserver.deployments.get(deployment)
+        result = d.tasks.run(TaskDefinition(**payload))
     except Exception as e:
         raise click.ClickException(str(e))
 


Test patch:
diff --git a/tests/cli/test_run.py b/tests/cli/test_run.py
index 61b67486..41b4bc80 100644
--- a/tests/cli/test_run.py
+++ b/tests/cli/test_run.py
@@ -8,10 +8,11 @@
 
 
 def test_run(runner: CliRunner) -> None:
-    mocked_result = mock.MagicMock(id="test_deployment")
     with mock.patch("llama_deploy.cli.run.Client") as mocked_client:
-        mocked_client.return_value.sync.apiserver.deployments.tasks.run.return_value = (
-            mocked_result
+        mocked_deployment = mock.MagicMock()
+        mocked_deployment.tasks.run.return_value = mock.MagicMock(id="test_deployment")
+        mocked_client.return_value.sync.apiserver.deployments.get.return_value = (
+            mocked_deployment
         )
 
         result = runner.invoke(
@@ -23,7 +24,7 @@ def test_run(runner: CliRunner) -> None:
             api_server_url="http://localhost:4501", disable_ssl=False, timeout=120.0
         )
 
-        args = mocked_client.return_value.sync.apiserver.deployments.tasks.run.call_args
+        args = mocked_deployment.tasks.run.call_args
         actual = args[0][0]
         expected = TaskDefinition(agent_id="service_name", input="{}")
         assert expected.input == actual.input
@@ -34,7 +35,7 @@ def test_run(runner: CliRunner) -> None:
 
 def test_run_error(runner: CliRunner) -> None:
     with mock.patch("llama_deploy.cli.run.Client") as mocked_client:
-        mocked_client.return_value.sync.apiserver.deployments.tasks.run.side_effect = (
+        mocked_client.return_value.sync.apiserver.deployments.get.side_effect = (
             httpx.HTTPStatusError(
                 "test error", response=mock.MagicMock(), request=mock.MagicMock()
             )
@@ -47,10 +48,11 @@ def test_run_error(runner: CliRunner) -> None:
 
 
 def test_run_args(runner: CliRunner) -> None:
-    mocked_result = mock.MagicMock(id="test_deployment")
     with mock.patch("llama_deploy.cli.run.Client") as mocked_client:
-        mocked_client.return_value.sync.apiserver.deployments.tasks.run.return_value = (
-            mocked_result
+        mocked_deployment = mock.MagicMock()
+        mocked_deployment.tasks.run.return_value = mock.MagicMock(id="test_deployment")
+        mocked_client.return_value.sync.apiserver.deployments.get.return_value = (
+            mocked_deployment
         )
 
         result = runner.invoke(
@@ -68,7 +70,7 @@ def test_run_args(runner: CliRunner) -> None:
             ],
         )
 
-        args = mocked_client.return_value.sync.apiserver.deployments.tasks.run.call_args
+        args = mocked_deployment.tasks.run.call_args
         actual = args[0][0]
         expected = TaskDefinition(
             input='{"first_arg": "first_value", "second_arg": "\\"second value with spaces\\""}',