Generate HTML for the info endpoint
(info: InfoDict)
| 146 | |
| 147 | |
| 148 | def generate_info_html(info: InfoDict) -> str: |
| 149 | """ |
| 150 | Generate HTML for the info endpoint |
| 151 | """ |
| 152 | print(info, flush=True) |
| 153 | action_html = "" |
| 154 | for action in info["actions"]: |
| 155 | action_html += ACTION_TEMPLATE.format( |
| 156 | name=action["name"], |
| 157 | description=action["description"], |
| 158 | arguments=json.dumps(action.get("parameters", []), indent=2), |
| 159 | ) |
| 160 | agent_html = "" |
| 161 | for agent in info["agents"]: |
| 162 | agent_type = agent.get("type", "Unknown") |
| 163 | if agent_type == "langgraph": |
| 164 | agent_type = "LangGraph" |
| 165 | elif agent_type == "crewai": |
| 166 | agent_type = "CrewAI" |
| 167 | |
| 168 | agent_html += AGENT_TEMPLATE.format( |
| 169 | name=agent["name"], |
| 170 | type=agent_type, |
| 171 | description=agent["description"], |
| 172 | ) |
| 173 | return INFO_TEMPLATE.format( |
| 174 | head_html=HEAD_HTML, |
| 175 | version=info["sdkVersion"], |
| 176 | action_html=action_html or NO_ACTIONS_FOUND_HTML, |
| 177 | agent_html=agent_html or NO_AGENTS_FOUND_HTML, |
| 178 | ) |
no test coverage detected
searching dependent graphs…