MCPcopy Create free account
hub / github.com/FastMAS/KVCOMM / _async_execute

Method _async_execute

KVCOMM/agents/final_decision.py:558–608  ·  view source on GitHub ↗

Handle asynchronous execution across different KV cache strategies.

(self, input:Dict[str,str],  spatial_info:Dict[str,Any], temporal_info:Dict[str,Any], mode: str = "default", **kwargs)

Source from the content-addressed store, hash-verified

556 return response
557
558 async def _async_execute(self, input:Dict[str,str], spatial_info:Dict[str,Any], temporal_info:Dict[str,Any], mode: str = "default", **kwargs):
559 """Handle asynchronous execution across different KV cache strategies."""
560 if self.domain == 'humaneval':
561 self.internal_tests = self.extract_example(input)
562 if mode == "default":
563 request_uid = input.get("_request_uid")
564 inputs = await self._process_inputs(
565 input,
566 spatial_info,
567 temporal_info,
568 mode=mode,
569 **kwargs,
570 )
571 message = [{'role':'system','content':inputs["system_prompt"]},{'role':'user','content':inputs["user_prompt"]}]
572 result = await self.llm.agen(
573 message,
574 request_uid=request_uid,
575 agent_id=self.id,
576 agent_name=self.agent_name,
577 agent_role=self.role,
578 )
579 return result
580
581 request_uid = input.get("_request_uid") or kwargs.get("request_uid")
582 if request_uid is None:
583 raise ValueError("request_uid is required for request-scoped anchor updates.")
584
585 mode_data = await self._process_inputs(
586 input,
587 spatial_info,
588 temporal_info,
589 mode="allow_kv_reuse",
590 **kwargs,
591 )
592 if mode_data["early_response"] is not None:
593 early = GenerationResult(
594 text=mode_data["early_response"],
595 mode="kv_reuse" if mode == "allow_kv_reuse" else mode,
596 ttft=0.0,
597 )
598 return input['task'], early
599 result = await self.llm.generate_for_agent(
600 request_uid=request_uid,
601 message=input['task'],
602 preferred_mode=mode_data["preferred_mode"],
603 output_dir=kwargs.get("output_dir"),
604 agent_id=self.id,
605 agent_name=self.agent_name,
606 agent_role=self.role,
607 )
608 return input['task'], result
609
610@AgentRegistry.register('FinalDirect')
611class FinalDirect(Node):

Callers

nothing calls this directly

Calls 6

extract_exampleMethod · 0.95
_process_inputsMethod · 0.95
GenerationResultClass · 0.90
generate_for_agentMethod · 0.80
getMethod · 0.45
agenMethod · 0.45

Tested by

no test coverage detected