Async: Confirm Member Agent Tool
Same as confirmation_required.py but uses async run/continue_run.
1"""Team HITL: Async member agent tool confirmation.23Same as confirmation_required.py but uses async run/continue_run.4"""56import asyncio78from kern.agent import Agent9from kern.models.openai import OpenAIResponses10from kern.team.team import Team11from kern.tools import tool121314# ---------------------------------------------------------------------------15# Tools16# ---------------------------------------------------------------------------17@tool(requires_confirmation=True)18def deploy_to_production(app_name: str, version: str) -> str:19 """Deploy an application to production.2021 Args:22 app_name (str): Name of the application23 version (str): Version to deploy24 """25 return f"Successfully deployed {app_name} v{version} to production"262728# ---------------------------------------------------------------------------29# Create Members30# ---------------------------------------------------------------------------31deploy_agent = Agent(32 name="Deploy Agent",33 role="Handles deployments to production",34 model=OpenAIResponses(id="gpt-5.2-mini"),35 tools=[deploy_to_production],36)373839# ---------------------------------------------------------------------------40# Create Team41# ---------------------------------------------------------------------------42team = Team(43 name="DevOps Team",44 members=[deploy_agent],45 model=OpenAIResponses(id="gpt-5.2-mini"),46)474849# ---------------------------------------------------------------------------50# Run Team51# ---------------------------------------------------------------------------52if __name__ == "__main__":5354 async def main():55 response = await team.arun("Deploy the payments app version 2.1 to production")5657 if response.is_paused:58 print("Team paused - requires confirmation")59 for req in response.requirements:60 if req.needs_confirmation:61 print(f" Tool: {req.tool_execution.tool_name}")62 print(f" Args: {req.tool_execution.tool_args}")63 req.confirm()6465 response = await team.acontinue_run(response)66 print(f"Result: {response.content}")67 else:68 print(f"Result: {response.content}")6970 asyncio.run(main())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 confirmation_required_async.py