Confirm Team Tool
This example demonstrates HITL for tools provided directly to the Team (not to member agents).
This example demonstrates HITL for tools provided directly to the Team (not to member agents). When the team leader decides to use a tool that requires confirmation, the entire team run pauses until the human confirms.
1"""Team HITL: Tool on the team itself requiring confirmation.23This example demonstrates HITL for tools provided directly to the Team4(not to member agents). When the team leader decides to use a tool5that requires confirmation, the entire team run pauses until the6human confirms.7"""89from kern.agent import Agent10from kern.models.openai import OpenAIResponses11from kern.team.team import Team12from kern.tools import tool131415# ---------------------------------------------------------------------------16# Tools17# ---------------------------------------------------------------------------18@tool(requires_confirmation=True)19def approve_deployment(environment: str, service: str) -> str:20 """Approve and execute a deployment to an environment.2122 Args:23 environment (str): Target environment (staging, production)24 service (str): Service to deploy25 """26 return f"Deployment of {service} to {environment} approved and executed"272829# ---------------------------------------------------------------------------30# Create Members31# ---------------------------------------------------------------------------32research_agent = Agent(33 name="Research Agent",34 role="Researches deployment readiness",35 model=OpenAIResponses(id="gpt-5.2-mini"),36)373839# ---------------------------------------------------------------------------40# Create Team41# ---------------------------------------------------------------------------42team = Team(43 name="Release Team",44 members=[research_agent],45 model=OpenAIResponses(id="gpt-5.2-mini"),46 tools=[approve_deployment],47)484950# ---------------------------------------------------------------------------51# Run Team52# ---------------------------------------------------------------------------53if __name__ == "__main__":54 response = team.run("Check if the auth service is ready and deploy it to staging")5556 if response.is_paused:57 print("Team paused - requires confirmation for team-level tool")58 for req in response.requirements:59 if req.needs_confirmation:60 print(f" Tool: {req.tool_execution.tool_name}")61 print(f" Args: {req.tool_execution.tool_args}")62 req.confirm()6364 response = team.continue_run(response)65 print(f"Result: {response.content}")66 else:67 print(f"Result: {response.content}")Run the Example
1# Clone and setup repo2git clone https://github.com/kern-ai/kern.git3cd kern/cookbook/03_teams/human_in_the_loop45# Create and activate virtual environment6./scripts/demo_setup.sh7source .venvs/demo/bin/activate89python team_tool_confirmation.py