MCPcopy Create free account
hub / github.com/AI45Lab/Code / spawn_with_prompt

Method spawn_with_prompt

core/src/agent_api/runtime.rs:192–220  ·  view source on GitHub ↗
(
        self,
        messages: Vec<Message>,
        prompt: String,
    )

Source from the content-addressed store, hash-verified

190 }
191
192 pub(super) fn spawn_with_prompt(
193 self,
194 messages: Vec<Message>,
195 prompt: String,
196 ) -> (mpsc::Receiver<AgentEvent>, JoinHandle<()>) {
197 let Self {
198 agent_loop,
199 runtime_tx,
200 session_id,
201 cancel_token,
202 worker_state,
203 forwarder,
204 lifecycle,
205 rx,
206 } = self;
207 let handle = tokio::spawn(async move {
208 let result = agent_loop
209 .execute_with_session(
210 &messages,
211 &prompt,
212 Some(&session_id),
213 Some(runtime_tx),
214 Some(&cancel_token),
215 )
216 .await;
217 worker_state.complete(result).await;
218 });
219 (rx, lifecycle.wrap(handle, forwarder))
220 }
221
222 pub(super) fn spawn_from_messages(
223 self,

Callers 1

streamFunction · 0.80

Calls 3

execute_with_sessionMethod · 0.80
wrapMethod · 0.80
completeMethod · 0.45

Tested by

no test coverage detected