MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / run_agent

Function run_agent

aiscript-vm/src/ai/agent.rs:335–348  ·  view source on GitHub ↗
(
    state: &mut State<'gc>,
    agent: Gc<'gc, Agent<'gc>>,
    args: Vec<Value<'gc>>,
)

Source from the content-addressed store, hash-verified

333}
334
335pub fn run_agent<'gc>(
336 state: &mut State<'gc>,
337 agent: Gc<'gc, Agent<'gc>>,
338 args: Vec<Value<'gc>>,
339) -> Value<'gc> {
340 if Handle::try_current().is_ok() {
341 // We're in an async context, use await
342 Handle::current().block_on(async { _run_agent(state, agent, args).await })
343 } else {
344 // We're in a sync context, create a new runtime
345 let runtime = tokio::runtime::Runtime::new().unwrap();
346 runtime.block_on(async { _run_agent(state, agent, args).await })
347 }
348}
349
350impl From<PrimitiveType> for JSONSchemaType {
351 fn from(ty: PrimitiveType) -> Self {

Callers 1

invokeMethod · 0.85

Calls 1

_run_agentFunction · 0.85

Tested by

no test coverage detected