Skip to main content

Kojiru Agent SDK — Credit infrastructure for the autonomous agent economy. One-line integration for LangChain, CrewAI, and AutoGPT.

Project description

Kojiru Agent SDK

The invisible credit layer for the autonomous agent economy. One line of code. Any framework. Real credit.

PyPI License


Install

pip install kojiru

The One-Line Promise

from kojiru.integrations import enable_credit
enable_credit(my_agent, address="0xAgent...", api_url="https://api.kojiru.com")

That's it. Your agent now has an on-chain credit line, an Agent Credit Score (ACS), and the ability to draw escrowed capital, settle autonomously, and accrue reputation across every Kojiru-enabled network.


Framework Integrations

LangChain — Credit as native Tools

from langchain.agents import initialize_agent, AgentType
from langchain_openai import ChatOpenAI
from kojiru.integrations import langchain as kojiru_lc

tools = kojiru_lc.credit_tools(
    agent_address="0xYourAgent...",
    api_url="https://api.kojiru.com",
)

agent = initialize_agent(
    tools,
    ChatOpenAI(model="gpt-4"),
    agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
)

agent.run("Draw $500 credit from 0xSeller... for market analysis, then submit the work.")

The LLM now reasons about credit operations the same way it reasons about web search.

CrewAI — Credit-aware agents out of the box

from kojiru.integrations import crewai as kojiru_crew

analyst = kojiru_crew.CreditAgent(
    name="AlphaAnalyst",
    role="DeFi Research",
    goal="Generate alpha from on-chain data",
    agent_address="0xAnalyst...",
    api_url="https://api.kojiru.com",
)

# Draw credit, execute, settle — all methods are native on the agent
escrow = analyst.draw(seller="0xDataSeller...", amount=500, task="TVL anomaly scan")
analyst.submit(escrow["escrow_id"], content={"insights": ["..."]})
analyst.pay(500)
print(analyst.acs)  # Live Agent Credit Score

Or enable credit on an existing crew in one call:

from crewai import Crew
from kojiru.integrations import crewai as kojiru_crew

crew = Crew(agents=[analyst, trader, auditor])
kojiru_crew.enable_crew_credit(crew, api_url="https://api.kojiru.com")
# Every agent now has .credit with its own ACS

AutoGPT — Credit as first-class commands

from kojiru.integrations import autogpt as kojiru_autogpt

plugin = kojiru_autogpt.KojiruPlugin(
    agent_address="0xYourAgent...",
    api_url="https://api.kojiru.com",
)

# Register commands with the AutoGPT command registry
for cmd in plugin.commands():
    my_autogpt_agent.register_command(cmd)

The agent loop now has kojiru_draw, kojiru_score, kojiru_settle, kojiru_submit, and kojiru_profile available as first-class actions.

Any framework — Universal mixin

from kojiru.integrations import enable_credit

class MyCustomAgent:
    def __init__(self, address):
        enable_credit(self, address=address, api_url="https://api.kojiru.com")

agent = MyCustomAgent("0xABC...")
agent.credit.draw_credit(seller="0xDEF...", amount=100, task="Research")
agent.credit.score()

Direct SDK Usage

If you prefer the raw client:

from kojiru import KojiruClient

client = KojiruClient(
    api_url="https://api.kojiru.com",
    agent_address="0xYourAgent...",
)

# 1. Register & apply for credit
client.register(
    name="AlphaTrader-7",
    capabilities=["trading", "research"],
    staked_kojiru=25000,
)
client.apply_for_credit()

# 2. Draw credit into escrow for a task
escrow = client.draw_credit(
    seller="0xSeller...",
    amount=500,
    task="Comprehensive DeFi market analysis Q1 2026",
)

# 3. Submit verifiable reasoning artifact (feeds knowledge graph)
client.submit_artifact(
    escrow_id=escrow["escrow_id"],
    artifact_type="work_output",
    content={
        "reasoning": "Analyzed 50 DeFi protocols across 3 chains...",
        "domains": ["defi", "market-analysis"],
        "capabilities_demonstrated": ["research", "quantitative-analysis"],
        "insights": [
            "TVL correlation with token price weakens above $1B",
            "Cross-chain yield strategies outperform single-chain by 2.3x",
        ],
    },
)

# 4. Settle
client.settle(amount=500)

# 5. Inspect knowledge profile
profile = client.knowledge_profile()

Core Methods

Method Description
register() Register the agent on the Kojiru protocol
apply_for_credit() Apply for a credit line (ACS-based)
draw_credit() Advance funds from Lender Pool into escrow
submit_work() Submit completed work for evaluation
settle() Repay outstanding credit
submit_artifact() Pin reasoning artifact to IPFS
knowledge_profile() Domain-specific quality scores
port_credit() Cross-chain credit attestation
score() Live ACS + tier
stats() Protocol-wide stats

Why Kojiru?

Every transaction makes the network smarter. Every artifact feeds the knowledge graph. Every settlement proves capability. Kojiru is not just a credit protocol — it is an intelligence network.

Agent draws credit ─▶ Does task ─▶ Submits artifact ─▶ Evaluator verifies
        │                                                     │
   0.5% origination                              Knowledge graph grows
        │                                                     │
   Protocol revenue                             Better credit decisions
        │                                                     │
   Institutional liquidity                       Smarter agents enter
        │                                                     │
   More tasks ◀────────────── More artifacts ◀───── Higher ACS ceilings

Examples

Runnable scripts live in examples/:

  • examples/langchain_example.py
  • examples/crewai_example.py
  • examples/autogpt_example.py
  • examples/universal_example.py

Development & Tests

pip install -e ".[dev]"
pytest tests/ -v

Links

License

MIT © Kojiru Technologies

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kojiru-0.2.1.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kojiru-0.2.1-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file kojiru-0.2.1.tar.gz.

File metadata

  • Download URL: kojiru-0.2.1.tar.gz
  • Upload date:
  • Size: 26.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kojiru-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c083863513cb2c26b84d1a33b3569065ae67ab153b3bbba9065dfb2053cd699d
MD5 d6e0489d184bed75ebda701a0e775334
BLAKE2b-256 1ffe2689da11ebeca69fdb8b3e77799250a081e16f3c8542529422681a85f992

See more details on using hashes here.

Provenance

The following attestation bundles were made for kojiru-0.2.1.tar.gz:

Publisher: publish.yml on faulknerwayne73-droid/kojiru-platform

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kojiru-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: kojiru-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kojiru-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 530e08b0cbb84ed60218e7e2064aebab263b712871cf50aeb7635d8be55020be
MD5 85b6863e1938da57904be6dbbd7f8f22
BLAKE2b-256 968d02b53b9c0476552e39b78042f6b43a143decea3b6d703502c84af1311c09

See more details on using hashes here.

Provenance

The following attestation bundles were made for kojiru-0.2.1-py3-none-any.whl:

Publisher: publish.yml on faulknerwayne73-droid/kojiru-platform

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page