Skip to content

AgentCallGraph

Namespace AgentPrism · Assembly AgentPrism.Core.dll

Validates an agent call graph at save time.

public static class AgentCallGraph

objectAgentCallGraph

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Validation is done with a depth-first search and separates three errors: unknown name, self-call, indirect cycle. All three break the save operation (400 Bad Request); if left to run time, the user only sees the error when they run the agent, in a message that is hard to diagnose.

Static validation alone is not enough. An agent registered via a code-side factory does not carry a declarative definition and appears as a leaf in the graph; in reality it may still be calling other agents. The second line of defense is the run-time depth counter (AgentRunBudget.MaxDepth).

Validate(string, IReadOnlyList<string>, IReadOnlyList<AgentDescriptor>)

Section titled “ Validate(string, IReadOnlyList<string>, IReadOnlyList<AgentDescriptor>)”

Validates a definition’s call graph.

public static string? Validate(string agentName, IReadOnlyList<string> callableAgentNames, IReadOnlyList<AgentDescriptor> descriptors)

agentName string

Name of the agent being validated.

callableAgentNames IReadOnlyList<string>

Names of the agents this agent wants to call.

descriptors IReadOnlyList<AgentDescriptor>

All agent summaries in the catalog.

string?

A user-displayable description when there is a problem; null when the graph is valid.

ArgumentNullException

One of the parameters is null.

ValidateDetailed(string, IReadOnlyList<string>, IReadOnlyList<AgentDescriptor>)

Section titled “ ValidateDetailed(string, IReadOnlyList<string>, IReadOnlyList<AgentDescriptor>)”

Validates a definition’s call graph and returns a result carrying a machine-readable code.

public static AgentCallGraphProblem? ValidateDetailed(string agentName, IReadOnlyList<string> callableAgentNames, IReadOnlyList<AgentDescriptor> descriptors)

agentName string

Name of the agent being validated.

callableAgentNames IReadOnlyList<string>

Names of the agents this agent wants to call.

descriptors IReadOnlyList<AgentDescriptor>

All agent summaries in the catalog.

AgentCallGraphProblem?

The code and description when there is a problem; null when the graph is valid.

Performs the same validation as AgentCallGraph.Validate; The validation endpoint takes its code (unknown_agent/cycle) from here, while the save-time 400 response only uses AgentCallGraphProblem.Message.

ArgumentNullException

One of the parameters is null.