|
| 1 | +""" |
| 2 | +Tokonomics: Explorable and Referenceable Tools for LLM Agents. |
| 3 | +
|
| 4 | +============================================================= |
| 5 | +
|
| 6 | +A library that provides token-efficient object exploration and reference |
| 7 | +passing capabilities for LLM agents. |
| 8 | +
|
| 9 | +Key Features: |
| 10 | +- TTL-based object storage for temporary results |
| 11 | +- Rich object exploration with multiple rendering modes |
| 12 | +- Reference-based parameter passing (@obj_001.path.to.value) |
| 13 | +- Type-safe decorators that preserve function signatures |
| 14 | +- Configurable preview truncation and custom rendering callbacks |
| 15 | +
|
| 16 | +Usage: |
| 17 | +------ |
| 18 | +
|
| 19 | +Basic explorable tool: |
| 20 | +
|
| 21 | + >>> from deepset_mcp.tools.tokonomics import explorable |
| 22 | + >>> |
| 23 | + >>> @explorable |
| 24 | + >>> def get_data(): |
| 25 | + ... return {"users": [{"name": "Alice", "age": 30}]} |
| 26 | + >>> |
| 27 | + >>> result = get_data() |
| 28 | + >>> print(result) # Shows rich preview |
| 29 | + >>> result.obj_id # "obj_001" |
| 30 | + >>> result.value # Original data |
| 31 | +
|
| 32 | +Referenceable tool that accepts references: |
| 33 | +
|
| 34 | + >>> from deepset_mcp.tools.tokonomics import referenceable |
| 35 | + >>> |
| 36 | + >>> @referenceable |
| 37 | + >>> def process_users(users: list) -> str: |
| 38 | + ... return f"Processed {len(users)} users" |
| 39 | + >>> |
| 40 | + >>> # Use with direct data |
| 41 | + >>> process_users([{"name": "Bob"}]) |
| 42 | + >>> |
| 43 | + >>> # Use with reference |
| 44 | + >>> process_users("@obj_001.users") |
| 45 | +
|
| 46 | +Exploration utilities: |
| 47 | +
|
| 48 | + >>> from deepset_mcp.tools.tokonomics import explore, search |
| 49 | + >>> |
| 50 | + >>> # Explore object structure |
| 51 | + >>> explore("obj_001", mode="tree") |
| 52 | + >>> |
| 53 | + >>> # Search within objects |
| 54 | + >>> search("obj_001", "Alice") |
| 55 | +""" |
| 56 | + |
| 57 | +from .decorators import explorable, referenceable |
| 58 | +from .explorer import RichExplorer |
| 59 | +from .object_store import Explorable, ObjectRef, ObjectStore |
| 60 | + |
| 61 | +__all__ = [ |
| 62 | + # Core classes |
| 63 | + "Explorable", |
| 64 | + "ObjectRef", |
| 65 | + "ObjectStore", |
| 66 | + "RichExplorer", |
| 67 | + # Decorators |
| 68 | + "explorable", |
| 69 | + "referenceable", |
| 70 | +] |
| 71 | + |
| 72 | +__version__ = "0.1.0" |
0 commit comments