MCPcopy Index your code
hub / github.com/AI45Lab/Code / start

Method start

core/src/agent_api/runtime.rs:57–82  ·  view source on GitHub ↗
(
        session: &AgentSession,
        prompt: &str,
        persistence: Option<SessionPersistenceContext>,
    )

Source from the content-addressed store, hash-verified

55
56impl BlockingRunContext {
57 pub(super) async fn start(
58 session: &AgentSession,
59 prompt: &str,
60 persistence: Option<SessionPersistenceContext>,
61 ) -> Self {
62 let run = RunControlState::from_session(session)
63 .start_run(prompt)
64 .await;
65 let run_id = run.id().to_string();
66 let mut agent_loop = build_agent_loop(session);
67 agent_loop.set_checkpoint_run(&run_id);
68 let (runtime_tx, runtime_rx) = mpsc::channel(2048);
69 let runtime_collector =
70 RuntimeEventSink::from_session(session, &run_id).spawn_collector(runtime_rx);
71 let lifecycle = BlockingRunLifecycle::from_session(session, &run_id, persistence);
72 let cancel_token = session.session_cancel.child_token();
73 lifecycle.set_cancel_token(cancel_token.clone()).await;
74
75 Self {
76 agent_loop,
77 runtime_tx,
78 cancel_token,
79 runtime_collector,
80 lifecycle,
81 }
82 }
83
84 pub(super) async fn execute_with_prompt(
85 self,

Callers 2

build_command_queueFunction · 0.45
mainFunction · 0.45

Calls 9

build_agent_loopFunction · 0.85
start_runMethod · 0.80
set_checkpoint_runMethod · 0.80
spawn_collectorMethod · 0.80
worker_stateMethod · 0.80
spawn_forwarderMethod · 0.80
idMethod · 0.45
set_cancel_tokenMethod · 0.45
cloneMethod · 0.45

Tested by 1

mainFunction · 0.36