more optmizations
This commit is contained in:
@@ -23,9 +23,9 @@ logger.info("Initializing Cavepedia agent...")
|
||||
|
||||
|
||||
def limit_history(ctx: RunContext[None], messages: list[ModelMessage]) -> list[ModelMessage]:
|
||||
"""Limit conversation history to manage token usage and request size."""
|
||||
# Keep only the last few messages to avoid large requests hitting Cloudflare limits
|
||||
return messages[-4:]
|
||||
"""Limit conversation history to manage token usage."""
|
||||
# Keep last 8 messages for context, but not unlimited
|
||||
return messages[-8:]
|
||||
|
||||
def check_mcp_available(url: str, timeout: float = 5.0) -> bool:
|
||||
"""Check if MCP server is reachable via health endpoint."""
|
||||
@@ -54,7 +54,7 @@ Rules:
|
||||
4. Can create ascii diagrams/maps.
|
||||
5. Be direct—no sycophantic phrases.
|
||||
6. Keep responses concise.
|
||||
7. Use tools sparingly—one search usually suffices. Answer from your knowledge when possible."""
|
||||
7. Search ONCE, then answer with what you found. Do not search repeatedly for the same topic."""
|
||||
|
||||
|
||||
def create_agent(user_roles: list[str] | None = None):
|
||||
|
||||
Reference in New Issue
Block a user