Skip to main content
PromptContext does not extend ExecutionContextBase but provides a similar interface for consistency.

Class Definition

Properties

Abstract Method

execute(args)

The main execution method that must be implemented.

Return Format

Prompts must return GetPromptResult:

Methods

Dependency Injection

get<T>(token)

Get a required dependency.

tryGet<T>(token)

Try to get an optional dependency.

Response Methods

respond(value)

Set output and end execution immediately.

Scope Access

scope

Get the current scope with all registries.

Execution Tracking

mark(stage)

Mark current execution stage.

Error Handling

fail(err)

Fail execution with an error.

History

outputHistory

History of output changes. Entries are HistoryEntry records:

Content Types

Text Content

Image Content

Embedded Resource

Basic Example

Multi-Turn Conversation

With Template Engine

Full Example

@Prompt

Prompt decorator

PromptRegistry

Prompt registry

@Tool

Tool decorator

@Agent

Agent decorator