Skip to content

Add safer data access to run state internals in AsentsError classes #670

@eightHundreds

Description

@eightHundreds

Please read this first

  • Have you read the docs? Agents SDK docs
  • Have you searched for related issues? Others may have had similar requests

Describe the feature

What is the feature you're requesting? How would it work? Please provide examples and details if possible.

export abstract class AgentsError extends Error {
  state?: RunState<any, Agent<any, any>>;

  constructor(message: string, state?: RunState<any, Agent<any, any>>) {
    super(message);
    this.state = state;

+    this.name = new.target.name;
  }
}
// before
const a = new MaxTurnsExceededError();
console.log(a.name) // Error

//after
console.log(a.name)  // MaxTurnsExceededError

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions