PromptContext does not extend ExecutionContextBase but provides a similar interface for consistency.Class Definition
Properties
| Property | Type | Description |
|---|---|---|
metadata | PromptMetadata | Prompt metadata (name, description, etc.) |
args | Record<string, string> | Arguments passed to the prompt |
output | GetPromptResult | undefined | Prompt result (after execution) |
promptName | string | Prompt name |
promptId | string | Prompt ID |
authInfo | AuthInfo | Authentication information |
runId | string | Unique execution identifier |
Abstract Method
execute(args)
The main execution method that must be implemented.Return Format
Prompts must returnGetPromptResult:
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.Content Types
Text Content
Image Content
Embedded Resource
Basic Example
Multi-Turn Conversation
With Template Engine
Full Example
Related
@Prompt
Prompt decorator
PromptRegistry
Prompt registry
@Tool
Tool decorator
@Agent
Agent decorator