Inspiration
Our inspiration came directly from the Polkadot 2.0 whitepaper. The Agile Coretime model is a revolutionary leap forward, moving Polkadot from a static auction model to a dynamic, on-demand marketplace for blockspace. We were inspired by its power but also struck by its complexity.
We realized that this new model, while powerful for protocols, creates a high barrier to entry for developers and teams. They now have to think like commodity traders, constantly analyzing spot prices, bulk prices, and renewal options. We asked ourselves: "How can we make this 'radically open' technology also 'radically useful' and accessible to everyone?"
The answer was to build an AI assistant an expert broker that abstracts away the complexity and allows anyone to manage their Coretime assets using simple, natural language.
What it does
The Agile Coretime AI Broker is a standalone web application that acts as your personal AI expert for the Polkadot Coretime market.
It provides a simple chat interface where a user can:
Query Live Data: Ask for the real-time, on-demand spot price from the Polkadot Relay Chain.
Get Market Analysis: Ask for the status of the bulk Coretime sales (e.g., current price, cores available) from the Coretime Parachain.
Receive Intelligent Advice: Ask for a purchasing recommendation based on a specific budget, and the AI will analyze the live market data to suggest the most cost-effective option.
The code also includes fully implemented (but currently disabled) "write" tools that will allow the assistant to:
Execute Transactions: Automatically send transactions to enable auto-renewal for a Coretime NFT.
Manage Assets: Automatically send transactions to list a user's Coretime NFT for sale on the marketplace.
How we built it
We built this project with a clean, two-part "Frontend Face / Backend Brain" architecture, which allowed us to build and debug each part independently.
The "Backend Brain" (Node.js / Express)
We built a server using Node.js, Express, and TypeScript.
We used the @polkadot/api (Polkadot.js) library to establish live WebSocket connections to the Polkadot testnets (specifically the Westend Relay Chain).
We used the @modelcontextprotocol/sdk to define a set of "AI tools" (like queryOnDemandPrice) that our backend can execute.
The server listens for simple POST requests, which allows any frontend to securely interact with it.
The "Frontend Face" (Python / Streamlit)
We built a clean, real-time chat UI using Streamlit.
The frontend uses the Python requests library to send the user's chat prompt to our Node.js backend's API endpoint (http://localhost:8080).
It then parses the JSON response from the server and displays the AI's answer in the chat window, managing the session state and chat history.
Challenges we ran into
We faced three significant challenges that defined this project:
Testnet Instability: Our project relies on two chains: the Relay Chain and the Coretime Parachain. While the Relay Chain was stable, the public RPC endpoint for the Coretime Parachain was consistently offline (throwing 1006: Abnormal Closure errors). We had to architect our application to be resilient.
Complex Node.js & TypeScript Configuration: Getting a modern Node.js project with "type": "module" (ESM) to work correctly with ts-node, express, and the Polkadot.js libraries was a major debugging challenge.
Frontend/Backend Mismatch: Our initial attempt at a pure HTML/CSS/JS frontend failed due to complex CORS and routing errors. We pivoted to a Streamlit UI, which proved to be a far better fit.
Accomplishments that we're proud of
Functional Cross-Language Architecture: A Python/Streamlit frontend talking to a Node.js/TypeScript backend.
Connected to Polkadot: Successfully read live, real-time data from the Polkadot testnet.
Resilience: Application gracefully handles parachain outages.
Debugging Perseverance: Solved multiple configuration and routing issues.
What we learned
APIs as the Great Unifier: A well-defined API decouples frontend and backend completely.
Testnets Are Unreliable: Always build with error handling and fallbacks.
Use the Right Tool: Streamlit enabled rapid development of a robust UI.
What's next for Agile Coretime AI Broker
Activate Write Tools: Enable auto-renewal and marketplace listing tools once the parachain stabilizes.
Advanced Analysis: Enhance the recommendPurchase tool with predictive market modeling.
Full Decentralization: Move AI logic on-chain or to decentralized compute for a trustless AI broker.
Built With
- chain
- coretime
- express.js
- modelcontextprotocol/sdk
- node.js
- parachain
- polkadot
- polkadot/api
- python
- relay
- requests
- streamlit
- testnet)
- typescript
- westend
Log in or sign up for Devpost to join the conversation.