Sets the task for the agent
(self, task: str)
| 63 | self._function_result: Optional[FunctionResult] = None |
| 64 | |
| 65 | def set_task(self, task: str): |
| 66 | """ |
| 67 | Sets the task for the agent |
| 68 | """ |
| 69 | set_task_response = post( |
| 70 | base_url=self._base_url, |
| 71 | api_key=self._api_key, |
| 72 | endpoint=f"/v2/agents/{self._agent_id}/tasks", |
| 73 | data={"task": task}, |
| 74 | ) |
| 75 | # response_json = set_task_response.json() |
| 76 | |
| 77 | # if set_task_response.status_code != 200: |
| 78 | # raise ValueError(f"Failed to assign task: {response_json}") |
| 79 | |
| 80 | # task ID |
| 81 | self._submission_id = set_task_response["submission_id"] |
| 82 | |
| 83 | return self._submission_id |
| 84 | |
| 85 | def _get_action( |
| 86 | self, |