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

Function test_serve_with_script_tool

sdk/python/tests/test_serve.py:57–70  ·  view source on GitHub ↗

Unit (hermetic): serving a dir that contains a `tools/` `kind: script` spec succeeds. serve_agent_dir runs AgentDir::load synchronously (parsing tools/), so a malformed tool spec would raise here; a valid one yields a healthy handle that stops cleanly. No provider call is made.

()

Source from the content-addressed store, hash-verified

55
56
57def test_serve_with_script_tool() -> None:
58 """Unit (hermetic): serving a dir that contains a `tools/` `kind: script`
59 spec succeeds. serve_agent_dir runs AgentDir::load synchronously (parsing
60 tools/), so a malformed tool spec would raise here; a valid one yields a
61 healthy handle that stops cleanly. No provider call is made."""
62 agent = Agent.create(INLINE_CONFIG)
63 agent_dir = _write_agent_dir(with_schedule=False, with_tools=True)
64 workspace = tempfile.mkdtemp(prefix="a3s-code-serve-tools-ws-")
65
66 handle = agent.serve_agent_dir(agent_dir, workspace)
67 assert handle.is_stopped() is False, "a tools/ kind:script agent dir should serve"
68 handle.stop()
69 assert handle.is_stopped() is True
70 print("python sdk serve with kind:script tool ok")
71
72
73def test_serve_handle_lifecycle() -> None:

Callers 1

mainFunction · 0.85

Calls 5

_write_agent_dirFunction · 0.85
createMethod · 0.45
serve_agent_dirMethod · 0.45
is_stoppedMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected