Spaces:
Sleeping
Sleeping
Commit
Β·
d26d845
1
Parent(s):
d4d880a
Remove false MCP claims - be honest about tool usage
Browse filesThe hackathon allows "MCP tools, vibe coding, or traditional development"
We're using traditional API calls, not actual MCP protocol.
Changed:
- "MCP-Powered" β "AI Agent with Tool Orchestration"
- "MCP Tools Invoked" β "Agent Tool Calls"
- "MCP Execution Trace" β "Execution Trace"
- Removed "All tools follow MCP standard" claim
- Updated tool descriptions to show actual APIs used
π€ Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- app.py +8 -9
- src/agent.py +19 -19
app.py
CHANGED
|
@@ -33,14 +33,13 @@ def format_sources(sources: list[dict]) -> str:
|
|
| 33 |
|
| 34 |
|
| 35 |
def format_mcp_tools(tools: list[dict]) -> str:
|
| 36 |
-
"""Format
|
| 37 |
if not tools:
|
| 38 |
return "*No tools used*"
|
| 39 |
|
| 40 |
-
md = "**π
|
| 41 |
for tool in tools:
|
| 42 |
md += f"| {tool['icon']} | `{tool['name']}` | {tool['desc']} |\n"
|
| 43 |
-
md += "\n*All tools follow the Model Context Protocol (MCP) standard*"
|
| 44 |
return md
|
| 45 |
|
| 46 |
|
|
@@ -106,8 +105,8 @@ def explain_topic(topic: str, persona_name: str, audience: str = "", generate_au
|
|
| 106 |
with tempfile.NamedTemporaryFile(suffix=".mp3", delete=False) as f:
|
| 107 |
f.write(audio_bytes)
|
| 108 |
audio_path = f.name
|
| 109 |
-
# Add text_to_speech
|
| 110 |
-
mcp_tools.append({"name": "text_to_speech", "icon": "π", "desc": "
|
| 111 |
progress(1.0, desc="Done!")
|
| 112 |
except Exception as e:
|
| 113 |
steps_log.append(f"**β οΈ Audio generation failed**\n{str(e)}")
|
|
@@ -134,11 +133,11 @@ def create_app():
|
|
| 134 |
gr.Markdown(
|
| 135 |
"""
|
| 136 |
# π Explainor
|
| 137 |
-
### *
|
| 138 |
|
| 139 |
**Learn anything through the voice of your favorite characters!**
|
| 140 |
|
| 141 |
-
This agent
|
| 142 |
extract key facts, transform explanations into character voices, and generate audio.
|
| 143 |
"""
|
| 144 |
)
|
|
@@ -209,7 +208,7 @@ def create_app():
|
|
| 209 |
|
| 210 |
with gr.Row():
|
| 211 |
with gr.Column():
|
| 212 |
-
with gr.Accordion("π
|
| 213 |
mcp_output = gr.Markdown("")
|
| 214 |
|
| 215 |
with gr.Row():
|
|
@@ -218,7 +217,7 @@ def create_app():
|
|
| 218 |
sources_output = gr.Markdown("")
|
| 219 |
|
| 220 |
with gr.Column():
|
| 221 |
-
with gr.Accordion("π§
|
| 222 |
steps_output = gr.Markdown("")
|
| 223 |
|
| 224 |
# Example topics
|
|
|
|
| 33 |
|
| 34 |
|
| 35 |
def format_mcp_tools(tools: list[dict]) -> str:
|
| 36 |
+
"""Format tools used as markdown."""
|
| 37 |
if not tools:
|
| 38 |
return "*No tools used*"
|
| 39 |
|
| 40 |
+
md = "**π Agent Tool Calls:**\n\n"
|
| 41 |
for tool in tools:
|
| 42 |
md += f"| {tool['icon']} | `{tool['name']}` | {tool['desc']} |\n"
|
|
|
|
| 43 |
return md
|
| 44 |
|
| 45 |
|
|
|
|
| 105 |
with tempfile.NamedTemporaryFile(suffix=".mp3", delete=False) as f:
|
| 106 |
f.write(audio_bytes)
|
| 107 |
audio_path = f.name
|
| 108 |
+
# Add text_to_speech tool
|
| 109 |
+
mcp_tools.append({"name": "text_to_speech", "icon": "π", "desc": "Audio generation via ElevenLabs API"})
|
| 110 |
progress(1.0, desc="Done!")
|
| 111 |
except Exception as e:
|
| 112 |
steps_log.append(f"**β οΈ Audio generation failed**\n{str(e)}")
|
|
|
|
| 133 |
gr.Markdown(
|
| 134 |
"""
|
| 135 |
# π Explainor
|
| 136 |
+
### *AI Agent with Tool Orchestration*
|
| 137 |
|
| 138 |
**Learn anything through the voice of your favorite characters!**
|
| 139 |
|
| 140 |
+
This agent orchestrates multiple tools to: research your topic,
|
| 141 |
extract key facts, transform explanations into character voices, and generate audio.
|
| 142 |
"""
|
| 143 |
)
|
|
|
|
| 208 |
|
| 209 |
with gr.Row():
|
| 210 |
with gr.Column():
|
| 211 |
+
with gr.Accordion("π Agent Tool Calls", open=True):
|
| 212 |
mcp_output = gr.Markdown("")
|
| 213 |
|
| 214 |
with gr.Row():
|
|
|
|
| 217 |
sources_output = gr.Markdown("")
|
| 218 |
|
| 219 |
with gr.Column():
|
| 220 |
+
with gr.Accordion("π§ Execution Trace", open=False):
|
| 221 |
steps_output = gr.Markdown("")
|
| 222 |
|
| 223 |
# Example topics
|
src/agent.py
CHANGED
|
@@ -198,8 +198,8 @@ Now explain "{topic}" in your unique voice and style. Make it fun and educationa
|
|
| 198 |
}
|
| 199 |
|
| 200 |
|
| 201 |
-
def
|
| 202 |
-
"""Format a tool call
|
| 203 |
import json
|
| 204 |
return f"""```json
|
| 205 |
{{
|
|
@@ -212,16 +212,16 @@ def format_mcp_call(tool_name: str, inputs: dict, output_summary: str) -> str:
|
|
| 212 |
|
| 213 |
|
| 214 |
def run_agent(topic: str, persona_name: str, audience: str = "") -> Generator[dict, None, None]:
|
| 215 |
-
"""Run the full agent pipeline
|
| 216 |
|
| 217 |
Yields progress updates and final results.
|
| 218 |
"""
|
| 219 |
-
#
|
| 220 |
yield {
|
| 221 |
"type": "step",
|
| 222 |
"step": "research",
|
| 223 |
-
"title": "π§
|
| 224 |
-
"content":
|
| 225 |
}
|
| 226 |
|
| 227 |
research, sources = research_topic(topic)
|
|
@@ -229,20 +229,20 @@ def run_agent(topic: str, persona_name: str, audience: str = "") -> Generator[di
|
|
| 229 |
yield {
|
| 230 |
"type": "step",
|
| 231 |
"step": "research_done",
|
| 232 |
-
"title": "β
|
| 233 |
-
"content":
|
| 234 |
"sources": sources,
|
| 235 |
}
|
| 236 |
|
| 237 |
-
#
|
| 238 |
yield {
|
| 239 |
"type": "step",
|
| 240 |
"step": "extracting",
|
| 241 |
-
"title": "π§
|
| 242 |
-
"content":
|
| 243 |
}
|
| 244 |
|
| 245 |
-
#
|
| 246 |
persona = get_persona(persona_name)
|
| 247 |
|
| 248 |
# Build audience context
|
|
@@ -250,12 +250,12 @@ def run_agent(topic: str, persona_name: str, audience: str = "") -> Generator[di
|
|
| 250 |
if audience and audience.strip():
|
| 251 |
audience_context = f"\nYou are explaining this to: {audience.strip()}. Tailor your explanation appropriately for them."
|
| 252 |
|
| 253 |
-
#
|
| 254 |
yield {
|
| 255 |
"type": "step",
|
| 256 |
"step": "generating",
|
| 257 |
-
"title": "π§
|
| 258 |
-
"content":
|
| 259 |
"persona_transform",
|
| 260 |
{
|
| 261 |
"persona": persona_name,
|
|
@@ -293,11 +293,11 @@ Now explain "{topic}" in your unique {persona_name} voice and style. Make it fun
|
|
| 293 |
|
| 294 |
explanation = call_llm(messages)
|
| 295 |
|
| 296 |
-
# Track
|
| 297 |
mcp_tools = [
|
| 298 |
-
{"name": "web_search", "icon": "π", "desc": "
|
| 299 |
-
{"name": "extract_facts", "icon": "π", "desc": "
|
| 300 |
-
{"name": "persona_transform", "icon": "π", "desc": "
|
| 301 |
]
|
| 302 |
|
| 303 |
yield {
|
|
|
|
| 198 |
}
|
| 199 |
|
| 200 |
|
| 201 |
+
def format_tool_call(tool_name: str, inputs: dict, output_summary: str) -> str:
|
| 202 |
+
"""Format a tool call for display."""
|
| 203 |
import json
|
| 204 |
return f"""```json
|
| 205 |
{{
|
|
|
|
| 212 |
|
| 213 |
|
| 214 |
def run_agent(topic: str, persona_name: str, audience: str = "") -> Generator[dict, None, None]:
|
| 215 |
+
"""Run the full agent pipeline with tool orchestration.
|
| 216 |
|
| 217 |
Yields progress updates and final results.
|
| 218 |
"""
|
| 219 |
+
# Tool 1: web_search (DuckDuckGo)
|
| 220 |
yield {
|
| 221 |
"type": "step",
|
| 222 |
"step": "research",
|
| 223 |
+
"title": "π§ Tool: `web_search`",
|
| 224 |
+
"content": format_tool_call("web_search", {"query": topic, "max_results": 5}, "Searching..."),
|
| 225 |
}
|
| 226 |
|
| 227 |
research, sources = research_topic(topic)
|
|
|
|
| 229 |
yield {
|
| 230 |
"type": "step",
|
| 231 |
"step": "research_done",
|
| 232 |
+
"title": "β
Response: `web_search`",
|
| 233 |
+
"content": format_tool_call("web_search", {"query": topic}, f"Found {len(sources)} sources"),
|
| 234 |
"sources": sources,
|
| 235 |
}
|
| 236 |
|
| 237 |
+
# Tool 2: extract_facts
|
| 238 |
yield {
|
| 239 |
"type": "step",
|
| 240 |
"step": "extracting",
|
| 241 |
+
"title": "π§ Tool: `extract_facts`",
|
| 242 |
+
"content": format_tool_call("extract_facts", {"text": f"[{len(sources)} source documents]", "max_facts": 5}, "Extracting key facts..."),
|
| 243 |
}
|
| 244 |
|
| 245 |
+
# Generate explanation
|
| 246 |
persona = get_persona(persona_name)
|
| 247 |
|
| 248 |
# Build audience context
|
|
|
|
| 250 |
if audience and audience.strip():
|
| 251 |
audience_context = f"\nYou are explaining this to: {audience.strip()}. Tailor your explanation appropriately for them."
|
| 252 |
|
| 253 |
+
# Tool 3: persona_transform (Nebius LLM)
|
| 254 |
yield {
|
| 255 |
"type": "step",
|
| 256 |
"step": "generating",
|
| 257 |
+
"title": "π§ Tool: `persona_transform`",
|
| 258 |
+
"content": format_tool_call(
|
| 259 |
"persona_transform",
|
| 260 |
{
|
| 261 |
"persona": persona_name,
|
|
|
|
| 293 |
|
| 294 |
explanation = call_llm(messages)
|
| 295 |
|
| 296 |
+
# Track tools used in pipeline
|
| 297 |
mcp_tools = [
|
| 298 |
+
{"name": "web_search", "icon": "π", "desc": "Web research via DuckDuckGo API"},
|
| 299 |
+
{"name": "extract_facts", "icon": "π", "desc": "Key fact extraction from sources"},
|
| 300 |
+
{"name": "persona_transform", "icon": "π", "desc": "Persona explanation via Nebius LLM"},
|
| 301 |
]
|
| 302 |
|
| 303 |
yield {
|