Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /jhoetter_hof-engine /hof /api /routes /agent.py
| """Agent-facing API routes (tool listing, etc.).""" | |
| from __future__ import annotations | |
| from typing import Any | |
| from fastapi import APIRouter, Depends | |
| from hof.agent.policy import try_get_agent_policy | |
| from hof.agent.tooling import openai_tool_specs, structured_agent_tool_for_ui | |
| from hof.api.auth import verify_auth | |
| from hof.core.registry import registry | |
| router = APIRouter() | |
| async def list_agent_tools(user: str = Depends(verify_auth)) -> dict[str, Any]: | |
| """List tools for the agent skills UI. | |
| Includes logical read/mutation + builtins; not model-only transport. | |
| """ | |
| policy = try_get_agent_policy() | |
| if policy is None: | |
| return {"configured": False, "tools": []} | |
| specs = openai_tool_specs(policy.skills_catalog_allowlist()) | |
| mutation_set = policy.allowlist_mutation | |
| tools: list[dict[str, Any]] = [] | |
| for spec in specs: | |
| fn = spec.get("function") if isinstance(spec, dict) else None | |
| if not isinstance(fn, dict): | |
| continue | |
| name = str(fn.get("name") or "").strip() | |
| if not name: | |
| continue | |
| meta = registry.get_function(name) | |
| if meta is None: | |
| continue | |
| raw_params = fn.get("parameters") | |
| if isinstance(raw_params, dict): | |
| parameters = raw_params | |
| else: | |
| parameters = {"type": "object", "properties": {}, "required": []} | |
| tools.append( | |
| structured_agent_tool_for_ui( | |
| name, | |
| meta, | |
| policy, | |
| mutation=name in mutation_set, | |
| parameters=parameters, | |
| ) | |
| ) | |
| return {"configured": True, "tools": tools} | |
Xet Storage Details
- Size:
- 1.7 kB
- Xet hash:
- b8b4739386010fded8a186a1bdf87e7a625c4fd016c569b3a6f5195381cb8075
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.