MCPcopy
hub / github.com/langroid/langroid / TaskConfig

Class TaskConfig

langroid/agent/task.py:110–172  ·  view source on GitHub ↗

Configuration for a Task. This is a container for any params that we didn't include in the task `__init__` method. We may eventually move all the task __init__ params to this class, analogous to how we have config classes for `Agent`, `ChatAgent`, `LanguageModel`, etc. Attributes:

Source from the content-addressed store, hash-verified

108
109
110class TaskConfig(BaseModel):
111 """Configuration for a Task. This is a container for any params that
112 we didn't include in the task `__init__` method.
113 We may eventually move all the task __init__ params to this class, analogous to how
114 we have config classes for `Agent`, `ChatAgent`, `LanguageModel`, etc.
115
116 Attributes:
117 inf_loop_cycle_len (int): max exact-loop cycle length: 0 => no inf loop test
118 inf_loop_dominance_factor (float): dominance factor for exact-loop detection
119 inf_loop_wait_factor (int): wait this * cycle_len msgs before loop-check
120 restart_as_subtask (bool): whether to restart *every* run of this task
121 when run as a subtask.
122 addressing_prefix (str): "@"-like prefix an agent can use to address other
123 agents, or entities of the agent. E.g., if this is "@", the addressing
124 string would be "@Alice", or "@user", "@llm", "@agent", etc.
125 If this is an empty string, then addressing is disabled.
126 Default is empty string "".
127 CAUTION: this is a deprecated practice, since normal prompts
128 can accidentally contain such addressing prefixes, and will break
129 your runs. This could happen especially when your prompt/context
130 contains code, but of course could occur in normal text as well.
131 Instead, use the `RecipientTool` to have agents address other agents or
132 entities. If you do choose to use `addressing_prefix`, the recommended
133 setting is to use `langroid.utils.constants.AT`, which currently is "|@|".
134 Note that this setting does NOT affect the use of `constants.SEND_TO` --
135 this is always enabled since this is a critical way for responders to
136 indicate that the message should be sent to a specific entity/agent.
137 (Search for "SEND_TO" in the examples/ dir to see how this is used.)
138 allow_subtask_multi_oai_tools (bool): whether to allow multiple OpenAI
139 tool-calls to be sent to a sub-task.
140 recognize_string_signals (bool): whether to recognize string-based signaling
141 like DONE, SEND_TO, PASS, etc. Default is True, but note that we don't need
142 to use string-based signaling, and it is recommended to use the
143 new Orchestration tools instead (see agent/tools/orchestration.py),
144 e.g. DoneTool, SendTool, etc.
145 Note: this is distinct from
146 ``ChatAgentConfig.recognize_recipient_in_content``, which controls
147 whether LLM response text is parsed for ``TO[<recipient>]:`` and
148 JSON ``{"recipient": ...}`` patterns at the Agent level.
149 To fully disable all text-based routing, set both to False.
150 done_if_tool (bool): whether to consider the task done if the pending message
151 contains a Tool attempt by the LLM
152 (including tools not handled by the agent).
153 Default is False.
154 done_sequences (List[DoneSequence]): List of event sequences that trigger task
155 completion. Task is done if ANY sequence matches the recent event history.
156 Each sequence is checked against the message parent chain.
157 Tool classes can be referenced in sequences like "T[MyToolClass]".
158
159 """
160
161 inf_loop_cycle_len: int = 10
162 inf_loop_dominance_factor: float = 1.5
163 inf_loop_wait_factor: int = 5
164 restart_as_subtask: bool = False
165 logs_dir: str = "logs"
166 enable_loggers: bool = True
167 enable_html_logging: bool = True

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…