MCPcopy Create free account
hub / github.com/agentrpc/agentrpc / create_and_poll_job

Method create_and_poll_job

sdk-python/src/agentrpc/http_client.py:130–160  ·  view source on GitHub ↗

Create a job and poll for completion. Args: cluster_id: The cluster ID. tool_name: The tool name. input_data: The input data. Returns: The final job status, result, and result type. Raises: AgentRPCError: If the r

(
        self, cluster_id: str, tool_name: str, input_data: Dict[str, Any]
    )

Source from the content-addressed store, hash-verified

128 return {"status": status, "result": result, "resultType": result_type}
129
130 def create_and_poll_job(
131 self, cluster_id: str, tool_name: str, input_data: Dict[str, Any]
132 ) -> Dict[str, str]:
133 """Create a job and poll for completion.
134
135 Args:
136 cluster_id: The cluster ID.
137 tool_name: The tool name.
138 input_data: The input data.
139
140 Returns:
141 The final job status, result, and result type.
142
143 Raises:
144 AgentRPCError: If the request fails.
145 """
146 # Create the job with maximum server-side wait time
147 create_result = self.create_job(
148 cluster_id=cluster_id,
149 tool_name=tool_name,
150 input_data=input_data,
151 )
152
153 # Poll for completion
154 return self.poll_for_job_completion(
155 cluster_id=cluster_id,
156 job_id=create_result.get("id"),
157 initial_status=create_result.get("status"),
158 initial_result=create_result.get("result") or "",
159 initial_result_type=create_result.get("resultType") or "rejection",
160 )
161
162 def get(self, path: str, params: Optional[Dict[str, Any]] = None) -> Any:
163 """Make a GET request to the API.

Callers

nothing calls this directly

Calls 3

create_jobMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected