| """TrialPath Parlant agent orchestrator entry point.""" |
|
|
| import asyncio |
|
|
| from parlant.sdk import Agent, Journey, PluginServer, Server |
|
|
| from trialpath.agent.guidelines import configure_guidelines |
| from trialpath.agent.journey import create_clinical_trial_journey |
| from trialpath.agent.setup import create_server_and_agent |
| from trialpath.agent.tools import ALL_TOOLS |
|
|
|
|
| async def start_parlant() -> tuple[Server, Agent, Journey, PluginServer]: |
| """Initialize and start all Parlant components. |
| |
| Returns: |
| Tuple of (server, agent, journey, plugin_server). |
| """ |
| |
| server, agent = await create_server_and_agent() |
|
|
| |
| plugin_server = PluginServer(tools=ALL_TOOLS, hosted=True) |
|
|
| |
| await configure_guidelines(agent) |
|
|
| |
| journey = await create_clinical_trial_journey(agent) |
| await agent.attach_journey(journey) |
|
|
| return server, agent, journey, plugin_server |
|
|
|
|
| async def _main() -> None: |
| """Run the orchestrator (for standalone testing).""" |
| server, agent, journey, plugin_server = await start_parlant() |
| print(f"TrialPath agent '{agent.name}' ready") |
| print(f"Journey '{journey.title}' attached") |
| print(f"Plugin server with {len(ALL_TOOLS)} tools") |
| |
| try: |
| await asyncio.Event().wait() |
| except KeyboardInterrupt: |
| pass |
|
|
|
|
| if __name__ == "__main__": |
| asyncio.run(_main()) |
|
|