VS Code Hello World#
Source: examples/agents/vscode_hello_world.py
Introduction#
This example is intentionally self-contained so the VS Code launch configuration can run on a fresh checkout
without a live model server. It still exercises the public DirectLLMCall API, which makes it useful for
verifying that the virtual environment, debugger, editable install, and PYTHONPATH wiring are all correct.
Technical Implementation#
Define a tiny local client that implements
generate(...)and returns a deterministicLLMResponse.Construct
DirectLLMCallusing only the public top-level package API.Run one prompt through the direct-call path and collect the normalized execution summary.
Print JSON output so the VS Code debugger and terminal show one obvious success signal.
flowchart LR
A["Press F5 in VS Code"] --> B["vscode_hello_world.py"]
B --> C["_HelloWorldLLMClient.generate(...)"]
B --> D["DirectLLMCall.run(...)"]
C --> D
D --> E["ExecutionResult.summary()"]
E --> F["JSON output in integrated terminal"]
1from __future__ import annotations
2
3import json
4
5import design_research_agents as drag
6
7
8class _HelloWorldLLMClient:
9 """Minimal deterministic client used by the VS Code onboarding example."""
10
11 def generate(self, request: drag.LLMRequest) -> drag.LLMResponse:
12 del request
13 return drag.LLMResponse(
14 text="Hello from the VS Code onboarding example.",
15 model=self.default_model(),
16 provider="local-vscode-stub",
17 )
18
19 def default_model(self) -> str:
20 return "vscode-local-stub"
21
22 def close(self) -> None:
23 return None
24
25 def __enter__(self) -> _HelloWorldLLMClient:
26 return self
27
28 def __exit__(self, exc_type: object, exc: object, tb: object) -> None:
29 del exc_type, exc, tb
30 self.close()
31 return None
32
33
34def main() -> None:
35 """Run one deterministic direct-LLM example for VS Code onboarding."""
36 with _HelloWorldLLMClient() as llm_client:
37 agent = drag.DirectLLMCall(
38 llm_client=llm_client,
39 system_prompt="You are a friendly onboarding assistant.",
40 )
41 result = agent.run(
42 prompt="Say hello to a new design research teammate.",
43 request_id="example-vscode-hello-world-001",
44 )
45
46 print(json.dumps(result.summary(), ensure_ascii=True, indent=2, sort_keys=True))
47
48
49if __name__ == "__main__":
50 main()
Expected Results#
Run Command
PYTHONPATH=src python3 examples/agents/vscode_hello_world.py
Example output shape (values vary by run):
{
"success": true,
"final_output": "Hello from the VS Code onboarding example.",
"terminated_reason": null,
"error": null
}