Skip to content

feat(runner): add NewInMemory convenience constructor#1133

Merged
wolo-lab merged 2 commits into
mainfrom
wolo/inmemory-runner
Jul 8, 2026
Merged

feat(runner): add NewInMemory convenience constructor#1133
wolo-lab merged 2 commits into
mainfrom
wolo/inmemory-runner

Conversation

@wolo-lab

@wolo-lab wolo-lab commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Problem:
runner.New requires callers to assemble and pass services explicitly and
fails when SessionService is nil (runner/runner.go:95). There is no
Python/Java-style InMemoryRunner convenience that auto-wires in-memory
services, so every local/dev/test setup must construct the session, artifact,
and memory services (and pre-create a session) by hand.

Solution:
Add runner.NewInMemory(appName, agent), mirroring adk-python's
InMemoryRunner. It wires the in-memory session, artifact, and memory services
and enables session auto-creation, so a Runner can be built and run with zero
manual service/session setup. Auto-creation is required (not merely a default)
because the helper owns its services and Runner exposes no service accessor;
without it the first Run would always fail with "session not found" and the
caller could not recover. The change is purely additive and
backward-compatible — runner.New is unchanged.

Mirror adk-python's InMemoryRunner: NewInMemory wires the in-memory
session, artifact, and memory services and enables session
auto-creation, so local development and tests can build a Runner without
manually assembling services or pre-creating a session.

Auto-creation is required (not just a default) because the helper owns
its services and exposes no accessor on Runner; without it the returned
Runner's first Run would always fail with "session not found" and the
caller would have no way to recover. Purely additive and
backward-compatible; runner.New is unchanged.
@wolo-lab wolo-lab requested a review from hanorik July 8, 2026 07:12
@wolo-lab wolo-lab marked this pull request as ready for review July 8, 2026 07:12
@wolo-lab wolo-lab merged commit 11b4e72 into main Jul 8, 2026
9 checks passed
@wolo-lab wolo-lab deleted the wolo/inmemory-runner branch July 8, 2026 14:23
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.

2 participants