This agent can answer complex questions about clinical trials by using a knowledge graph and external data sources to provide accurate, consolidated information.

How it Works

The agent is built using the following components, which you can find in the cookbook/clinical_trials directory:

`trialsagent.py`

The main script that creates and runs the agent. It initializes the a1facts tool, which acts as the bridge between the agent and the knowledge graph.

`trials.yaml`

This file defines the schema of our knowledge graph. It specifies the types of entities (e.g., ClinicalTrial, Drug, Condition) and the relationships between them.

`sources.yaml`

This file configures the external data sources that the agent can query for information about clinical trials.
When you run trialsagent.py, it initializes an agent with the a1facts tool. The agent is then asked a complex query about clinical trials. The a1facts tool uses the information from trials.yaml and sources.yaml to understand the query, fetch relevant data, and then synthesize a precise answer.

Running the Example

1

Set up your environment

Create a .env file in the a1facts/cookbook/clinical_trials directory and add your API keys:
.env
OPENAI_API_KEY="your_openai_api_key"
EXA_API_KEY="your_exa_api_key"
2

Run the agent

Navigate to the a1facts/cookbook/clinical_trials directory and run the following command:
uv run python trialsagent.py
3

Expected Output

The agent will run the query and print a detailed answer to the console, consolidating information from the knowledge graph and external sources to address the complex query about clinical trials.