Direct LLM Call =============== Source: ``examples/agents/direct_llm_call.py`` Introduction ------------ Engineering-design studies show that transparent prompt-to-response traces are essential for credible evaluation and human oversight; the benchmark framing in Toward Engineering AGI and the collaboration framing in Human-AI collaboration by design both depend on this visibility, while llama.cpp server docs ground practical local deployment. This example is the smallest reproducible path for observing one direct call end to end with runtime traces. Technical Implementation ------------------------ 1. Configure ``Tracer`` with JSONL + console output so each run emits machine-readable traces and lifecycle logs. 2. Build the runtime surface (public APIs only) and execute ``DirectLLMCall.run(...)`` with a fixed ``request_id``. 3. Capture structured outputs from runtime execution and preserve termination metadata for analysis. 4. Print a compact JSON payload including ``trace_info`` for deterministic tests and docs examples. .. mermaid:: flowchart LR A["Input prompt or scenario"] --> B["main(): runtime wiring"] B --> C["DirectLLMCall.run(...)"] C --> D["WorkflowRuntime executes one direct call"] C --> E["Tracer JSONL + console events"] D --> F["ExecutionResult/payload"] E --> F F --> G["Printed JSON output"] .. literalinclude:: ../../../examples/agents/direct_llm_call.py :language: python :lines: 53- :linenos: Expected Results ---------------- .. rubric:: Run Command .. code-block:: bash PYTHONPATH=src python3 examples/agents/direct_llm_call.py Example output shape (values vary by run): .. code-block:: text { "success": true, "final_output": "", "terminated_reason": "", "error": null, "trace": { "request_id": "", "trace_dir": "artifacts/examples/traces", "trace_path": "artifacts/examples/traces/run__.jsonl" } } References ---------- - `Toward Engineering AGI: Benchmarking the Engineering Design Capabilities of LLMs `_ - `Human-AI collaboration by design `_ - `llama.cpp llama-server docs `_