{"slug": "building-a-policy-governed-multi-agent-financial-research-workflow-with-omnigent", "title": "Building a Policy-Governed Multi-Agent Financial Research Workflow with Omnigent", "summary": "Omnigent, an open-source framework, enables a policy-governed multi-agent financial research workflow that retrieves live USD-to-EUR exchange rates from the Frankfurter API, delegates drafting to a text-auditing sub-agent, and enforces non-interactive policies limiting tool calls and session costs, as demonstrated in a tutorial using the Claude Agent SDK and uv-managed Python 3.12 environment.", "body_md": "In this tutorial, we build and execute a multi-agent workflow with[ Omnigent](https://github.com/omnigent-ai/omnigent) using a reliable, isolated Python environment created with uv. We configure a financial research lead agent that retrieves a live USD-to-EUR exchange rate from an external API, prepares a concise client-ready summary, and delegates its draft to a dedicated text-auditing sub-agent for clarity and length validation. We define reusable Python functions as callable agent tools, describe the complete agent structure in YAML, and use the Claude Agent SDK as the execution harness. We also manage the Anthropic API key securely through environment variables, apply non-interactive policies that limit tool calls and control session costs, and run the workflow directly from Colab without requiring Node.js, tmux, or an interactive terminal. Through this implementation, we explore how Omnigent combines agents, tools, delegation, live data access, and governance within a single configurable system.\n\n``` python\nimport os, sys, subprocess, textwrap, pathlib, getpass\ndef sh(cmd, **kw):\n   \"\"\"Run a command, and on failure show the ACTUAL error, not just a code.\"\"\"\n   print(\"$\", \" \".join(map(str, cmd)))\n   p = subprocess.run(cmd, text=True, capture_output=True, **kw)\n   if p.returncode != 0:\n       print(p.stdout or \"\", p.stderr or \"\", sep=\"\\n\")\n       raise RuntimeError(f\"Command failed ({p.returncode}): {' '.join(map(str, cmd))}\")\n   return p\nWORKDIR = pathlib.Path(\"/content/omnigent_tutorial\")\nWORKDIR.mkdir(parents=True, exist_ok=True)\nVENV = WORKDIR / \".venv\"\nsubprocess.run([sys.executable, \"-m\", \"pip\", \"install\", \"-q\", \"uv\"], check=True)\nif not (VENV / \"bin\" / \"python\").exists():\n   sh([\"uv\", \"venv\", \"--python\", \"3.12\", str(VENV)])\nPY = str(VENV / \"bin\" / \"python\")\nsh([\"uv\", \"pip\", \"install\", \"--python\", PY, \"-q\", \"omnigent\", \"requests\"])\nOMNI = str(VENV / \"bin\" / \"omnigent\")\nprint(\"\\n✅\", subprocess.run([OMNI, \"--version\"], capture_output=True, text=True).stdout.strip())\n```\n\nWe import the required Python modules and define a helper function that executes shell commands while displaying detailed error information when a command fails. We create a dedicated working directory and use uv to build an isolated Python 3.12 virtual environment that avoids Colab’s ensurepip limitation. We then install Omnigent and Requests inside the environment, locate the Omnigent CLI executable, and verify the installation by printing its version.\n\n```\nif not os.environ.get(\"ANTHROPIC_API_KEY\"):\n   os.environ[\"ANTHROPIC_API_KEY\"] = getpass.getpass(\"Anthropic API key: \")\nenv = os.environ.copy()\nenv[\"OMNIGENT_NO_UPDATE_CHECK\"] = \"1\"\n```\n\nWe securely collect the Anthropic API key only when it is not already available in the notebook environment. We store the credential in the current process environment so that Omnigent can detect it without writing sensitive information to a file. We also create a separate environment configuration for the subprocess and turn off Omnigent’s automatic update check during execution.\n\n```\n(WORKDIR / \"agent_tools.py\").write_text(textwrap.dedent('''\n   \"\"\"Local tools exposed to the Omnigent agents in this tutorial.\"\"\"\n   import requests\n   def get_exchange_rate(base_currency: str, target_currency: str) -> dict:\n       \"\"\"Look up the latest FX rate between two ISO-4217 currency codes.\"\"\"\n       r = requests.get(\n           \"https://api.frankfurter.app/latest\",\n           params={\"from\": base_currency.upper(), \"to\": target_currency.upper()},\n           timeout=10,\n       )\n       r.raise_for_status()\n       data = r.json()\n       return {\n           \"base\": base_currency.upper(),\n           \"target\": target_currency.upper(),\n           \"rate\": data[\"rates\"][target_currency.upper()],\n           \"date\": data[\"date\"],\n       }\n   def word_count(text: str) -> int:\n       \"\"\"Count the words in a piece of text.\"\"\"\n       return len(text.split())\n'''))\n```\n\nWe generate a Python module containing the local functions that Omnigent exposes as callable tools to the agents. We define a live exchange-rate tool that sends a request to the Frankfurter API and returns the latest rate, currency codes, and applicable date. We also implement a simple word-count tool that allows the auditing sub-agent to measure the length of the financial summary.\n\n```\n(WORKDIR / \"fx_research_lead.yaml\").write_text(textwrap.dedent('''\n   name: fx_research_lead\n   prompt: |\n     You are a financial research lead. For any question about currency\n     movements: call get_exchange_rate to fetch the live rate, then hand\n     your draft summary to the text_auditor sub-agent for a clarity and\n     length check before giving your final answer to the user.\n   executor:\n     harness: claude-sdk\n   tools:\n     get_exchange_rate:\n       type: function\n       callable: agent_tools.get_exchange_rate\n     text_auditor:\n       type: agent\n       prompt: |\n         You audit short pieces of financial writing. Call word_count to\n         report its length, flag any unexplained jargon, and suggest one\n         concrete clarity improvement.\n       tools:\n         word_count:\n           type: function\n           callable: agent_tools.word_count\n   policies:\n     cap_calls:\n       type: function\n       handler: omnigent.policies.builtins.safety.max_tool_calls_per_session\n       factory_params:\n         limit: 20\n     budget:\n       type: function\n       handler: omnigent.policies.builtins.cost.cost_budget\n       factory_params:\n         max_cost_usd: 1.00\n'''))\n```\n\nWe define the complete multi-agent architecture through a YAML configuration file. We configure the financial research lead, connect it to the exchange-rate tool, and add a text-auditing sub-agent that evaluates the draft using the word-count function. We also apply hard governance policies that restrict the number of tool calls and limit the maximum API cost for the session.\n\n```\nenv[\"PYTHONPATH\"] = str(WORKDIR)\nquestion = (\n   \"What is the current USD to EUR exchange rate? Give me a two-sentence \"\n   \"summary I could paste into a client note.\"\n)\nresult = subprocess.run(\n   [OMNI, \"run\", str(WORKDIR / \"fx_research_lead.yaml\"), \"-p\", question, \"--no-session\"],\n   cwd=WORKDIR, env=env, stdin=subprocess.DEVNULL,\n   capture_output=True, text=True, timeout=300,\n)\nprint(\"\\n\" + \"=\" * 70)\nprint(result.stdout.strip() or \"(no stdout)\")\nif result.returncode != 0 or \"error\" in result.stdout.lower():\n   print(\"-\" * 70)\n   print(\"stderr:\", result.stderr[-2000:])\n   print(f\"\\nDebug: check ~/.omnigent/logs/runner/ , or rerun with:\\n\"\n         f\"  !{OMNI} --debug --log-to-stderr run {WORKDIR/'fx_research_lead.yaml'} -p \\\"...\\\" --no-session\")\nprint(\"=\" * 70)\nprint(f\"\"\"\nNext steps:\n • Explore the CLI:  !{OMNI} run --help\n • Bundled demo agents:\n       !{OMNI} polly -p \"review this repo\" --no-session\n       !{OMNI} debby -p \"brainstorm 3 names for a coffee shop\" --no-session\n • YAML schema:  https://github.com/omnigent-ai/omnigent/blob/main/docs/AGENT_YAML_SPEC.md\n • Policies:     https://github.com/omnigent-ai/omnigent/blob/main/docs/POLICIES.md\n\"\"\")\n```\n\nWe add the tutorial directory to PYTHONPATH, define the currency-related question, and execute the Omnigent agent through a non-interactive subprocess. We capture the generated response, display diagnostic output when execution fails, and provide a debug command for examining runner issues. We finish by printing useful next steps for exploring Omnigent’s CLI, bundled agents, YAML specification, and policy documentation.\n\nIn conclusion, we created a practical Omnigent multi-agent application that integrates live financial data retrieval, hierarchical agent delegation, automated writing assessment, and policy-based execution controls. We used uv to solve Colab’s ensurepip limitation and maintain a separate Python 3.12 environment without modifying the notebook’s system interpreter. We exposed local Python functions as agent-accessible tools, defined the agent and sub-agent behavior through a readable YAML configuration, and enforced hard limits on tool usage and API spending. We also executed the workflow non-interactively, captured both standard output and diagnostic errors, and established a structure that supports easy model changes without altering the underlying agent logic. We now have a reusable foundation for developing more sophisticated, secure, cost-controlled, and tool-enabled multi-agent systems for financial research and other real-world applications in Google Colab.\n\nCheck out the ** Full Code here. **Also, feel free to follow us on\n\n**and don’t forget to join our**[Twitter](https://x.com/intent/follow?screen_name=marktechpost)\n\n**and Subscribe to**\n\n[150k+ML SubReddit](https://www.reddit.com/r/machinelearningnews/)**. Wait! are you on telegram?**\n\n[our Newsletter](https://www.aidevsignals.com/)\n\n[now you can join us on telegram as well.](https://t.me/machinelearningresearchnews)Need to partner with us for promoting your GitHub Repo OR Hugging Face Page OR Product Release OR Webinar etc.? [Connect with us](https://forms.gle/wbash1wF6efRj8G58)\n\nSana Hassan, a consulting intern at Marktechpost and dual-degree student at IIT Madras, is passionate about applying technology and AI to address real-world challenges. With a keen interest in solving practical problems, he brings a fresh perspective to the intersection of AI and real-life solutions.", "url": "https://wpnews.pro/news/building-a-policy-governed-multi-agent-financial-research-workflow-with-omnigent", "canonical_source": "https://www.marktechpost.com/2026/07/30/building-a-policy-governed-multi-agent-financial-research-workflow-with-omnigent/", "published_at": "2026-07-31 04:44:12+00:00", "updated_at": "2026-07-31 05:03:57.984236+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools"], "entities": ["Omnigent", "Claude Agent SDK", "Anthropic", "Frankfurter API", "uv"], "alternates": {"html": "https://wpnews.pro/news/building-a-policy-governed-multi-agent-financial-research-workflow-with-omnigent", "markdown": "https://wpnews.pro/news/building-a-policy-governed-multi-agent-financial-research-workflow-with-omnigent.md", "text": "https://wpnews.pro/news/building-a-policy-governed-multi-agent-financial-research-workflow-with-omnigent.txt", "jsonld": "https://wpnews.pro/news/building-a-policy-governed-multi-agent-financial-research-workflow-with-omnigent.jsonld"}}