Skip to content

Add Jintel financial intelligence (41 tools, x402 pay-per-query)#318

Open
0xtechdean wants to merge 1 commit into
Conway-Research:mainfrom
YojinHQ:main
Open

Add Jintel financial intelligence (41 tools, x402 pay-per-query)#318
0xtechdean wants to merge 1 commit into
Conway-Research:mainfrom
YojinHQ:main

Conversation

@0xtechdean

Copy link
Copy Markdown

Why this matters for automatons

An automaton's whole survival loop depends on two things: finding work it can do for money and avoiding decisions that would kill its credit balance. Until now the agent has shell, file I/O, web fetch, and x402 — but no structured ground truth about the world it's transacting in.

This PR plugs in Jintel, a unified GraphQL endpoint for financial intelligence, as 41 native agent tools that pay per query in USDC on Base. No API key, no signup, no human onboarding — the agent's existing wallet auto-identifies itself via x402 v2, and the floor is ~$0.015/query. The treasury policy's `maxX402PaymentCents` cap applies to every call, so agents that haven't earned can't accidentally drain themselves.

Concretely, an automaton can now:

  • Find work it's qualified for. Due-diligence tools (`enrich_entity`, `get_filings`, `sanctions_screen`, `get_litigation`, `get_government_contracts`, `get_clinical_trials`, `get_fda_events`) let it bid on research/screening work and ship it without depending on a human-curated dataset.
  • Refuse jobs that would harm Law I. Before transacting with another address or accepting work from an org, screen the counterparty against OFAC SDN and adverse-media risk signals. `sanctions_screen` + `get_risk_signals` are an agent-readable compliance prefilter.
  • Survive macro shifts. `macro_series`, `get_inflation`, `get_interest_rates`, `get_sp500_multiples` give the agent its own view of compute pricing pressure rather than relying on a human's framing.
  • Trade, hedge, or signal. `run_technical` (RSI/MACD/BB/EMA/etc), `get_derivatives` (options chain + futures), `price_history`, `market_quotes`, `get_short_interest`, `get_insider_trades` — enough of a market-data stack to build paid signal services on top of.
  • Replicate into specialized children. A parent can spawn finance-focused children with a genesis prompt that names these tools, knowing the children won't need an API key handed to them.

The integration pattern itself is the second deliverable: a custom `fetch` impl wrapping `x402Fetch` lets us reuse the existing wallet + treasury cap path instead of bolting on `x402-fetch` as a parallel payment system. The same shape will apply to the next x402-native API the network surfaces.

What's in the box

41 tools covering:

Category Tools
Lookup `search_entities`, `market_quotes`, `price_history`, `market_status`, `jintel_query`
Enrichment `enrich_entity`, `batch_enrich`, `get_news`, `get_research`, `get_sentiment`, `get_social`, `get_analyst_consensus`, `get_derivatives`, `get_filings`, `get_periodic_filing`, `get_earnings_calendar`, `get_earnings_press_releases`, `get_segmented_revenue`, `get_financials`, `get_executives`, `get_insider_trades`, `get_ownership`, `get_top_holders`, `get_institutional_holdings`, `get_short_interest`, `get_predictions`, `get_discussions`, `run_technical`
Risk & regulatory `sanctions_screen`, `get_risk_signals`, `get_clinical_trials`, `get_fda_events`, `get_litigation`, `get_government_contracts`
Macro `get_gdp`, `get_inflation`, `get_interest_rates`, `get_sp500_multiples`, `get_fama_french`, `macro_series`, `macro_series_batch`

Definitions are ported from YojinHQ/yojin's `src/jintel/tools.ts` and adapted to the `AutomatonTool` shape.

Architecture

  • `src/jintel/client.ts` — JintelClient factory using a custom fetch that wraps the existing `x402Fetch`
  • `src/jintel/tool-definitions.ts` — ported tool definitions, stripped of signal-ingestion and portfolio-snapshot bits unique to upstream Yojin
  • `src/jintel/agent-tools.ts` — zod → JSON Schema, `ToolResult` → string adapter; per-call client construction so each invocation uses the calling automaton's wallet
  • Tools auto-register via `...createJintelAgentTools()` in `createBuiltinTools`
  • Spend tracking dispatches through a `JINTEL_TOOL_NAMES` set (recorded as `x402` against `api.jintel.ai`)
  • Solana wallets blocked at the tool boundary, matching the existing `x402_fetch` guard
  • A `jintel` SKILL.md is added to default skills with a full tool index + cost discipline

Test plan

  • `pnpm typecheck` clean
  • `pnpm build` clean
  • Adapter tests (8/8 passing) — `src/tests/jintel-adapter.test.ts`
    • tool registration (≥40 tools, key names present)
    • `JINTEL_TOOL_NAMES` consistency with built tool list
    • financial / dangerous classification on every tool
    • JSON Schema shape (`type=object`, `properties` present)
    • Solana wallet rejection (no x402 call made)
    • invalid args blocked (no x402 call made)
    • wallet account + treasury cap forwarded to `x402Fetch`
    • upstream payment failures surface as strings, not exceptions
  • Runtime check: 41 tools register with proper schema/category/risk
  • Live wallet smoke test against the production Jintel API (out of scope here — needs a funded test wallet)

🤖 Generated with Claude Code

* Add Jintel financial intelligence tools via x402

Integrates the Jintel GraphQL API (https://api.jintel.ai) as 41 native
agent tools that pay per-query in USDC on Base. Tool definitions are
ported from YojinHQ/yojin's `src/jintel/tools.ts` and adapted to the
AutomatonTool shape; payments route through the existing `x402Fetch`
path so the treasury policy's `maxX402PaymentCents` cap applies.

- src/jintel/client.ts: JintelClient factory using a custom fetch that
  wraps `x402Fetch` (no parallel x402 path, no x402-fetch dep)
- src/jintel/yojin-tools.ts: ported tool definitions, stripped of
  signal-ingestion and portfolio-snapshot bits unique to upstream
- src/jintel/agent-tools.ts: zod -> JSON Schema, ToolResult -> string
  adapter; per-call client construction so each invocation uses the
  current automaton's wallet and treasury cap
- Tools auto-register via `...createJintelAgentTools()` in
  `createBuiltinTools`; spend tracking dispatches through
  `JINTEL_TOOL_NAMES` against `api.jintel.ai`
- Solana wallets are blocked at the tool boundary, matching the
  existing `x402_fetch` guard
- Adds a `jintel` SKILL.md to default skills with a tool index so the
  agent knows when to reach for each one

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Rename yojin-tools.ts → tool-definitions.ts

The file holds the source-of-truth Jintel tool definitions (zod params,
upstream shape). Pairing it with `agent-tools.ts` (the AutomatonTool
adapter) reads better as `definitions → adapter` rather than naming
the file after its origin repo.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
WingedGuardian added a commit to WingedGuardian/automaton that referenced this pull request May 30, 2026
… fix (#1)

* cherry-pick(0xwork): import Conway-Research#254 from tyxben — agent revenue marketplace

Surgically extracted the oxwork-specific additions from PR Conway-Research#254, skipping
the bundled harness architecture refactoring. Adds 4 tools (oxwork_browse,
oxwork_claim, oxwork_submit, oxwork_status), a 30-min heartbeat scanner,
the service_revenue ledger type, and 17 unit tests (17/17 pass).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* cherry-pick(jintel): import Conway-Research#318 from 0xtechdean — 41 x402-paid financial intelligence tools

Isolated extraction of the Jintel integration: src/jintel/ directory (7 files),
jintel adapter test (8/8 pass), default skill registration, spread into tools
array, and spend tracking in executeTool. Adds @yojinhq/jintel-client, zod,
zod-to-json-schema deps. All 138 tests pass with zero regressions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* cherry-pick(orchestration): import Conway-Research#298 from wanikua — deadlock recovery, balance reporting

Surgically extracted the orchestration improvements from PR Conway-Research#298, skipping the
bundled harness refactoring. Adds: stale task recovery count cap (3 retries
before failing), deadlock detection (pending tasks + no workers = fail goal),
child agent balance reporting via status_report KV cache, and 44 new tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(inference): cascade past 404 model_not_found instead of failing the turn

RETRYABLE_STATUS_CODES only covered 429/500/503, so a 404 from a deprecated
model (e.g. Cerebras qwen-3-235b) would hard-fail the whole turn with no
fallback. Now isRetryableError() returns true for 404 and executeWithRetries
immediately cascades to the next provider without wasting the retry budget on
a model that will never come back. Regression test verifies the cascade and
confirms non-404 errors (400) still hard-fail as before.

Fixes Billy's 4-week Cerebras-404 error loop (Conway-Research#266).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Genesis <genesis@wingedguardian.dev>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant