Understanding the class hierarchy is like knowing your agent’s family tree. Here’s how everything connects:
Agent Class Hierarchy
Copy
namespace Vizra\VizraADK\Agents;abstract class BaseAgent{ // Base contract for all agents}abstract class BaseLlmAgent extends BaseAgent{ // LLM-powered agent implementation}
Type:string (required)Your agent’s unique identifier. Like a superhero name, it should be memorable and descriptive. No two agents can share the same name.
Copy
protected string $name = 'customer_support';
$description
Type:string (required)Tell everyone what your agent does. This human-readable description helps you and your team understand the agent’s purpose at a glance.
Copy
protected string $description = 'Helps customers with support inquiries';
public static function run(mixed $input): AgentExecutor
The run() method creates a fluent agent executor that you can configure with various options before executing. It’s your Swiss Army knife for all agent interactions.
Whether you’re asking questions, processing data, analyzing events, or monitoring systems - it all starts with run(). The input you provide and the context you set determine what your agent does.
Perfect for chat-like interactions where you need natural language responses.
Copy
// Ask a question$response = CustomerSupportAgent::run('Where is my order?') ->forUser($user) ->go();// Have a conversation with context$response = CustomerSupportAgent::run('I need help with shipping') ->withSession($sessionId) ->withContext(['order_id' => $orderId]) ->go();
// Execute the agent's primary logic (must be implemented)public function run(mixed $input, AgentContext $context): mixed// Get agent propertiespublic function getName(): stringpublic function getDescription(): string
// Getterspublic function getModel(): stringpublic function getProvider(): Providerpublic function getInstructions(): stringpublic function getInstructionsWithMemory(AgentContext $context): stringpublic function getTemperature(): ?floatpublic function getMaxTokens(): ?intpublic function getTopP(): ?floatpublic function getStreaming(): bool// Setterspublic function setInstructions(string $instructions): staticpublic function setModel(string $model): staticpublic function setProvider(Provider $provider): staticpublic function setTemperature(?float $temperature): staticpublic function setMaxTokens(?int $maxTokens): staticpublic function setTopP(?float $topP): staticpublic function setStreaming(bool $streaming): static
// Prompt version managementpublic function setPromptVersion(?string $version): staticpublic function getPromptVersion(): ?stringpublic function setPromptOverride(string $prompt): staticpublic function getAvailablePromptVersions(): array
// Called before sending messages to LLMpublic function beforeLlmCall(array $inputMessages, AgentContext $context): array{ // Modify messages, start tracing, etc. return $inputMessages;}// Called after receiving LLM responsepublic function afterLlmResponse(Response|Generator $response, AgentContext $context): mixed{ // Process response, access token usage, etc. return $response;}// Called before tool executionpublic function beforeToolCall(string $toolName, array $arguments, AgentContext $context): array{ // Modify tool arguments before execution return $arguments;}// Called after tool executionpublic function afterToolResult(string $toolName, string $result, AgentContext $context): string{ // Process tool results return $result;}
// Called before delegating to sub-agentpublic function beforeSubAgentDelegation( string $subAgentName, string $taskInput, string $contextSummary, AgentContext $parentContext): array{ // Returns [subAgentName, taskInput, contextSummary] return [$subAgentName, $taskInput, $contextSummary];}// Called after sub-agent completespublic function afterSubAgentDelegation( string $subAgentName, string $taskInput, string $subAgentResult, AgentContext $parentContext, AgentContext $subAgentContext): string{ // Process and return the result return $subAgentResult;}