| 144 | return self.current_tool |
| 145 | |
| 146 | def render(self, ctx: RenderCtx) -> str: |
| 147 | inner_prefix = " " |
| 148 | lines = [f"🤖 {ctx.bold('Subagent:')} {ctx.code_inline(self.description)}"] |
| 149 | |
| 150 | if self.current_tool is not None: |
| 151 | try: |
| 152 | rendered = self.current_tool.render(ctx) |
| 153 | except Exception: |
| 154 | rendered = "" |
| 155 | if rendered: |
| 156 | lines.append(rendered) |
| 157 | |
| 158 | tools_used = sorted(self.tools_used) |
| 159 | tools_set_raw = "{{{}}}".format(", ".join(tools_used)) if tools_used else "{}" |
| 160 | lines.append( |
| 161 | f"{inner_prefix}{ctx.bold('Tools used:')} {ctx.code_inline(tools_set_raw)}" |
| 162 | ) |
| 163 | lines.append( |
| 164 | f"{inner_prefix}{ctx.bold('Tool calls:')} {ctx.code_inline(str(self.tool_calls))}" |
| 165 | ) |
| 166 | return "\n".join(lines) |
| 167 | |
| 168 | |
| 169 | @dataclass |