Skip to content

Automation: JSON output, a Python API and a GitHub Action for self-hosted runners #48

Closed

Description

@nasser1941

Problem

lcode -p prints text for humans. Scripts, CI and other tools need structured results. Teams also want lcode to work on issues and pull requests using their own GPU machines.

Proposal

  • Structured output: lcode -p "…" --output json | stream-json returns the final answer, tool calls, files changed, token usage and exit status. --max-steps and --allowed-tools limit a run.
  • A Python API: from lcode import Session lets a program run requests and read the results.
  • A GitHub Action for self-hosted runners with a GPU and Ollama:
    • It answers @lcode in issues and pull requests.
    • It proposes changes as a pull request and reviews diffs.
    • No code leaves the runner.

Acceptance criteria

  • --output json and stream-json, with a documented schema
  • A Python API with an example
  • An Action that works on a self-hosted runner (example workflow in the docs)

Activity

  1. nasser1941 commented on Oct 5, 2026

    @nasser1941
    OwnerAuthor

    Shipped in 0.18.0 (#81). See Automation.

    • lcode -p "…" --output json | stream-json, with --max-steps and --allowed-tools.
    • from lcode import Session, with an example in examples/api/fix_tests.py.
    • uses: nasser1941/lcode@v0.18.0 for self-hosted runners: it answers @lcode and can review pull requests.

    Tested with Qwen3.6 35B through Ollama, also from the PyPI build:

    • --output json: fixed the bugs and reported calc.py changed, with the usage.
    • --output stream-json --max-steps 3: the expected events, and exit code 3.
    • The Python example: it approved only the test command; done in 5 model requests.
    • lcode action on a simulated @lcode issue comment, against a stand-in GitHub API and a bare remote.
      • lcode reacted to the comment and ran the tests (allow-commands), then pushed a branch with the fix as lcode.
      • It opened a pull request that closes the issue and replied with a summary.
      • Earlier versions had the model try to commit and then say so. Now git is denied to the model and the reply is written after the change is proposed.

    Not yet tried on a real GitHub self-hosted runner: that needs a runner registered to a repository. Reports from anyone who sets it up are welcome here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions