Everything runs from the repository root, and the package needs no install step of its own. The only thing you have to supply is an OpenAI key, and only for the two calls the broker makes per question. The test suite runs without one.
What is real, and what is not. The orchestration runs: the LangGraph state machine, the routing, the synthesis and the human gate all execute against gpt-4o. Every agent's answer is written into the config file in advance, in its <mock_data> block. Nothing is fetched: no vendor API is called, and no MCP server exists.
So the only credential you need is one OpenAI key. You are not being asked to wire this to
a booking system, a rate feed or anything else you would have to think twice about.
That is a data-protection decision before it is a convenience one. Wired to live systems, a network like this would read real rates, booking records and guest reviews, and forward whatever it found to a language model. With every answer written in advance, the only things that leave your machine are the question you type and text you can read in this repository. It also makes a run repeatable, which is what lets the test suite exercise the real graph with no key, no network and nothing spent.
Get it
Python 3.10 or newer, which is what the LangChain packages require. Developed and tested on 3.14.
shellgit clone https://github.com/johnfisher-ai/fisher-agentic-network-langgraph.git cd fisher-agentic-network-langgraph python3 -m pip install -r requirements.txt
Four dependencies, pinned to the versions this was built against:
requirements.txtlanggraph==1.0.10 langchain==1.2.10 langchain-openai==1.1.11 python-dotenv>=1.0.0
Use python3 -m pip rather than pip. It guarantees the install
lands in the same interpreter that will run the code, which is the difference between
working and a confusing import error on a machine with more than one Python.
Your API key
The key is read from the environment. It is never written into a file that gets committed, and nothing in the project prints it.
A .env file, which is the easiest locally. It is listed on the first
line of .gitignore.
shellcp .env.example .env # then put your key in .env: # OPENAI_API_KEY=sk-...
Your shell, if you would rather not have the file at all.
shellexport OPENAI_API_KEY=sk-...
Colab: the key icon in the left sidebar, with the secret named
OPENAI_API_KEY. The notebook picks it up without any edit.
Check it worked. This makes one tiny call and prints a masked prefix, never the key itself.
shellpython3 scripts/check_key.py
outputloaded: sk-proj-abc...WXYZ (length 164) live call: ok PASS - the new key works.
What it costs
Two calls to gpt-4o per question: one to choose which specialists to
consult, one to synthesise their findings and score the risk. A fraction of a cent.
The specialists themselves cost nothing, so the number of agents consulted does not change the bill.
Ask it something
A question that only reports. No approval needed.
commandpython3 -m agentic_network.cli --verbose --yes "Check the recent guest reviews and tell me the general sentiment."
outputa real run[trace] scenario 1 selected for: 'Check the recent guest reviews and tell me the general sentiment.'
[status] Analysing intent ...
[status] Delegating to guest_experience
[status] Consulting Guest Experience ...
[trace] Guest Experience returned: {"sentiment": "Neutral", "recent_issues": "None"}
[status] Synthesising and scoring risk ...
[trace] synthesis complete, requires_approval=False
The general sentiment of the recent guest reviews is neutral, and there have been no recent issues reported.
RISK: NO
[status] ReadyA recommendation to change prices. The gate fires.
commandpython3 -m agentic_network.cli --yes "My bookings for November are down 20%. Diagnose this."
outputa real run============================================================== HUMAN APPROVAL REQUIRED ============================================================== 1. Your bookings for November are down 20% due to a combination of factors. The cancellation of the "Tech Summit" event has negatively impacted demand, as noted by the Market Scout. Additionally, your current rate of $250 is higher than the competitor's rate of $200. The Revenue Strategist recommends dropping your rate by $50 to align more closely with the competition and potentially increase bookings. 2. DETERMINE RISK: The recommendation involves changing PRICES by dropping your rate. Therefore, the output is "RISK: YES". ============================================================== (auto_approve=True: approved without prompting) 1. Your bookings for November are down 20% due to a combination of factors. The cancellation of the "Tech Summit" event has negatively impacted demand, as noted by the Market Scout. Additionally, your current rate of $250 is higher than the competitor's rate of $200. The Revenue Strategist recommends dropping your rate by $50 to align more closely with the competition and potentially increase bookings. 2. DETERMINE RISK: The recommendation involves changing PRICES by dropping your rate. Therefore, the output is "RISK: YES". [STATUS: APPROVED BY HUMAN, EXECUTED]
--yes and --no answer the approval gate without prompting,
which is what lets a notebook run unattended. Leave both off and it asks.
The same kind of question, with the human declining.
commandpython3 -m agentic_network.cli --no "My competitor dropped their rates. Should I match them?"
outputa real run============================================================== HUMAN APPROVAL REQUIRED ============================================================== Based on the data, your competitor has dropped their rates by $30. The recommendation is to either match the competitor's rate or add value to your offering to remain competitive. RISK: YES ============================================================== (auto_approve=False: rejected without prompting) ACTION CANCELLED. The human operator rejected the proposal. What was proposed: Based on the data, your competitor has dropped their rates by $30. The recommendation is to either match the competitor's rate or add value to your offering to remain competitive. RISK: YES
The other config. Same command, same code.
commandpython3 -m agentic_network.cli --verbose --yes -c config/config_agency.xml "Our client has massive supply chain delays from overseas suppliers."
outputa real run[trace] scenario 1 selected for: 'Our client has massive supply chain delays from overseas suppliers.'
[status] Analysing intent ...
[status] Delegating to operations_specialist
[status] Consulting Operations Specialist ...
[trace] Operations Specialist returned: {"bottleneck": "Tier-1 Suppliers", "action": "Activate secondary suppliers in LATAM to bypass current port congestion."}
[status] Synthesising and scoring risk ...
[trace] synthesis complete, requires_approval=False
**Executive-Level Consulting Recommendation:**
Our analysis indicates that the primary bottleneck in your supply chain is currently at the Tier-1 supplier level, primarily due to significant port congestion affecting overseas suppliers. To mitigate these delays and ensure continuity in your supply chain operations, we recommend activating secondary suppliers located in Latin America (LATAM). This strategic move will allow you to bypass the current congestion issues and maintain a steady flow of goods.
**Key Actions:**
1. **Engage Secondary Suppliers:** Initiate contracts and logistics with pre-identified secondary suppliers in LATAM to diversify your supply chain sources.
2. **Logistics Optimization:** Work with logistics partners to streamline transportation routes from LATAM to your distribution centers, ensuring minimal disruption and cost efficiency.
3. **Risk Management:** Continuously monitor the performance and reliability of these secondary suppliers to ensure they meet your quality and delivery standards.
**Benefits:**
- Reduced dependency on congested overseas ports.
- Enhanced supply chain resilience and flexibility.
- Potential cost savings from reduced shipping delays and penalties.
**DETERMINE RISK:**
RISK: NO
This recommendation focuses on supply chain diversification and optimization without suggesting layoffs, significant budget reallocations, or major restructuring.
[status] ReadyNote what changed in that last one: a config path. The command, the code and the graph are identical.
The desktop client
A tkinter window with a chat pane and a live agent trace log, where the approval gate is answered by a person rather than a flag.
shellpython3 -m agentic_network.gui python3 -m agentic_network.gui --config config/config_agency.xml
It needs a display, so it does not run in Colab or over a plain SSH session. In those places use the headless path above.
The notebook
The notebook carries the design notes and a runnable walkthrough. On Colab it clones the repository and installs its own dependencies, so the only thing you supply is the key.
The tests need no key
19 checks against a stub model: nothing is sent anywhere and nothing is spent. They cover scenario matching, both branches of the approval gate, malformed router output, and both configurations.
shellpython3 -m tests.test_network
This is the quickest way to confirm a clone is working before you decide whether to spend anything on a key.
Writing your own network
Copy either config and edit it. A network needs the two broker prompts, a list of scenarios with keywords, and the agents, each with a description and one canned reply per scenario. The code page walks through the format.
shellcp config/config_travel.xml config/config_mine.xml python3 -m agentic_network.cli -c config/config_mine.xml "your question here"
Nothing in agentic_network/ needs to change. If the file parses and declares
at least one agent, it will run.