{"id":"f32f242b-e661-4bc8-9a29-d9177afdb761","entityType":"agent","slug":"crewai-aizazkhan19-clinic-flow-in-crewai","name":"Clinic-flow-in-crewai","canonicalUrl":"https://www.xpersona.co/agent/crewai-aizazkhan19-clinic-flow-in-crewai","canonicalPath":"/agent/crewai-aizazkhan19-clinic-flow-in-crewai","generatedAt":"2026-10-10T06:26:12.522Z","source":"GITHUB_REPOS","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-09T18:14:38.771Z","emptyReason":null},"description":"In this repository, A full clinic flow will be implemented using crewai Clinic Flow (CrewAI) - README Project Overview Clinic Flow is an interactive, agent-driven simulation of a clinical triage and treatment workflow built on top of CrewAI. It demonstrates a multi-agent conversation loop that: - Registers patients (reads/writes a CSV \"database\"). - Collects and triages symptoms via a receptionist (desk) agent. - Routes patients to specialist doctor agents (cardiologist, orthopedic, gene","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. Last updated 10/9/2026.","installCommand":null,"sourceUrl":"https://github.com/AizazKhan19/Clinic-flow-in-crewai","homepage":null,"primaryLinks":[{"label":"View Source","url":"https://github.com/AizazKhan19/Clinic-flow-in-crewai","kind":"source"}],"safetyScore":66,"overallRank":18.8,"popularityScore":0,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"In this repository, A full clinic flow will be implemented using crewai Clinic Flow (CrewAI) - README Project Overview Clinic Flow is an interactive, agent-driv"},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-09T18:14:38.771Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[{"label":"crewai","status":"self-declared"},{"label":"multi-agent","status":"self-declared"}],"verifiedCount":0,"selfDeclaredCount":3,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"},{"key":"crewai","type":"capability","support":"supported","confidenceSource":"profile","notes":"Declared in agent profile metadata"},{"key":"multi-agent","type":"capability","support":"supported","confidenceSource":"profile","notes":"Declared in agent profile metadata"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile capability:crewai|supported|profile capability:multi-agent|supported|profile"}},"adoption":{"evidence":{"source":"no-adoption-signals","verified":false,"confidence":"low","updatedAt":"2026-10-09T18:14:38.771Z","emptyReason":"No source adoption metrics were available."},"stars":0,"forks":0,"downloads":null,"packageName":null,"latestVersion":null,"tractionLabel":null},"release":{"evidence":{"source":"agent-index","verified":false,"confidence":"medium","updatedAt":"2026-10-09T18:14:38.764Z","emptyReason":null},"lastUpdatedAt":"2026-10-09T18:14:38.771Z","lastCrawledAt":"2026-10-09T18:14:38.764Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-16T18:14:38.764Z","lastVerifiedAt":null,"highlights":[]},"execution":{"evidence":{"source":"GITHUB REPOS","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":null,"setupComplexity":"low","setupSteps":["Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/crewai-aizazkhan19-clinic-flow-in-crewai/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/crewai-aizazkhan19-clinic-flow-in-crewai/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/crewai-aizazkhan19-clinic-flow-in-crewai/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/crewai-aizazkhan19-clinic-flow-in-crewai/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/crewai-aizazkhan19-clinic-flow-in-crewai/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/crewai-aizazkhan19-clinic-flow-in-crewai/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"GITHUB_REPOS","generatedAt":"2026-10-10T06:26:12.522Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/crewai-aizazkhan19-clinic-flow-in-crewai/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/crewai-aizazkhan19-clinic-flow-in-crewai/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/crewai-aizazkhan19-clinic-flow-in-crewai/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/crewai-aizazkhan19-clinic-flow-in-crewai/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"GITHUB REPOS","verified":false,"confidence":"high","updatedAt":"2026-10-09T18:14:38.771Z","emptyReason":null},"readme":"# Clinic Flow (CrewAI) - README\n\n## Project Overview\n\nClinic Flow is an interactive, agent-driven simulation of a clinical triage and treatment workflow built on top of CrewAI. It demonstrates a multi-agent conversation loop that:\n\n- Registers patients (reads/writes a CSV \"database\").\n- Collects and triages symptoms via a receptionist (desk) agent.\n- Routes patients to specialist doctor agents (`cardiologist`, `orthopedic`, `general`).\n- If necessary, simulates laboratory tests with a `Laboratory Agent` and returns a generated report.\n- Lets specialist agents review lab reports and produce prescriptions or treatment advice.\n\nThis repository is intended as a proof-of-concept for building conversational clinic flows where agents coordinate, use tools, and update shared state.\n\n## Problem It Solves\n\n- Automates triage and basic diagnostic workflows for simulated clinical scenarios.\n- Shows how to orchestrate multiple LLM-powered agents with tool integrations (CSV DB) and stateful routing.\n- Provides a reproducible environment for experimenting with agent responsibilities, routing, and simulated test reporting.\n\n## What This Provides\n\n- A runnable Python script `clinic.py` that kicks off an interactive CLI flow.\n- A small CSV-backed patient database at `data/patients_data.csv` used for registration and lookups.\n- A custom CSV read/write tool implemented in `custom_tool.py` for persisting patient records.\n- LLM configuration in `configuration.py` (reads `OPENAI_API_KEY` from environment).\n\n## Repository Structure\n\n- `clinic.py` — Main flow implementation. Defines Pydantic state models, agent tasks, routers/listeners, and the entire conversation loop.\n- `configuration.py` — LLM client configuration (set `OPENAI_API_KEY` via `.env` or environment).\n- `custom_tool.py` — `CSVReadWriteTool` used to read/append patient records in `data/patients_data.csv`.\n- `data/patients_data.csv` — Example CSV database (header: `patient_id,name,age,gender,medical_history,contact`).\n- `README.md` — This file.\n\n## Key Components (quick reference)\n\n- `MyClinicStates` (in `clinic.py`): global, persisted state shared across agents (patient data, flags, routing keys, `report`, etc.).\n- `ClinicExtractionSchema`: the expected turn-level extraction schema for the reception desk agent.\n- `DoctorDecisionState` and `LabReportState`: Pydantic schemas for doctor/lab task outputs.\n- Agents: `Desk Agent` (reception), `Cardiologist/Orthopedic/General` (doctors), `Laboratory Agent` (simulates tests).\n- `CSVReadWriteTool._run(...)` (in `custom_tool.py`): supports `read` and `append` actions; `append` returns a generated patient ID string.\n\n## Requirements\n\n- Python 3.10+ (recommended)\n- Packages (example): `crewai`, `pydantic`, `python-dotenv`, `crewai-tools` (if used), and any dependencies those libraries require.\n\nCreate a minimal `requirements.txt` with:\n\n```\npydantic\npython-dotenv\ncrewai\ncrewai-tools\n```\n\nNote: exact package names and versions depend on your CrewAI installation. If you installed CrewAI via a private package, make sure to use the same environment used to develop this project.\n\n## Configuration\n\n1. Create a `.env` file or set environment variables with your OpenAI (or supported LLM) API key:\n\n```\nOPENAI_API_KEY=your_api_key_here\n```\n\n2. `configuration.py` reads `OPENAI_API_KEY` and initializes `llm`. Adjust model/temperature as needed.\n\n## How to Run\n\nFrom the repository root, run:\n\n```bash\npython clinic.py\n```\n\nYou will interact with the desk agent via standard input. The flow continues until a specialist route completes and the flow exits.\n\nNotes:\n- `flow.plot()` is called at the end of `clinic.py`. If graph plotting requires extra dependencies (e.g., `graphviz`) you may need to install them or comment out the call.\n\n## Data Format (`data/patients_data.csv`)\n\nHeader: `patient_id,name,age,gender,medical_history,contact`\n\nExample row:\n\n```\n1,Aizaz Khan,45,Male,High Blood Pressure,300123456789\n```\n\nThe `CSVReadWriteTool.append` action automatically generates incremental `patient_id` values.\n\n## Example Interaction Flow (summary)\n\n1. User provides an ID or registers as a new patient at the desk agent.\n2. Desk agent extracts registration and symptoms, updates `MyClinicStates`.\n3. If symptoms indicate critical condition, desk sets `chosen_doctor_path` and the router sends the state to the appropriate doctor node.\n4. Doctor agent either (A) issues a prescription directly (non-critical), or (B) sets `required_tests` and the flow routes to the `lab` node.\n5. `Laboratory Agent` simulates `lab_report` and sets report state; flow returns to the originating doctor node for review.\n\n## Known Behavior & Debugging Tips\n\n- If the doctor returns from the lab but does not add remarks:\n  - Ensure that `self.state.report` is being set by the lab (search for `self.state.report = result.lab_report` in `clinic.py`).\n  - Confirm the doctor node's `if self.state.report:` branch is reached; add print/log statements to verify.\n  - Doctor agents produce results via `Crew(...).kickoff()`. Inspect what the crew returns and whether the response is assigned into `self.state.prescription` or another appropriate field.\n  - Timing/race conditions: if lab writes happen asynchronously, make sure `is_report_generated` becomes True before routing back.\n  - Check agent expected output types (`output_pydantic`) and whether the agent actually returns structured data versus free text.\n\n## Extending the Project\n\n- Add new specialist nodes by implementing a new `@listen(...)` method and updating the routing logic.\n- Replace the simple CSV storage with a real database (SQLite/Postgres) and update `CSVReadWriteTool` or add a new DB tool.\n- Replace the LLM model/config with a different provider or different parameters in `configuration.py`.\n- Add unit tests that mock Crew responses to validate routing and state updates.\n\n## Security & Privacy\n\n- This repository simulates patient data — do NOT use real PHI/PII in test runs unless you have appropriate security controls and consent.\n- Keep API keys out of source control and use environment variables or secret managers.\n\n## Troubleshooting Checklist\n\n- Missing API key: make sure `OPENAI_API_KEY` is set.\n- CSV write/read errors: ensure `data/` directory is writable.\n- Unexpected routing: inspect `self.state` logs to see which keys are set (`doctor_type`, `required_tests`, `report`).\n\n## Contribution and License\n\nContributions welcome — open an issue or a pull request. This project contains example code and is intended for educational/demo use. Add an appropriate license file if you plan to publish/redistribute.\n\n---\n\nIf you'd like, I can also:\n\n- Add a `requirements.txt` and `.env.example`.\n- Add a small `run_demo.sh` script to set env and run the flow.\n- Create unit tests that mock Crew responses for deterministic behavior.\n\nTell me which of these you'd like next.","readmeExcerpt":"Clinic Flow (CrewAI) - README Project Overview Clinic Flow is an interactive, agent-driven simulation of a clinical triage and treatment workflow built on top of CrewAI. It demonstrates a multi-agent conversation loop that: - Registers patients (reads/writes a CSV \"database\"). - Collects and triages symptoms via a receptionist (desk) agent. - Routes patients to specialist doctor agents (cardiologist, orthopedic, gene","codeSnippets":[],"executableExamples":[{"language":"text","snippet":"pydantic\npython-dotenv\ncrewai\ncrewai-tools"},{"language":"text","snippet":"OPENAI_API_KEY=your_api_key_here"},{"language":"bash","snippet":"python clinic.py"},{"language":"text","snippet":"1,Aizaz Khan,45,Male,High Blood Pressure,300123456789"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[],"languages":["python"],"docsSourceLabel":"GITHUB REPOS","editorialOverview":"In this repository, A full clinic flow will be implemented using crewai Clinic Flow (CrewAI) - README Project Overview Clinic Flow is an interactive, agent-driven simulation of a clinical triage and treatment workflow built on top of CrewAI. It demonstrates a multi-agent conversation loop that: - Registers patients (reads/writes a CSV \"database\"). - Collects and triages symptoms via a receptionist (desk) agent. - Routes patients to specialist doctor agents (cardiologist, orthopedic, gene","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":391,"uniquenessScore":65,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-09T18:14:38.771Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-09T18:14:38.771Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-10T06:26:12.522Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/github_repos","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}