ADK for TypeScript: API Reference
    Preparing search index...

    Function injectSessionState

    • Populates values in the instruction template, e.g. state, artifact, etc.

      async function buildInstruction(
      readonlyContext: ReadonlyContext,
      ): Promise<string> {
      return await injectSessionState(
      'You can inject a state variable like {var_name} or an artifact ' +
      '{artifact.file_name} into the instruction template.',
      readonlyContext,
      );
      }

      const agent = new LlmAgent({
      model: 'gemini-1.5-flash',
      name: 'agent',
      instruction: buildInstruction,
      });

      Parameters

      • template: string

        The instruction template.

      • readonlyContext: ReadonlyContext

        The read-only context

      Returns Promise<string>

      The instruction template with values populated.