orka.agents.agents module

Basic Agents Module

This module implements simple rule-based agents for the OrKa framework that don’t rely on external APIs or complex ML models. These agents serve as building blocks for basic decision-making and classification tasks within orchestrated workflows.

The agents in this module include: - BinaryAgent: Makes true/false decisions based on simple text patterns - ClassificationAgent: Categorizes input into predefined classes using keyword matching

These simple agents can be used for: - Quick prototyping of workflows - Testing the orchestration infrastructure - Implementing basic decision logic without external dependencies - Serving as fallbacks when more complex agents fail or are unavailable

Both agent types inherit from the BaseAgent class and implement the required run() method with simple rule-based logic.

class orka.agents.agents.BinaryAgent(agent_id, prompt, queue, **kwargs)[source]

Bases: LegacyBaseAgent

A simple agent that performs binary (true/false) decisions.

This agent processes input text and returns either “true” or “false” based on simple text pattern matching. It demonstrates the most basic form of decision-making in the OrKa framework.

The current implementation checks for the presence of ‘yes’, ‘true’, or ‘correct’ in the input to determine if the result should be true. This can be extended to more complex pattern matching or rule-based decision logic.

run(input_data)[source]

Make a binary decision based on text content.

Parameters:

input_data (dict) – Input containing text to analyze, expected to have an ‘input’ field with the text content.

Returns:

‘true’ if input contains positive indicators, ‘false’ otherwise.

Return type:

str

Note

This is a simplified implementation for demonstration purposes. In production, this would typically use more sophisticated rules or a trained classifier.

class orka.agents.agents.ClassificationAgent(agent_id, prompt, queue, **kwargs)[source]

Bases: LegacyBaseAgent

A simple agent that performs multi-class classification.

Deprecated since version 0.5.6: This agent is deprecated and will be removed in a future version. The run method now returns “deprecated” instead of performing classification. Use other classification agents from the orka.agents.llm_agents module for current classification needs.

Legacy Implementation:

This agent previously categorized input text into predefined classes based on keyword matching using a simple rule-based approach.

run(input_data)[source]

Deprecated method that returns “deprecated”.

Deprecated since version 0.5.6: This method no longer performs classification and simply returns the string “deprecated” to indicate the agent should not be used.

Parameters:

input_data – Input data (ignored)

Returns:

Always returns “deprecated”

Return type:

str