Skip to content

feat: client.agent - build with the pre.dev agent from code (Node + Python, 1.2.0) + tag-triggered release workflow - #2

Merged
adamelk merged 3 commits into
mainfrom
feat/agent-methods
Dec 5, 2026
Merged

adamelk merged 3 commits into
mainfrom
feat/agent-methods

Conversation

@adamelk

@adamelk adamelk commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

What

An agent namespace in both SDKs over the new Agent API (backend: arjunpredev/predev-app#2671).

Node Python Route
agent.createProject({prompt, mode?, model?, idempotencyKey?}) agent.create_project(prompt, mode=, model=, idempotency_key=) POST /agent/projects
agent.send(id, {message, sessionId?, mode?, model?}) agent.send(id, message, session_id=, mode=, model=) POST /agent/projects/:id/messages
agent.stream(id, {sessionId?, cursor?, untilDone?, maxReconnects?, signal?}) (async generator) agent.stream(id, session_id=, cursor=, until_done=, max_reconnects=) (iterator) GET /agent/projects/:id/events (SSE)
agent.buildNext(id, {task?, sessionId?, maxCredits?}) agent.build_next(id, task=, session_id=, max_credits=) POST /agent/projects/:id/build
agent.buildAll(id, {maxCredits?}) agent.build_all(id, max_credits=) same, all: true
agent.status(id, {sessionId?}) agent.status(id, session_id=) GET /agent/projects/:id/status
agent.stop(id, {sessionId?}) agent.stop(id, session_id=) POST /agent/projects/:id/stop
  • stream parses SSE, skips heartbeats, ends after done by default, and reconnects from the last cursor event when the connection drops.
  • Errors use the existing typed exceptions ({ error, code } bodies → RateLimitError, InsufficientCreditsError, ...).
  • README sections in both packages and the root README. Version is 1.2.0 in package.json, setup.py and __init__.py. Not published.

Release workflow

.github/workflows/release.yml runs on a pushed v* tag. It checks that the tag matches all three versions, runs make check, then publishes to npm (--provenance, NPM_TOKEN) and PyPI (PYPI_API_TOKEN). Both secrets need adding to the repo before the first tag. No tag pushed. scripts/deploy.sh is unchanged.

Note on the python diff

Touching client.py makes the changed-files ruff gate apply to the whole file. A separate style(python) commit makes it ruff-clean (autofix + format, mechanical). It adds from __future__ import annotations so the rewritten X | None annotations still work on 3.8/3.9 (python_requires >=3.8). Tests pass on 3.9 and on uv's default.

Tests

  • make check: ruff clean on changed files; pytest 35 passed (11 new in tests/test_agent.py)
  • predev-api-node: npx vitest run 32 passed (7 new in src/agent.test.ts); npx tsc --noEmit clean

🤖 Generated with Claude Code

https://claude.ai/code/session_01PwA31qPkrcHj7kogbsmWS4

Smoke Person and others added 3 commits December 5, 2026 01:15
Mechanical only: ruff 0.16.5 --fix + format (the changed-files gate
enforces it on any touched file). `from __future__ import annotations`
keeps the rewritten `X | None` annotations valid on Python 3.8/3.9
(setup.py python_requires >=3.8). The two findings ruff cannot fix are
handled by hand: the upload file handle is closed by requests (noqa
SIM115), and the JSON error-body parse catches ValueError instead of
Exception. Unused exception imports dropped (still exported from
predev_api/__init__.py).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PwA31qPkrcHj7kogbsmWS4
…am, build next/all, status, stop); 1.2.0

Both SDKs get an `agent` namespace over the new Agent API
(/agent/projects/...):
- Node: createProject, send, stream (async generator), buildNext,
  buildAll, status, stop; typed events and results
- Python: create_project, send, stream (iterator), build_next,
  build_all, status, stop
stream() parses SSE, skips heartbeats, ends after `done` by default, and
reconnects from the last `cursor` event when the connection drops.
Errors map to the existing typed exceptions ({ error, code } bodies).

Tests mock HTTP (vitest 7, pytest 11). README sections in both packages.
Version 1.2.0 (not published).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PwA31qPkrcHj7kogbsmWS4
Pushing `vX.Y.Z` checks the tag matches package.json, setup.py and
__init__.py, runs make check, then publishes predev-api to npm (with
provenance, NPM_TOKEN) and PyPI (PYPI_API_TOKEN). Documented under
Releasing in the root README. scripts/deploy.sh stays for manual releases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PwA31qPkrcHj7kogbsmWS4
@adamelk
adamelk merged commit e952aed into main Dec 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant