# Get System Info (/examples/agent-os/skills/sample-skills/system-info/scripts/get-system-info)



Print useful host and Python runtime information as JSON.

```python title="get_system_info.py"
#!/usr/bin/env python3
"""Print useful host and Python runtime information as JSON."""

import json
import platform
import sys
from datetime import datetime, timezone
from pathlib import Path

# ---------------------------------------------------------------------------
# Create System Information
# ---------------------------------------------------------------------------


def collect_system_info() -> dict[str, str]:
    """Collect portable facts about the current host and Python runtime."""
    return {
        "architecture": platform.machine(),
        "current_time_utc": datetime.now(timezone.utc).isoformat(),
        "hostname": platform.node(),
        "os": platform.system(),
        "os_release": platform.release(),
        "processor": platform.processor(),
        "python_executable": str(Path(sys.executable).resolve()),
        "python_version": platform.python_version(),
    }


# ---------------------------------------------------------------------------
# Run System Information Script
# ---------------------------------------------------------------------------


def main() -> int:
    """Write one machine-readable system information document."""
    print(json.dumps(collect_system_info(), indent=2, sort_keys=True))
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
```

This is part of the [system-info skill bundle](/examples/agent-os/skills/basic). Its location relative to `basic.py` is `sample_skills/system-info/scripts/get_system_info.py`; keep the bundle's `SKILL.md` alongside the `scripts` directory. The linked setup downloads all required files.

## Run the Example [#run-the-example]

<Steps>
    <Step title="Set up your virtual environment">
      <CodeBlockTabs defaultValue="Mac">
        <CodeBlockTabsList>
          <CodeBlockTabsTrigger value="Mac">
            Mac
          </CodeBlockTabsTrigger>

          <CodeBlockTabsTrigger value="Windows">
            Windows
          </CodeBlockTabsTrigger>
        </CodeBlockTabsList>

        <CodeBlockTab value="Mac">
          ```bash
          uv venv --python 3.12
          source .venv/bin/activate
          ```
        </CodeBlockTab>

        <CodeBlockTab value="Windows">
          ```bash
          uv venv --python 3.12
          .venv\Scripts\activate
          ```
        </CodeBlockTab>
      </CodeBlockTabs>
    </Step>

  <Step title="Use the helper">
    The system-info skill executes this helper as a subprocess with no arguments. The pinned script prints JSON before its current main guard exits.
  </Step>
</Steps>

Full source: [cookbook/05\_agent\_os/23\_skills/sample\_skills/system-info/scripts/get\_system\_info.py](https://github.com/agno-agi/agno/blob/8f36eaf2d18e91afa7b327eec66a3cd3685dcb87/cookbook/05_agent_os/23_skills/sample_skills/system-info/scripts/get_system_info.py)
