Agent#

class council.agents.Agent(controller: ControllerBase, evaluator: EvaluatorBase, filter: FilterBase, name: str = 'agent')[source]#

Bases: Monitorable

Represents an agent that executes a set of chains to interact with the environment.

__init__(controller: ControllerBase, evaluator: EvaluatorBase, filter: FilterBase, name: str = 'agent') None[source]#

Initializes the Agent object.

Parameters:
  • controller (ControllerBase) – The controller responsible for generating execution plans.

  • evaluator (EvaluatorBase) – The evaluator responsible for evaluating the agent’s performance.

  • filter (FilterBase) – The filter responsible to filter responses.

  • name (str) – name of the agent

property controller: ControllerBase#

the controller of the agent

property evaluator: EvaluatorBase#

the evaluator of the agent

execute(context: AgentContext) AgentResult[source]#

Executes the agent’s chains based on the provided context and budget.

Parameters:

context (AgentContext) – The context for executing the chains.

Return type:

AgentResult

Raises:

None

execute_from_user_message(message: str, budget: Budget | None = None) AgentResult[source]#

Helper function that executes an agent with a simple user message.

Parameters:
  • message (str) – the user message

  • budget (Budget) – the budget for the agent execution

Return type:

AgentResult

property filter: FilterBase#

the filter of the agent

static from_chain(chain: ~council.chains.chain_base.ChainBase, evaluator: ~council.evaluators.evaluator_base.EvaluatorBase = <council.evaluators.basic_evaluator.BasicEvaluator object>, filter: ~council.filters.filter_base.FilterBase = <council.filters.basic_filter.BasicFilter object>) Agent[source]#
Helper function to create a new agent with a BasicController, a

BasicEvaluator and a single SkillBase wrapped into a Chain

Parameters:
Returns:

a new instance

Return type:

Agent

static from_skill(skill: SkillBase, chain_description: str | None = None) Agent[source]#
Helper function to create a new agent with a BasicController, a

BasicEvaluator and a single SkillBase wrapped into a Chain

Parameters:
  • skill (SkillBase) – a skill

  • chain_description (str) – Optional, chain description

Returns:

a new instance

Return type:

Agent

property name: str#

the name of the agent

render_as_dict(include_children: bool = True) Dict[str, Any]#

returns the graph of operation as a dictionary

render_as_json() str#

returns the graph of operation as a JSON string