ayn.controllers¶
Agent controllers for invoking agents.
Classes
|
Standard protocol for agent controllers |
|
Base class for agent controllers |
|
Generic controller for custom agents |
|
Controller for CrewAI agents |
|
Controller for LangChain agents |
|
Controller for AutoGen agents |
- class ayn.controllers.AgentController(*args, **kwargs)[source]¶
Bases:
ProtocolStandard protocol for agent controllers
Controllers provide a uniform interface for invoking agents regardless of their underlying framework.
Example
>>> class MyController: ... def __init__(self, config): ... self.config = config ... def invoke(self, input_data, **kwargs): ... return f"Processed: {input_data}" >>> controller = MyController({'model': 'gpt-4'}) >>> controller.invoke('test') 'Processed: test'
- class ayn.controllers.AutoGenController(metadata, config)[source]¶
Bases:
GenericControllerController for AutoGen agents
Not implemented yet: today this behaves exactly like
GenericController(it echoes its input) and does not run an AutoGen agent. See AYN_IMPLEMENTATION_ROADMAP.md for details
- class ayn.controllers.BaseAgentController(config)[source]¶
Bases:
ABCBase class for agent controllers
Provides common functionality and enforces the controller protocol.
Example
>>> class SimpleController(BaseAgentController): ... def invoke(self, input_data, **kwargs): ... return f"Result: {input_data}" >>> controller = SimpleController(ControllerConfig()) >>> controller.invoke('test') 'Result: test'
- async ainvoke(input_data, **kwargs)[source]¶
Default async implementation wraps synchronous invoke
- Return type:
- classmethod from_metadata(metadata, config=None)[source]¶
Factory method to create controller from metadata
- Return type:
- class ayn.controllers.CrewAIController(metadata, config)[source]¶
Bases:
GenericControllerController for CrewAI agents
Not implemented yet: today this behaves exactly like
GenericController(it echoes its input) and does not run a CrewAI agent. See AYN_IMPLEMENTATION_ROADMAP.md for details
- class ayn.controllers.GenericController(metadata, config)[source]¶
Bases:
BaseAgentControllerGeneric controller for custom agents
Example
>>> from ayn.core import AgentMetadata, AgentFramework, ControllerConfig >>> meta = AgentMetadata(name="test", description="test", framework=AgentFramework.CUSTOM) >>> controller = GenericController(meta, ControllerConfig()) >>> result = controller.invoke({'input': 'test'})
- class ayn.controllers.LangChainController(metadata, config)[source]¶
Bases:
GenericControllerController for LangChain agents
Not implemented yet: today this behaves exactly like
GenericController(it echoes its input) and does not run a LangChain agent. See AYN_IMPLEMENTATION_ROADMAP.md for details
Modules