adk-typescript
Version:
TypeScript port of Google's Agent Development Kit (ADK)
42 lines (41 loc) • 1.62 kB
TypeScript
import { Content, Part } from '../models/types';
import { InvocationContext } from './InvocationContext';
import { ReadonlyContext } from './ReadonlyContext';
import { EventActions } from '../events/EventActions';
import { State } from '../sessions/State';
/**
* Callback context for agent invocations.
* Provides mutable access to the agent's state and context.
*/
export declare class CallbackContext extends ReadonlyContext {
private eventActions;
private mutableState;
constructor(invocationContext: InvocationContext, eventActions?: EventActions);
/**
* The delta-aware state of the current session.
*
* For any state change, you can mutate this object directly,
* e.g. `ctx.state['foo'] = 'bar'`
*/
get state(): State;
/**
* The user content that started this invocation. READONLY field.
*/
get userContent(): Content | undefined;
/**
* Loads an artifact attached to the current session.
*
* @param filename The filename of the artifact.
* @param version The version of the artifact. If undefined, the latest version will be returned.
* @returns The artifact, or undefined if not found.
*/
loadArtifact(filename: string, version?: number): Part | undefined | Promise<Part | undefined>;
/**
* Saves an artifact and records it as delta for the current session.
*
* @param filename The filename of the artifact.
* @param artifact The artifact to save.
* @returns The version of the artifact.
*/
saveArtifact(filename: string, artifact: Part): number | Promise<number>;
}