google / google/adk-js

No way to add `temp:variable` during `Runner.runAsync`

Open
#260 3 comments 0 reactions 1 assignee Claimed by @kalenkevich View on GitHub
enhancement needs review
Dominant language
TypeScript
Stars
1.4k
Forks
205
Avg merge
3d 16h
Merged PRs (30d)
92

Description

**Is your feature request related to a problem? Please describe.**

There's no way to inject a temporary variable into the session state at the start of an invocation. The `temp:` prefixed variables are filtered out.

The workarounds I've thought through (like leveraging plugins) seem over the top.

**Describe the solution you'd like**

Add a way for the caller access the invocation context or the session during/after the call to `Runner.runAsync`.

For instance:

```js
runner.runAsync({
// existing params
beforeRunCallback: ({ invocationContext }) => {
invocationContext.session.state.set('temp:var', 'value')
},
})
```

**Describe alternatives you've considered**

This is roughly how plugins work, but plugins don't have a way to access the local scope in which `runner.runAsync` was called (unless a new runner is created which doesn't seem to be recommended for long running processes like API servers).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.