Compare commits

...
Author SHA1 Message Date
praisonai-triage-agent[bot]andMervin Praison 85ba558a3b fix: real MCP readiness check in example + drop unused SseServerTransport
- simple-mcp-server.py: replace blind 2s sleep with TCP readiness poll so
  the smoke test genuinely verifies the server bound and exits non-zero on
  failure (addresses Greptile P1: daemon exited claiming false success)
- execution_mixin.py: remove now-unused SseServerTransport import/instance
  after switching to FastMCP.sse_app() (dead code flagged by Greptile)

Co-authored-by: Mervin Praison <[email protected]>
2026-07-24 08:57:52 +00:00
Dhivya-Bharathy 1cfb2bc26f fix: resolve 4 remaining E2E example failures after batch-3 merge 2026-07-24 14:25:40 +05:30
5 changed files with 38 additions and 8 deletions

No files matched your search

+30 -1
View File
@@ -1,5 +1,34 @@
import socket
import sys
import threading
import time
from praisonaiagents import Agent
def _wait_until_ready(host: str, port: int, timeout: float = 15.0) -> bool:
"""Poll the MCP server port until it accepts connections or times out."""
deadline = time.time() + timeout
while time.time() < deadline:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.settimeout(1.0)
if sock.connect_ex((host, port)) == 0:
return True
time.sleep(0.25)
return False
if __name__ == "__main__":
host, port = "127.0.0.1", 8080
agent = Agent(name="TweetAgent", instructions="Create a Tweet based on the topic provided")
agent.launch(port=8080, protocol="mcp", path="/mcp")
server = threading.Thread(
target=lambda: agent.launch(port=port, protocol="mcp", path="/mcp"),
daemon=True,
)
server.start()
if _wait_until_ready(host, port):
print(f"MCP server started on http://{host}:{port}/mcp")
else:
print(f"MCP server failed to start on http://{host}:{port}/mcp", file=sys.stderr)
sys.exit(1)
@@ -150,7 +150,7 @@ def main():
agent = Agent(
name="AI Research Assistant",
instructions="You are an AI research assistant. Use your knowledge base to answer questions about artificial intelligence topics.",
knowledge={**rerank_config, "sources": sample_documents},
knowledge={"sources": sample_documents, "rerank": True},
llm="gpt-4o-mini"
)
@@ -67,6 +67,7 @@ agents_system = AgentTeam(
print("Starting graph memory demonstration...")
result = agents_system.start()
print(f"\nGraph Memory Result: {result[:200]}...")
result_text = str(result) if result is not None else ""
print(f"\nGraph Memory Result: {result_text[:200]}...")
print("\n✅ Graph memory integration complete!")
print("Agent built knowledge graph and performed relationship-aware queries.")
+4 -2
View File
@@ -30,9 +30,11 @@ def main():
else:
print(f"Found {len(stories)} top stories:")
for story in stories:
print(f" - {story.get('title', 'N/A')[:50]}...")
title = story.get("title") or "N/A"
url = story.get("url") or "N/A"
print(f" - {title[:50]}...")
print(f" Score: {story.get('score', 'N/A')} | Comments: {story.get('descendants', 'N/A')}")
print(f" URL: {story.get('url', 'N/A')[:60]}...")
print(f" URL: {url[:60]}...")
print()
print("✅ Hacker News tool working correctly!")
@@ -1638,7 +1638,6 @@ Write the complete compiled report:"""
try:
import uvicorn
from mcp.server.fastmcp import FastMCP
from mcp.server.sse import SseServerTransport
from starlette.applications import Starlette
from starlette.routing import Mount
import threading
@@ -1669,9 +1668,8 @@ Write the complete compiled report:"""
# Create and run MCP server
base_path = (path or "/mcp").rstrip("/") or "/mcp"
transport = SseServerTransport(f"{base_path}/sse")
starlette_app = Starlette(
routes=[Mount(base_path, mcp.create_app())]
routes=[Mount(base_path, mcp.sse_app())]
)
def run_mcp_server():