Skip to content

Conversation

@yunsukim86
Copy link
Contributor

@yunsukim86 yunsukim86 commented Apr 10, 2025

Requirements

  • Users may create a custom inspector with a model ID and a model config + policy
  • Custom inspectors can be added when creating a team agent
  • An easier option to choose ready-made general inspectors (type: ready-made, custom, etc.)
  • Inspector spec (type + ID + config + policy) is wrapped in a dict and sent to the agentification backend via payload

Interface Example

inspector = InspectorFactory.create_from_model(
    name="custom inspector",
    model_id="abcdefg",
    model_config={"group": "PII"},
    policy="adaptive"
)

inspector_auto = InspectFactory.create_from_auto(
    name="sth",
    auto="alignment"
)

team = TeamAgent(
    name="team"
    agents=agents,
    description="team description",
    llm_id="xyz",
    use_mentalist=True,
    inspectors=[inspector, inspector_auto],
    inspector_targets=["steps", "output"],
)

Implementation Notes

Module: ModelWithParams (abstract class)

  • Model ID + (undefined) extra parameters

Module: Inspector(ModelWithParams)

  • New fields: model config, policy, auto

Factory: InspectorFactory

  • New arg: inspectors: List[Inspector]
  • Removed: use_inspector, num_inspectors (these are inferred from inspectors)

Next Steps

  • Custom inspector spec is sent to the custom asset backend to have a new asset ID (except policy)

@yunsukim86 yunsukim86 self-assigned this Apr 10, 2025
@yunsukim86 yunsukim86 changed the base branch from main to development April 10, 2025 11:10
@yunsukim86 yunsukim86 marked this pull request as ready for review April 10, 2025 13:19
@shreyasXplain
Copy link
Collaborator

@yunsukim86 the PR looks good but could you please add some functional tests for the module

@yunsukim86
Copy link
Contributor Author

@shreyasXplain Thanks, I had to wait for the product decision about the UI, but now the details are decided. I'll update the PR (incl. functional tests) and ask for the review again.

@yunsukim86 yunsukim86 changed the title Custom guardrail interface Custom inspector interface Apr 15, 2025
)

@classmethod
def create_auto(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be a way to have just a single create method? Automatic creation would be a parameter in the one above...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thiago-aixplain It's more a product decision. Automatic creation doesn't need to consider model, params, etc...

"plannerId": self.llm_id if self.use_mentalist else None,
"inspectorId": self.llm_id if self.use_inspector else None,
"maxInspectors": self.max_inspectors,
"inspectors": [inspector.model_dump(by_alias=True) for inspector in self.inspectors],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the by_alias=True here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's converting field names to camelCase before sending it to the backend.

@yunsukim86 yunsukim86 merged commit 77ff8d8 into development Jun 2, 2025
@yunsukim86 yunsukim86 deleted the ENG-1981-implement-sdk-interface-for branch June 2, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants