mirror of
https://github.com/hanzoai/agents.git
synced 2026-10-30 18:48:36 +00:00
Transforms hanzoai/agents from a marketplace config repo into a full agent orchestration platform by merging the AgentField infrastructure: - Go control plane (K8s-like agent orchestration, service mesh, DAG workflows) - Python SDK (FastAPI-based agent framework, LiteLLM, memory, DID/VC) - TypeScript SDK (@hanzo/agents - Vercel AI SDK, MCP, workflows) - Go SDK (idiomatic agent builder + client) - React 19 embedded dashboard (XyFlow DAGs, Recharts, Radix UI) - Docker/K8s/Helm deployment configs - Examples: hello world, deep research, RAG, simulation, benchmarks - Functional test suite across Python/Go/TypeScript All references rebranded: AgentField → Hanzo Agents - Module: github.com/hanzoai/agents/control-plane - Python: hanzo_agents - TypeScript: @hanzo/agents - Go: github.com/hanzoai/agents/sdk/go - Env vars: HANZO_AGENTS_* - Config: hanzo-agents.yaml Previous marketplace configs moved to config/ directory.
30 lines
864 B
Python
30 lines
864 B
Python
"""
|
|
Agent registry for tracking the current agent instance in thread-local storage.
|
|
This allows reasoners to automatically find their parent agent for workflow tracking.
|
|
"""
|
|
|
|
import threading
|
|
from typing import Optional, TYPE_CHECKING
|
|
|
|
if TYPE_CHECKING:
|
|
from .agent import Agent
|
|
|
|
# Thread-local storage for agent instances
|
|
_thread_local = threading.local()
|
|
|
|
|
|
def set_current_agent(agent_instance: "Agent"):
|
|
"""Register the current agent instance for this thread."""
|
|
_thread_local.current_agent = agent_instance
|
|
|
|
|
|
def get_current_agent_instance() -> Optional["Agent"]:
|
|
"""Get the current agent instance for this thread."""
|
|
return getattr(_thread_local, "current_agent", None)
|
|
|
|
|
|
def clear_current_agent():
|
|
"""Clear the current agent instance."""
|
|
if hasattr(_thread_local, "current_agent"):
|
|
delattr(_thread_local, "current_agent")
|