instrukt.agent.base
.InstruktAgent
- class instrukt.agent.base.InstruktAgent(*, id: str = None, llm: BaseChatModel, toolset: Sequence[SomeTool] = None, executor: AgentExecutor | None = None, realm: Any | None = None, state: AgentStateMachine[Any] = None, memory: BaseChatMemory | None = None, executor_params: dict[str, Any] = None, llm_callback_handlers: list[langchain.callbacks.base.BaseCallbackHandler] = None)[source]
Bases:
BaseModel
,ABC
Instrukt agents need to satisfy this base class.
class MyAgent(InstruktAgent): name = "my_agent" description = "my agent description"
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- param executor: AgentExecutor | None = None
- param executor_params: dict[str, Any] [Optional]
- param id: str [Optional]
- param llm: BaseChatModel [Required]
- param llm_callback_handlers: list[langchain.callbacks.base.BaseCallbackHandler] [Optional]
OpenAI callback handler for this agent.
- param memory: BaseChatMemory | None [Optional]
- param realm: Any | None = None
- param state: AgentStateMachine[Any] [Optional]
- param toolset: Sequence[SomeTool] [Optional]
- abstract classmethod load(ctx: Context) InstruktAgent | None [source]
Agent loading logic goes here.
- reload_agent() None [source]
Reloads the agent. Call this method after you modify the agent’s toolset.
- validator validate_executor_params » executor_params[source]
memory cannot be passed in executor_params as well as attribute.
- property attached_tools: list[str]
Return the list of attached tools as str.
- property base_agent: BaseSingleActionAgent | BaseMultiActionAgent | None
Return underlying agent (langchain).
- description: ClassVar[str | None] = None
- display_name: ClassVar[str | None] = None
Display name of the agent. Can contain spaces.
- name: ClassVar[str | None] = None
Name of the agent. Must not contain spaces.
- property openai_cb_handler: OpenAICallbackHandler | None
- property toolset_names: list[str]
Return the names of the tools in toolset.