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

Method close

sdk/python/src/lib.rs:1387–1390  ·  view source on GitHub ↗

Close every live session created from this agent and disconnect background resources owned by the agent (global MCP connections). After this call, ``agent.session(...)`` and ``agent.resume_session(...)`` raise ``RuntimeError`` with a "Session closed" message. Idempotent.

(&self, py: Python<'_>)

Source from the content-addressed store, hash-verified

1385 /// After this call, ``agent.session(...)`` and ``agent.resume_session(...)``
1386 /// raise ``RuntimeError`` with a "Session closed" message. Idempotent.
1387 fn close(&self, py: Python<'_>) {
1388 let agent = self.inner.clone();
1389 py.allow_threads(move || get_runtime().block_on(agent.close()));
1390 }
1391
1392 /// Whether ``close()`` has been called on this agent.
1393 #[getter]

Callers 3

mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls 3

block_onMethod · 0.80
get_runtimeFunction · 0.70
cloneMethod · 0.45

Tested by 3

mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36