Overview
Sessions are the foundational concept in the midPilot Connector Generator. A session represents a complete workflow instance that tracks all state, configuration, and results as you progress through discovery, scraping, digesting, and code generation. Each session maintains:- Configuration data: Application details, API URLs, and processing parameters
- Documentation items: Scraped or uploaded API documentation chunks
- Job tracking: References to all jobs executed within the session
- Results: Outputs from each processing stage (discovery, schema extraction, code generation)
Session Lifecycle
Session Schema
Sessions follow a consistent data structure defined in the system:src/common/session/schema.py
Session Data Structure
Thedata field contains all session state and results. Common keys include:
| Key | Type | Description |
|---|---|---|
discoveryInput | Object | Discovery job input parameters |
discoveryJobId | UUID | ID of the discovery job |
discoveryOutput | Object | Discovered candidate URLs |
scrapeInput | Object | Scraping configuration |
scrapeJobId | UUID | ID of the scraping job |
documentationItems | Array | All documentation chunks |
digesterInput | Object | Schema extraction parameters |
digesterJobId | UUID | ID of the digester job |
objectClasses | Array | Extracted object class schemas |
codegenInput | Object | Code generation parameters |
codegenJobId | UUID | ID of the codegen job |
generatedCode | Object | Generated connector code |
API Operations
Create a New Session
Create Session with Specific ID
You can create a session with a predetermined ID:Returns 409 Conflict if the session ID already exists.
Get Session Data
Retrieve all data associated with a session:Update Session Data
Merge new data into the session (partial update):The update operation merges the provided data with existing session data. Existing keys are preserved unless explicitly overwritten.
Check Session Exists
Verify if a session exists without retrieving data:HEAD /session/{session_id}
Delete Session
Remove a session and all associated data:Documentation Items
Sessions store documentation chunks asDocumentationItem objects:
src/common/session/schema.py
Upload Documentation
Add documentation files to a session:Documentation is automatically chunked and processed with LLM analysis. Each chunk becomes a separate
DocumentationItem with extracted metadata like tags, categories, and endpoint counts.Retrieve Documentation
Get all documentation items in a session:List Session Jobs
Retrieve all jobs associated with a session:Best Practices
Session ID Management
Session ID Management
Store the session ID returned from creation. You’ll need it for all subsequent operations in the workflow.
Session Reuse
Session Reuse
Sessions support caching of previous results. Use
usePreviousSessionData: true in job inputs to reuse compatible outputs from previous jobs, significantly reducing processing time and LLM costs.Session Cleanup
Session Cleanup
Delete sessions after completing the connector generation workflow to free up storage. Sessions accumulate significant data from documentation processing and intermediate results.
Error Handling
Error Handling
Always check job status before proceeding to the next stage. Failed jobs may leave the session in an inconsistent state requiring manual intervention or session restart.
Related Concepts
Workflow
Learn about the complete connector generation workflow
Job Status
Track job progress and handle job lifecycle