| 223 | # ── Test 6: Agent-driven (session.send) ────────────────────────────────── |
| 224 | |
| 225 | def test_agent_driven(): |
| 226 | result = session.send( |
| 227 | 'Use the generate_object tool to produce a JSON object with schema ' |
| 228 | '{"type":"object","required":["language","paradigm"],"properties":' |
| 229 | '{"language":{"type":"string"},"paradigm":{"type":"string"}}} ' |
| 230 | 'for the following: "Rust is a systems programming language with a focus on safety."' |
| 231 | ) |
| 232 | assert result.text is not None |
| 233 | # Agent should have used the tool |
| 234 | print(f" Tool calls: {result.tool_calls_count}, tokens: {result.total_tokens}") |
| 235 | |
| 236 | run_test("generate_object: agent-driven via session.send", test_agent_driven) |
| 237 | |